Moving player with script.
doomspawn
06 May 2013, 20:04Hello,
total newbie to this wonderful software, but I have started making my first adventure and still learning of course, but I have a question which I havent seen either on the wiki or here - Im trying to move the player from his current location to another room, based on an action. For example, it would go like this: The player starts a fan and gets blown away to another location, OR walks on a trap door and ends up in a cellar. I realise this is simple for you, but I just cant get this to work...
Thanks.
total newbie to this wonderful software, but I have started making my first adventure and still learning of course, but I have a question which I havent seen either on the wiki or here - Im trying to move the player from his current location to another room, based on an action. For example, it would go like this: The player starts a fan and gets blown away to another location, OR walks on a trap door and ends up in a cellar. I realise this is simple for you, but I just cant get this to work...
Thanks.

jaynabonne
06 May 2013, 21:41The script command to actually move the player would be "Move Object" with object "player" and to being the room where you want the player moved.
As far as setting up the condition where that occurs, it depends on what you're trying to do. Each case is different. For instance, the two examples you mentioned below would each be handled differently. The first would probably be something like a "fan" object with a "turnon" handling script, which would print out what happens and then moves the player. The second - I don't know. The only movement is room to room anyway, so perhaps you could have a room where in the "onenter" script it prints a message and then moves the player to some *other* room.
If you can come up with a specific example that you actually want to try, and you have trouble, we can help with that. I hope the above generally answers what you're asking.
As far as setting up the condition where that occurs, it depends on what you're trying to do. Each case is different. For instance, the two examples you mentioned below would each be handled differently. The first would probably be something like a "fan" object with a "turnon" handling script, which would print out what happens and then moves the player. The second - I don't know. The only movement is room to room anyway, so perhaps you could have a room where in the "onenter" script it prints a message and then moves the player to some *other* room.
If you can come up with a specific example that you actually want to try, and you have trouble, we can help with that. I hope the above generally answers what you're asking.

psymann
06 May 2013, 21:43If you're using the GUI (ie not writing raw code), then you need to
- add new script
- choose 'move' off the menu
- move object "player" to object "room-that-you-want-him-to-move-to"
The "player" object is the default "you" that is created by Quest. By default, it is created in the first room you ever made and should show up on the objects list on the left menu inside that room.
In code mode, it is:
Think that's right anyway
That script, you'd then need to set up against a Verb or Command, such as if you have an Object called Fan, you might have a Verb called Start. So you'd add that to the Verbs for Fan, then choose "run a script" from the drop-down menu, and then do the above.
psy
- add new script
- choose 'move' off the menu
- move object "player" to object "room-that-you-want-him-to-move-to"
The "player" object is the default "you" that is created by Quest. By default, it is created in the first room you ever made and should show up on the objects list on the left menu inside that room.
In code mode, it is:
MoveObject (player, MyRoom)
Think that's right anyway

That script, you'd then need to set up against a Verb or Command, such as if you have an Object called Fan, you might have a Verb called Start. So you'd add that to the Verbs for Fan, then choose "run a script" from the drop-down menu, and then do the above.
psy
doomspawn
06 May 2013, 22:17Thanks both,
the piece of information that I missed was that I needed to create the player as an object. I tried to move object, without actually finding "player" as an object. I told you a was a total newbie...but that piece of information I did not find in the help files. Thanks for the replies, I will probably ask some stupid questions soon again!
the piece of information that I missed was that I needed to create the player as an object. I tried to move object, without actually finding "player" as an object. I told you a was a total newbie...but that piece of information I did not find in the help files. Thanks for the replies, I will probably ask some stupid questions soon again!


psymann
06 May 2013, 22:33Bear in mind you don't actually need to "create" player as an object - Quest should already have done that for you. You should find it sitting there as an object already inside the first room you made.
At least - that's what it did for me
At least - that's what it did for me

