Creating TurnScripts in Online game editor (no attributes tab!!)

legaleagle7000
10 Sept 2016, 14:49

Hi all,

When using the online game editor, one can create a game-wide command for turnscripts.

However, this confusingly has various commands for "set" "create" and "enable" --- if I want to create a turn script, which do I use or if all, in what order? I've played around with this with no success.

Also, I see tips on how to do this with the game interface but with the online editor, unfortunately it seems perhaps there is no automatic interval tracking so the game doesn't know that player has completed X number of turns, thus never triggering the script?

I've seen a few posts / tutorial help with turn scripts and they all require adding an attribute to the player to track number of turns. However, I see no way to do this in the online game editor. Any help? Thanks much!


onimike
10 Sept 2016, 15:27

If you can I recommend downloading Quest and using offline their way more features and less buggy at least for me and attributes in online I'm not sure on that.

Edit: yeah I checked online editor doesn't seem to be a way to add attributes but if you click settings at top right and uncheck simple mode you will get timers and functions.


legaleagle7000
10 Sept 2016, 19:06

Thanks . I'm not on a Windows machine so can't download.


hegemonkhan
10 Sept 2016, 19:53
// HK edit:

Pixie's correction:

you can use scripting via:

'game' Game Object -> 'scripts' Tab -> 'start' Script -> (see below: add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> set it up)

// ----------------------------------

you can use scripting to create/add/set/re-set/alter/manipulate attributes, in the online/web version, right? :

'whatever' (scripting-able) Element -> run as script -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see it up, see below for example)

set variable game.turns = [EXPRESSION] 0

// and then in your (global) Turnscript, you'd have (as the last script):

'whatever' (global) Turnscript -> run as script -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see it up, see below for example)

set variable game.turns = [EXPRESSION] game.turns + 1

// or alernatively, you can create a special 'changed' Script too:

'whatever' (scripting-able) Element -> run as script -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see it up, see below for example)

// I hope this works... not sure on the syntax, or if it even can be done this way or not:
// and using when changing rooms for increasing the turns, for this example:

player.changedparent = [EEXPRESSION] game.turns = game.turns + 1

// if the above way doesn't work (there's no syntax for it to work), then you're going to have to figure out how to use 'set', and set it ('set') up like this (again my syntax may not be right):

set (player, "changedparent", game.turns = game.turns + 1)

// ------------------------

// as for how to create a Turnscript (assuming this method/way is possible on the online/web version):

 http://docs.textadventures.co.uk/quest/scripts/create_turnscript.html

create turnscript (NAME_OF_YOUR_TURNSCRIPT)

// and then you're going to have to use 'set' (again, if you can) to set up your Turnscript's Attributes and scripting:

// optionally (if you want it to start enabled when the game starts):
set (NAME_OF_YOUR_TURNSCRIPT, "enabled", true)

http://docs.textadventures.co.uk/quest/scripts/set.html

set (NAMEOF_YOUR_TURNSCRIPT, "script", YOUR_SCRIPT_STATEMENT/EXPRESSION) 
// have to do a 'set' for each/all/every individual script, for examples:
set (NAMEOF_YOUR_TURNSCRIPT, "script", msg("script 1")) 
set (NAMEOF_YOUR_TURNSCRIPT, "script", msg("script 2")) 
set (NAMEOF_YOUR_TURNSCRIPT, "script", msg("script 3")) 

// if you want to determine when to enable/disable a Turnscript (whether or not you have it set to being enabled at game start or not):

EnableTurnscript (NAME_OF_YOUR_TURNSCRIPT) // this will enable ("turn on" --- NAME_OF_YOUR_TURNSCRIPT.enabled = true) your Turnscript

Disableturnscript (NAME_OF_YOUR_TURNSCRIPT) // this will disable ("turn off" --- NAME_OF_YOUR_TURNSCRIPT.enabled = false) your Turnscript

// you may have to use 'set' instead of using the 'EnableTurnscript/DisableTurnscript' Functions, if you can't use them directly:

http://docs.textadventures.co.uk/quest/scripts/set.html

set (NAME_OF_YOUR_TURNSCRIPT, "enabled", true) // to enable your Turnscript --- this is the exact same thing that the, 'EnableTurnscript(NAME_OF_YOUR_TURNSCRIPT)' Function, does / how it works / does what it does
~OR~
set (NAME_OF_YOUR_TURNSCRIPT, "enabled", false) // to disable your Turnscript --- this is the exact same thing that the ,'DisableTurnscript(NAME_OF_YOUR_TURNSCRIPT)' Function, does / how it works / does what it does

The Pixie
10 Sept 2016, 20:10

When using the online game editor, one can create a game-wide command for turnscripts.

You can on-line too. You have to do it via the Scripts tab of the game object, but otherwise itis the same.

However, this confusingly has various commands for "set" "create" and "enable" --- if I want to create a turn script, which do I use or if all, in what order? I've played around with this with no success.

These are all optional. If you want a turn script that runs all the time, make sure the "Enabled when the game starts" box is ticked. No need to use those functions at all. If you want it to stop and start again, then you can use the enable and disable things. No idea why anyone would use the others.

Also, I see tips on how to do this with the game interface but with the online editor, unfortunately it seems perhaps there is no automatic interval tracking so the game doesn't know that player has completed X number of turns, thus never triggering the script?

There is no automatic tracking with the off-line editor either. The turn scripts trigger every turn if enabled.

You can use a turn script to track the number of terms, however.

I've seen a few posts / tutorial help with turn scripts and they all require adding an attribute to the player to track number of turns. However, I see no way to do this in the online game editor. Any help? Thanks much!

Personally I would add it to the game, but either way. You have no Attributes tab on-line, so cannot set attributes that way, but you can set them in the start script of the game object. Just do this:

game.turncount = 0

And in your turn script:

game.turncount = game.turncount + 1

If you are not sure what to do with code, see here (which is written for the off-line editor, but works for the on-line too):
http://textadventures.co.uk/forum/samples/topic/4771/how-to-copy-and-paste-code