Quest 5.0 Beta 2

Alex
20 Jun 2011, 18:02

Pertex
21 Jun 2011, 10:54
Hi Alex,
could you give us some infos about turnscripts? How do I create a afterturnscript or a script, which is triggered by entering a room?

Alex
21 Jun 2011, 11:26
Any Turn Script that is enabled and in the current scope will be run after the player's input has been processed.

By "in the current scope", I mean any turn script defined in a room that also contains the player, OR any turn script that is defined with its parent as "game" or null.

So you can create a "global" turn script by defining it under "game", or with no parent at all. You can limit a turn script to a particular room by defining it in that room.

You can enable or disable a turn script by setting its "enabled" property.

If you want a script to run when you enter a room, you don't need to use a turn script. Instead, go to the Scripts tab for the room, and you can define scripts for "After entering the room", "Before entering the room for the first time" and "After entering the room for the first time".

Pertex
07 Jul 2011, 14:24
Alex wrote:
So you can create a "global" turn script by defining it under "game", or with no parent at all. You can limit a turn script to a particular room by defining it in that room.


With the Editor I can create such turnscripts, but how do I do this with script-commands? This code

<game name="turn">
<start type="script">
create turnscript (test)
SetTurnScript (test) {
msg ("wwww")
}
</start>
</game>

returns "Error running script: Error compiling expression 'test': Unknown object or variable 'test'"
And how can I create a turnscript for a spezific room with a script?

Alex
07 Jul 2011, 15:24
The parameter for "create turnscript" is a string, so the line should be:


create turnscript ("test")


If you want it to be just for a particular room:


test.parent = someroom


In the current build you'll also need to explicitly set the enabled property:


test.enabled = true


(or use the EnableTurnScript function)

If you don't then you'll get an error, as "enabled" will be null and the turnscript runner expects a boolean (checking in a fix for this now)