HegemonKhan
08 May 2013, 00:39upon creating a (new) game:
these things are generated for you:
1. "player" (your default~starting single Player Object) and it should be in "room" (your default~starting Room Object)
2. "room" (your default~starting Room Object)
3. "game" (the Game Object)
4. "English" (one of two default libraries = gives~sets the language~text as English)
5. "Core" (one of two default libraries = the Game Engine)
it looks like this in code (though this will probably scare you, being a noob currently to quest, unless you're a programmer):
As Psy and Jayne said, the script choice "Move" in the GUI~Editor (the noob-frienldy mode~screen with the click on stuff, drop down boxes, and etc) that you're using, should enable you to select "player" as the object that you want to move.
some simple reasons of why it may not work:
1. you deleted~removed your "player" Player Object
2. you changed your "player" Player Object's "type of object" to "room"; it's default should be "object"
--------
an example of using the "move" script:
Game (left pane = the "tree of stuff", click on "Game" to highlight it) -> Script (right pane, it's a Tab at the top, click on it) -> Start Script -> Add new script -> (A) at the very top, click on move, OR (B) look down the list for: Objects -> Move Object ->
Move object [object] [player] to [object] ["room", or "whatever place~room that you want and created already"]
P.S.
"Game -> Script -> Start Script" = is what will be done at the beginning of your game, for example, this is a good place to put in an introductionary message and~or a character creation. So, this isn't generally a good place to put a "move" script, lol.
---------
if you have the "player" Player Object in your "tree of stuff" (left pane), then you can check that it's not a "room" type of object (which would cause it to not work, as, at least I think lol, you can't move a room... maybe you can, lol):
Player (left pane, the "tree of stuff") -> Setup (right pane, Tab) -> Type ["Object" or "Object and/or Room"]
---------
if you deleted~removed your "player" Player Object (it's nowhere on the "tree of stuff", left pane), then you can do this:
Objects (left pane, "tree of stuff") -> at the very top, click on the "Add" of the horizontal bar (File ~ Edit ~ Add ~ Tools ~ Help) -> Object -> (name it, for example, "player") ->
"player" (or whatever you named it, left pane, "tree of stuff") -> Options (right pane, Tab) -> Player, Player: [can be a player] -> (This sets this object as a Player Object)
P.S.
you can then click (and hold) on "player" (left pane, tree of stuff) and drag (and then release mouse button) it to where you want to put it into being initially, such as "room" or "whatever room that you've created and named" (left pane, the tree of stuff).
then, you can put in your "move" script where ever you want for your "player" or "whatever" object (as an "Object", Object and/or Room", or a Player Object, see above on how to set your object to be a Player Object).
these things are generated for you:
1. "player" (your default~starting single Player Object) and it should be in "room" (your default~starting Room Object)
2. "room" (your default~starting Room Object)
3. "game" (the Game Object)
4. "English" (one of two default libraries = gives~sets the language~text as English)
5. "Core" (one of two default libraries = the Game Engine)
it looks like this in code (though this will probably scare you, being a noob currently to quest, unless you're a programmer):
<asl version="540">
<include ref="English.aslx"/>
<include ref="Core.aslx"/>
<game name="HK Test Game">
<gameid>ccfa6e39-0c89-4d69-96f4-c3017938a5f3</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>
As Psy and Jayne said, the script choice "Move" in the GUI~Editor (the noob-frienldy mode~screen with the click on stuff, drop down boxes, and etc) that you're using, should enable you to select "player" as the object that you want to move.
some simple reasons of why it may not work:
1. you deleted~removed your "player" Player Object
2. you changed your "player" Player Object's "type of object" to "room"; it's default should be "object"
--------
an example of using the "move" script:
Game (left pane = the "tree of stuff", click on "Game" to highlight it) -> Script (right pane, it's a Tab at the top, click on it) -> Start Script -> Add new script -> (A) at the very top, click on move, OR (B) look down the list for: Objects -> Move Object ->
Move object [object] [player] to [object] ["room", or "whatever place~room that you want and created already"]
P.S.
"Game -> Script -> Start Script" = is what will be done at the beginning of your game, for example, this is a good place to put in an introductionary message and~or a character creation. So, this isn't generally a good place to put a "move" script, lol.
---------
if you have the "player" Player Object in your "tree of stuff" (left pane), then you can check that it's not a "room" type of object (which would cause it to not work, as, at least I think lol, you can't move a room... maybe you can, lol):
Player (left pane, the "tree of stuff") -> Setup (right pane, Tab) -> Type ["Object" or "Object and/or Room"]
---------
if you deleted~removed your "player" Player Object (it's nowhere on the "tree of stuff", left pane), then you can do this:
Objects (left pane, "tree of stuff") -> at the very top, click on the "Add" of the horizontal bar (File ~ Edit ~ Add ~ Tools ~ Help) -> Object -> (name it, for example, "player") ->
"player" (or whatever you named it, left pane, "tree of stuff") -> Options (right pane, Tab) -> Player, Player: [can be a player] -> (This sets this object as a Player Object)
P.S.
you can then click (and hold) on "player" (left pane, tree of stuff) and drag (and then release mouse button) it to where you want to put it into being initially, such as "room" or "whatever room that you've created and named" (left pane, the tree of stuff).
then, you can put in your "move" script where ever you want for your "player" or "whatever" object (as an "Object", Object and/or Room", or a Player Object, see above on how to set your object to be a Player Object).