let's create our own new game via directly in code:
--------------
here's what a new game's code looks like for reference for you:
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="xxx">
<gameid>xxx</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>
--------------
so, open up a new notepad, wordpad, or (preferably) notepad++, and save the blank file using the *.aslx extension (both your game file and~or any library files, use the same *.aslx extension)
notepad++ (
https://notepad-plus-plus.org/ )
once you downloaded and installed it, open~start it up, and within it, at the menu bar at the top of the screen, under the 'language' category, choose 'XML (eXtensible Markup Language)' as that is what quest code uses as its language. It'll color-code stuff for you, making it easier to read, write, and troubleshoot your quest coding.
-------------
INDENTATION ('nesting') IS VERY IMPORTANT, use the tab keyboard key for each level of indentation required (it's much better than using 2 spacebar keys... as I've learned the hard way, lol)
------------
first, create the 'asl' creation tag block
the 'asl' creation tag block is your entire game code, so everything has to be inside of it:
<asl> // the beginning tag of the 'asl' block
// your entire mass of game code
</asl> // the ending tag of the 'asl' block
the ' version="550" ' inside of the beginning tag of the 'asl' creation tag block, is the 'asl' creation tag's own Attribute, this version number has to match up with your downloaded quest.exe version, for the engine to be able to read your game code.
----------
now, add in the two required libraries:
English.aslx
Core.aslx
English.aslx sets the text to be in english
Core.aslx is actually a collection of many core files which make up the engine
the 'English.aslx' library file MUST come first (be above), before the 'core.aslx' library file, as this is the order that the quest engine builds itself up.
the 'include ref' creation tag lines are your library files that your game uses, the quest engine is actually a bunch of library files, so if you're really good at programming you can completely design your own quest engine, quest is that powerful~customizable !!!
<include ref="English.aslx" /> // beginning '<include' and ending '/>' creation tags on a single line
<include ref="Core.aslx" /> // beginning '<include' and ending '/>' creation tags on a single line
the 'ref="xxx.aslx" ' is the 'include' creation tag's own Attribute, which is what library file is gotten and used for your building up the quest engine and your game
note that your actual physical library files themselves (*.aslx) must be in the same folder as your quest.exe and~or your game file (*.aslx) ~ I get confused on this, thus the 'and~or', lol. This is required for these code lines to actually be able to get the library files for usability.
------------
next we add in the required special 'game' Game Object 'creation' tag block, which holds your global~game settings and a bunch of other related special stuff:
<game> // beginning creation tag
// Attributes
</game> // ending creation tag
the ' name="xxx" ' is the 'game' creation tag's own attribute, this is the name of your game.
the special 'game' Game Object is an Object, which means that it (as Objects) can hold~contain Attributes and~or other Objects.
the 'Object' Element: able to hold~contain Attributes and~or other Objects
the special 'game' Game Object, while it can hold~contain other Objects, it's not suppose to, as in the GUI~Editor, you can't add Objects into the special 'game' Game Object, so you shouldn't add Objects into the special 'game' Game Object, via in code, either.
the default Attributes of the special 'game' Game Object are:
<gameid>xxx</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
(look at the 'game' Game Object in the GUI~Editor, do you recognize the options~settings 'version' and 'firstpublished' ??? After you complete this code writing of a default new game code, try changing the version or firstpublished in the GUI~Editor, save your game file, then check your game's code, or vice versa, change the 'version' or 'firstpublished' in code, and see what happens in the GUI~Editor)
the 'gameid' is a required String Attribute, using some algorithm to randomly generate a unique string, as this serves as the 'ID' for your game. Like a car has a licence plate, or you have: a Driver ID card or a Social Security Number or DNA or fingerprint or iris pattern or voice pattern, etc etc etc
// note:
//
// the 'name' String Attributes are the 'ID" Attributes for quest, they MUST be unique.
//
// whereas, the 'alias' String Attributes don't have to be unique.
//
// for example:
<object name="orc">
</object>
<object name="orc">
</object>
ERROR!
VS
<object name="orc_1">
<alias>orc</alias>
</object>
<object name="orc_2">
<alias>orc</alias>
</object>
NO error
the 'version' (String or Double ~ not sure) Attribute and 'firstpublished' (String or Integer ~ not sure) Attribute, are just for your own documentation and information. Let's say I create a simple skeleton~bare bones game, leaving its version as '1.0', but then I go back and expand~improve upon my game, changing this version to being '2.0', basically it's a way for you to keep track of your game making's progress history. And 'firstpublished' is self-explanatory, lol.
well, let's add in some more Attributes via code (which we see in the GUI~Editor):
'attr' is used in code: conceptually it's short for 'attribute'
'int' is used in code: conceptually it's short for 'integer'
full code form:
<attr name="author" type="string">BenM</attr>
or it's (a String Attribute only) shortened code form:
<author>BenM</author>
recognize this Attribute? (see below)
in GUI~Editor:
'game' Game Object -> (whatever the Tab~s)
(Object Name: game)
Attribute Name: author
Attribute Type: string
Attribute Value: BenM
more Attributes:
<description>xxx</description>
<subtitle>xxx</subtitle>
<category>xxx</category>
<difficulty>xxx</difficulty>
<cruelty>xxx</cruelty>
// etc etc etc
for example:
// vertical placement of Attributes don't matter for the most part ~ there's a few exceptions, so long as those Attributes are placed within the correct Element (the correct Element creation tag block), via correct indenting~'nesting' ~ horizontal placement is VITALLY IMPORTANT), of course.
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="testing game stuff">
<gameid>842278ef-87f7-4fa9-8a9f-7f81f2933f46</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
<author>HK</author>
<description>this is just a game file for testing stuff</description>
<subtitle>HK's testing stuff game file</attr>
<category>Simulation</category>
<difficulty>Easy</difficulty>
<cruelty>Merficul</cruelty>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>
-------
now, let's add in the 'room' Room Object:
<object name="room">
// Attributes and~or other Objects
</object>
again the ' name="xxx" ' is the 'object' creation tag's own Attribute
and remember, the 'Object' Element holds~contains Attributes and~or other Objects
the 'inherit' Inherited Attributes add that Object Type (and all of its Attributes) to the Object, but let's not get into Object Types (quest's Classes~Groups), for now.
let's add an 'orc_1' (non-room and non-player) Object to our 'room' Room Object:
<object name="room">
<inherit name="editor_room" />
<object name="orc_1">
<inherit name="editor_object" />
</object>
</object>
and let's add an 'alias' String Attribute to the 'orc' Object:
<object name="room">
<inherit name="editor_room" />
<object name="orc_1">
<inherit name="editor_object" />
<alias>orc</alias>
</object>
</object>
and let's add a 'dead' Boolean Attribute to the 'orc' Object:
<object name="room">
<inherit name="editor_room" />
<object name="orc_1">
<inherit name="editor_object" />
<alias>orc</alias>
<attr name="dead" type="boolean">false</attr>
</object>
</object>
// a shortened form for *all* Attributes is this:
// <attribute_name type="attribute_type">Value_or_Expression</attribute_name>
//
// for example using the 'dead' Boolean Attribute:
// <dead type="boolean">false</dead>
//
// ----------------
//
// and another shortened form *ONLY for 'true' Valued* Boolean (and Inherit too) Attributes (using the 'dead' Boolean as an example):
// <dead />
// is the same as: <dead type="boolean">true</dead>
and let's add a 'description' Script Attribute to our 'room' Room Object:
<object name="room">
<inherit name="editor_room" />
<alias>orc</alias>
<object name="orc_1">
<inherit name="editor_object" />
<attr name="dead" type="boolean">false</attr>
<alias>orc</alias>
</object>
<attr name="description" type="script">
if (orc_1.dead = true) {
msg ("There's a rotting dead orc corpse in the room with you.")
} else if (orc_1.dead = false) {
msg ("There's an orc in the room with you... you better kill it... or it will likely kill you!")
}
</attr>
</object>
so, what we got in full now:
(I am, and have been a bit previously, intentionally switching things around vertically, so you can see that it doesn't matter, long as you do it right)
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="xxx">
<gameid>xxx</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
<author>HK</author>
<description>this is just a game file for testing stuff</description>
<subtitle>HK's testing stuff game file</attr>
<category>Simulation</category>
<difficulty>Easy</difficulty>
<cruelty>Merficul</cruelty>
</game>
<object name="room">
<inherit name="editor_room" />
<attr name="description" type="script">
if (orc_1.dead = true) {
msg ("There's a rotting dead orc corpse in the room with you.")
} else if (orc_1.dead = false) {
msg ("There's an orc in the room with you... you better kill it... or it will likely kill you!")
}
</attr>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="orc_1">
<inherit name="editor_object" />
<alias>orc</alias>
<attr name="dead" type="boolean">false</attr>
</object>
</object>
</asl>
---------------------
and... I think you can now add in the default 'player' Player Object (a Player Object is REQUIRED) from here... and hopefully anything~everything else now too... maybe... hehe
---------------------
lastly, let's briefly show you the 'Function' Element, by having you put one in:
the 'Function' Element: holds~contains Scripting
// the GUI~Editor's 'Verb' Element: holds~contains Scripting through (and only for~with) a specific Object
// a Function is somewhat similar to your use of the GUI~Editor's 'whatever' Object's 'whatever' Verb, but let's ignore more explanation of Functions, other than what I hope you will gleam from testing~seeing~studying~playing with below:
(look at the entire code below, to see everything that you need to add in)
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="xxx">
<gameid>xxx</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
<author>HK</author>
<description>this is just a game file for testing stuff</description>
<subtitle>HK's testing stuff game file</attr>
<category>Simulation</category>
<difficulty>Easy</difficulty>
<cruelty>Merficul</cruelty>
</game>
<object name="room">
<inherit name="editor_room" />
<attr name="description" type="script">
function_1
if (orc_1.dead = true) {
msg ("There's a rotting dead orc corpse in the room with you.")
} else if (orc_1.dead = false) {
function_1
msg ("There's an orc in the room with you... you better kill it... or it will likely kill you!")
function_1
}
function_1
</attr>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="orc_1">
<inherit name="editor_object" />
<alias>orc</alias>
<attr name="dead" type="boolean">false</attr>
</object>
</object>
<function name="function_1">
msg ("blah blah blah")
</function>
</asl>
----------------------
computers and hackers can read this (horizontal code structure), but we code noobs can't (we like our vertical code structure), lol:
<asl version="550"><include ref="English.aslx" /><include ref="Core.aslx" /><game name="xxx"><gameid>xxx</gameid><version>1.0</version><firstpublished>2015</firstpublished><author>HK</author><description>this is just a game file for testing stuff</description><subtitle>HK's testing stuff game file</attr><category>Simulation</category><difficulty>Easy</difficulty><cruelty>Merficul</cruelty></game><object name="room"><inherit name="editor_room" /><attr name="description" type="script">function_1 if (orc_1.dead = true) { msg ("There's a rotting dead orc corpse in the room with you.") } else if (orc_1.dead = false) { function_1 msg ("There's an orc in the room with you... you better kill it... or it will likely kill you!") function_1 } function_1</attr><object name="player"><inherit name="editor_object" /><inherit name="editor_player" /></object></object><object name="orc_1"><inherit name="editor_object" /><alias>orc</alias><attr name="dead" type="boolean">false</attr></object><function name="function_1">msg ("blah blah blah")</function></asl>