Hyperlinks in room description after moving the player

Mmaarten
15 Apr 2020, 20:19

Hi there!

I have an elevator in game that has the following code:

  msg ("You insert your keycard and call the elevator.")
  SetTimeout (2) {
    MoveObject (player, TownHall)
  }
}
else {
  msg ("You approach the elevator but there is no call button. Only a slot for a keycard.")
}

Basically: it teleports the player to a room that is "on top" (as seen by the map).

This all works fine but as soon as I enter the new room, I cannot click any hyperlinks in the room description/ the "you can see"/ "you can go" Until I take a turn (enter something in the command line)

I tried clearing the screen and reprinting the descriptions but that doesn't work

Any ideas?


mrangel
15 Apr 2020, 21:48

I think you might need to call FinishTurn to update the command links after moving the player.

FinishTurn used to be called every time data is sent from the Quest backend to the browser frontend, to update the object lists in the sidebar, disable object links for objects that are no longer visible (and put the right verbs into the menu for those that are), and run turnscripts.

In Quest 5.8, it was changed so that FinishTurn runs once per command entered; so it doesn't run automatically if a timer moves the player, or if the player interacts with a custom UI element. This makes sense for some turnscripts; not for all the other things that FinishTurn does.

I suspect that adding a line FinishTurn() immediately after your MoveObject line will resolve this issue.


Mmaarten
15 Apr 2020, 22:35

It gives inconsistent results :/

it works about 75% of the time. Calling it twice right after each other does the job though...

Thanks for the help <3