On Ready

How does on ready work?

According to the documentation it should wait for outstanding results. That'd be pretty handy if I've got choices that may or may not be showing up depending on game state.

So with something like this:

if (player.stealth = True) {
  ShowMenu ("Do you wish to use your stealth skill?", Split("yes;no",";"), false) {
    if (result = "yes") {
      msg ("You start sneaking")
      player.sneaking = true
    }
  }
}
on ready {
  msg ("You move into the room")
  MoveObject (player, AnotherRoom)
}

My expected behaviour would be that if the player doesn't have stealth it goes straight to the move command, but if they do they get shown the choice and the move command holds off until the player makes it. What I actually get is:

Do you wish to use your stealth skill?
1: yes
2: no
You move into the room
You have found another room.

Now obviously in my toy scenario it'd be trivial to stick the onready block into an else block instead and duplicate the message and move in the showmenu block (or put them into a function and call that from both places if they're representative of something more complicated). That's pretty much the approach I've been taking so far, but it's sometimes inconvenient so if there is a way to make onready behave itself I might be inclined to use it for some things.


Nevermind, I found this thread:
http://textadventures.co.uk/forum/quest/topic/3806/does-on-ready-work

My answers are all there.


See also here:
http://docs.textadventures.co.uk/quest/blocks_and_scripts.html


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums