Using "Play" with different rooms?

michaelsahn
31 Jan 2014, 01:50
I'm a new user and enjoying Quest very much. Forgive the basic question but I've searched the forum and FAQ for this and cannot find an answer -

When I use the play command to play through my game, is there a way I can move directly to a specific room, so that I don't have to play from the beginning?

Thanks!

Mike

HegemonKhan
31 Jan 2014, 04:06
You can create a COMMAND:

A Command will take whatever is typed in during game play, using that as an input, and execute scripting (a Function) using it.

though, you have to also create that scripting (a Function) too, of course.

You use a Function as the scripting, as a Function enables the use of Parameters, which allows for the transfer of the typed-in input from the Command into the Function's scripting (and changing the labels of the used things within the parameters too).

conceptually:

Command: "goto_command"
Command's input pattern: goto #text# (or: goto #object#)
Command's Parameters: "player" and "text"
during game play, the user types in: goto room_2 (for example)
Command's Script: (call upon a function): goto_function (player, text) ~ or: goto_function (player, object)

Function: "goto_function"
Function's Parameters: (player -> moving_object, text -> destination_object)"
Function's Scripting:

if ("destination_object" is a Room Object), then move "moving_object" to "destination_object"

in the GUI~Editor, the "moving" script is:

run as a script -> add a~new script -> Objects -> MoveObject -> (set it up)
~OR~
run as a script -> add a~new script -> Variables -> Set a variable or attribute -> player.parent = room_2

In Code: the "moving" script is:

http://quest5.net/wiki/MoveObject
MoveObject (player, room_2)
~OR~
http://quest5.net/wiki/Parent
http://quest5.net/wiki/Object
player.parent = room_2

-------

concept of "parents~children, nesting, or indenting":

HK = (ROOT) parent, direct parent of "HK's pants with pockets", and indirect parent of "wallet", "$1", and "$5"
-> HK's pants with pockets = direct parent of "wallet", indirect parent of "$1" and "$5", and direct child of "HK"
->-> wallet = I think you get the idea
->->-> $ 1 = I think you get the idea
->->-> $ 5 = I think you get the idea

c:\\
-> programs
->-> quest

this applies to the Scripting too (showing it in code):

<object name="monster_1">
-> <inherit name="editor_object" />
-> <alias>orc</alias>
-> <attr name="hp" type="int">50</attr>
-> <attr name="dead" type="boolean">false</attr>
-> <attr name="displayverbs" type="listextend">Fight</attr>
-> <attr name="fight" type="script"><![CDATA[
->-> if (this.dead=true) {
->->-> msg ("It's already dead, silly!")
->-> } else if (this.dead=false) {
->->-> this.hp = this.hp - player.damage
->->-> msg ("You attack the " + this.alias + ", doing " + player.damage + " damage, and it now has " + this.hp + " HP left.")
->->-> if (this.hp <= 0) {
->->->-> this.dead=true
->->->-> msg ("You killed the " + this.alias + ".")
->->-> }
->-> }
-> ]]></attr>
</object>

<object name="monster_1">
<inherit name="editor_object" />
<alias>orc</alias>
<attr name="hp" type="int">50</attr>
<attr name="dead" type="boolean">false</attr>
<attr name="displayverbs" type="listextend">Fight</attr>
<attr name="fight" type="script"><![CDATA[
if (this.dead=true) {
msg ("It's already dead, silly!")
} else if (this.dead=false) {
this.hp = this.hp - player.damage
msg ("You attack the " + this.alias + ", doing " + player.damage + " damage, and it now has " + this.hp + " HP left.")
if (this.hp <= 0) {
this.dead=true
msg ("You killed the " + this.alias + ".")
}
}
]]></attr>
</object>


--------

to do this in the GUI~Editor:

click on 'Commands' in the "tree of stuff", so that it is highlighted:

the left side (left pane) 's new game default's "tree of stuff":

Objects
Game
Verbs
Commands
Room
Player
Functions
Timers
Walkthrough
Advanced
Included Libraries
English.aslx
Core.aslx
Templates
Dynamic Templates
Object Types
Javascript
Filter -> Show Library Objects


now, that 'Commands' is highlighted, it's further details~options are shown on the right side (right pane).

click on the "Add" button ->

Pattern drop down box: [command pattern] (leave it as this)
the empty box: goto #object#

Name box: goto_command

"Unresolved object text" box: You can't go here, as it doesn't exist.

Script: add new script -> Scripts -> Call Function ->

Call function: goto_function
with Parameters: Add -> player
with Parameters: Add (again) -> object

now, again in the "tree of stuff", click on 'Functions' so that it is highlighted:

and on the right side: Add ->

Function Name: goto_function

Return Type: [none] (leave this as none)

Parameters: Add -> moving_object
Parameters: Add (again) -> destination_object

Script: Add new script ->

Scripts -> If... -> [EXPRESSION] -> destination_object = null ->
-> then -> Add new script -> Scripts -> for each... ->

For each: loop variable: object_x
in source: [ALL OBJECTS]

->-> run script -> Scripts -> If... -> [EXPRESSION] -> object_x.alias = destination_object.alias
->->-> then -> Add new script -> Variables -> Set a variable or attribute ->

Set variable destination_object = [EXPRESSION] object_x

Add new script -> Scripts -> If... -> [EXPRESSION] -> destination_object = null ->
-> then -> Add new script -> Output -> Print a message -> [MESSAGE] -> You can't go here, as it doesn't exist.

Add new script -> Scripts -> If... -> [EXPRESSION] -> HasAttribute (destination_object, "inherit") = true ->
-> then -> Add new script -> Scripts -> If... -> [EXPRESSION] -> GetAttribute (destination_object, "inherit") = "editor_object"
->-> then -> Add new script -> Variables -> Set a variable or attribute -> moving_object.parent = destination_object
-> Add else if -> Output -> Print a message -> [MESSAGE] -> You can't go here, as it's not a room.
Add else if -> Output -> Print a message -> [MESSAGE] -> You can't go here, as it's not a room.

argh... this is a pain in the "rear end" to try to do in the GUI~Editor (I have no idea if the above will work or not), lol ... so much easier in code... lol

jaynabonne
31 Jan 2014, 22:55
You can also simply drag and drop the player into the desired room before you hit Play...

michaelsahn
01 Feb 2014, 16:32
Thank you both for your help! The drag/drop player does exactly what I need.

-Mike