![]() |
![]() ![]() ![]() ![]() ![]()
|
Author | Topic: Gotta question |
Pikaflare |
![]() How do I check if there is an item in a certain room. I want to move the player to that room, check if it's there, and move the player back to the room he was in. I just don't know how to move the player back to the room he was in. Can someone help me? Maxpowr |
passerby |
![]() well it turns out that moving the player back is really, really easy. (The following is based on QDK). create a string variable (lets call it 'previousRoom'). Just before you actually move the player, put the '#quest.currentroom#' value into '#previousRoom#'. You now have it stored, so then you move the player do whatever you want, then when you're done, issue the 'move player to new room' command and give it the '#previousRoom#' value. You will now be back where you started. Just remember that if you don't want the process to be seen by the player, you need to turn off the text output before you start and turn it on again afterwards.
|
passerby |
![]() well it turns out that moving the player back is really, really easy. (The following is based on QDK). create a string variable (lets call it 'previousRoom'). Just before you actually move the player, put the '#quest.currentroom#' value into '#previousRoom#'. You now have it stored, so then you move the player do whatever you want, then when you're done, issue the 'move player to new room' command and give it the '#previousRoom#' value. You will now be back where you started. Just remember that if you don't want the process to be seen by the player, you need to turn off the text output before you start and turn it on again afterwards.
|
passerby |
![]() please excuse the double posting. I hit the button again, after it didn't appear the first time. |
Pikaflare |
![]() Great. Thanks a lot! Maxpowr |
Alex |
![]() A much simpler and more elegant solution would be to use the $locationof(...)$ function. |
passerby |
![]() Yes, that would be even better wouldn't it - you could put all the code for moving the player, doing whatever, and then moving them back into one procedure, and simply the process. Or have two procedures (one to go to the new room and one to return) if they want to have the player able to return based on some condition. |