Answer phone only if in correct room?

OurJud
12 Dec 2016, 23:09

Does anyone know why this isn't working?

I have a phone ringing which can only be answered if the player is in the room where the phone is.

I have a global command for answer phone which runs this script:

if (game.pov.parent = living room2) {
  stop sound
  play sound ("scarycall.mp3", false, false)
  SetTimeout (3) {
    msg ("It's a garbled message. A nutter playing a joke. You hang up.")
  }
}
else {
  msg ("It's coming from the living room.")
}

When I type answer phone when not in the living room2 I get the response I don't understand (or at least my custom response of huh?)

In fact on further checks, I get that response even if I am in the living room.

The phone is not an object.


OurJud
13 Dec 2016, 01:42

Yet another corrupt file! I went into the game code and found the command was before the < /game > tag when all the other global default commands came after. I shifted my custom command to after the < /game > tag and now it works as it should.

I'm now wondering if every global command I make is going to be placed in code 'limbo'.


The Pixie
13 Dec 2016, 08:26

How do you create new commands? Try going to the commands obkect in the left pane, and clicking add in the right pane. Or try right-clicking in the left pane and selecting Add command. Hopefully one will get it right!


OurJud
13 Dec 2016, 16:17

If it's a command that only applies to a specific room I right click the room and choose Add command. If it's a global command I do the same but on game.

I'll try your method of adding it to the command list. Sounds like the safest bet.

Thank you.