Global variables
tvisarl
05 Aug 2016, 17:44Is it possible to create a global variable, i.e a game's attribute in a library? Just because the library will be simpler to use.
Thanks,
Thierry
hegemonkhan
05 Aug 2016, 19:21for quest, Attributes are its global VARIABLES (as long as the Object that holds/contains the Attribute, exists / still exists, of course)
Attributes must be inside of an Element (Object, Verb, Function, Turnscript, Object Type, etc):
// 'mygame.aslx' Game File:
<asl version="550">
<include ref="mylib.aslx" />
</attr>
// 'mylib.aslx' Library File:
<library>
<attr name="strength" type="int">100</attr>
</library>
// ERROR!
VS
// 'mygame.aslx' Game File:
<asl version="550">
<include ref="mylib.aslx" />
<object name="room">
</object>
</attr>
// 'mylib.aslx' Library File:
<library>
<object name="HK">
<attr name="parent" type="object">room</attr>
<attr name="strength" type="int">100</attr>
</object>
</library>
// NO error
oh... you mean actually with the 'game' Game Object's Attributes?
I don't think so... well... maybe you can have the 'game' Game Object, be in a library... depends how the quest initialization process/order works... no idea if you can or can't...
it would look like this:
// 'mygame.aslx' Game File:
<asl version="550">
<include ref="mylib.aslx">
</asl>
// 'mylib.aslx' Library File:
<library>
<game name="xxx">
<attr name="state" type="int">0</attr>
</game>
</library>
// but, I don't know how the initialization works, in whether you can have the 'game' Game Object (and thus its Attributes inside of it), initialized from a library file, or whether your 'game' Game Object MUST be in your game file.
// Quest requires: the 'game' Game Object' and a Player Object to be inside of a Room Object
The Pixie
05 Aug 2016, 22:05Quest does not support global variables as such. Instead, create an object in the library, and set its attributes.