Elements (the 'physical things' in quest coding or the GUI~Editor):
Game (the Game Object: a special Object for your game's settings)
Objects (the Game Object, Player Objects, Room Objects, Other-Object Objects, or for GameBook quest: Pages)
Verbs
Commands
Functions
Turnscripts
Timers
Object Types
Attributes (but must be within another and different Element)
etc etc etc
Attributes (Data ~ Game Mechanics):
in the GUI~Editor:
via the GUI~Editor's tabs:
'whatever' (Object) -> Attributes (Tab) -> Attribute -> Add ->
( Object Name: 'whatever' )
Attribute Name: 'whatever'
Attribute Type: (String, Integer, Double, Boolean, Script, Object, Lists, Dictionaries, etc)
Attribute Value: ( 'whatever', but based upon the Attribute Type)
via the GUI~Editor's scripting:
run as script -> add new~a script -> variables -> set a variable or attribute -> [EXPRESSION] -> (see below: 'in code' )
In Code:
Object_name.Attribute_name = Value_or_Expression
Examples:
(with simple ' =Values ' )
String Attribute: player.sex = "male"
Integer (int) Attribute: player.strength = 100
Double (Float; Floating Point) Attribute: player.damage = 34.109736
Boolean (True~False Flag) Attribute: orc.dead = false
Object Attribute: game.pov = player
String List Attribute: HK.favorite_colors = split ("black;red" ,";")
Example of (usin an integer attribute with) a complex expression ( ' = Expression ' ):
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100 - orc.armor.defense - orc.armor.defense * orc.endurance / 100
-----------
Basic Math Computation Expressions, example using a 'strength' Integer Attribute:
Addition:
player.strength = player.strength + 70
Subtraction:
player.strength = player.strength - 90
Multiplication:
player.strength = player.strength * 3
Division:
player.strength = player.strength / 2
--------------
Scripting (actions~events), in code:
msg ("xxx")
msg ("xxx" + Object_name.Attribute_name + "xxx")
if (Object_name.Attribute_name [operator: +, -, *, /, >, <, <=, >=, =, <>] Value_or_Expression) { (scripts) } else if (Object_name.Attribute_name [operator: +, -, *, /, >, <, <=, >=, =, <>] Value_or_Expression) { (scripts) } else { (scripts) }
get input { (scripts) }
show menu { (scripts) }
Object_name.Attribute_name = Value_or_Expression
set (Object_name, "Attribute_name", Value_or_Expression)
----------
the two super scripts, which especially when used together, lets you do 90% of everything that you want to do in your game:
1. the 'set a variable or attribute' Script
in the GUI~Editor:
run as script -> add new~a script -> variables -> 'set a variable or attribute' Script -> [EXPRESSION] -> Object_name.Attribute_name = Value_or_Expression
2. the 'if' Script
in the GUI~Editor:
run as script -> add new~a script -> scripts -> 'if' Script -> [EXPRESSION] -> Object_name.Attribute_name [operator] Value_or_Expression
--------
example, in code (hopefully it works, laughs):
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="testing game stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<author>HegemonKhan</author>
<attr name="global_turn_integer" type="int">0</attr>
<statusattributes type="simplestringdictionary">global_turn_integer = Game Turn: !</statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attr name="life_string" type="string">999/999</attr>
<attr name="current_life_integer" type="int">999</attr>
<changedcurrent_life_integer type="script"><![CDATA[
if (this.current_life_integer <= 0) {
msg ("GAME OVER")
finish
} else {
this.life_string = this.current_life_integer + "/" + this.maximum_life_integer + "Life"
}
]]></changedcurrent_life_integer>
<attr name="maximum_life_integer" type="int">999</attr>
<attr name="damage_integer" type="int">100</attr>
<statusattributes type="simplestringdictionary">life_string = !; damage_integer = ! Damage</statusattributes>
</object>
<object name="orc">
<inherit name="editor_object" />
<attr name="life_string" type="string">500/500</attr>
<attr name="current_life_integer" type="int">500</attr>
<changedcurrent_life_integer type="script"><![CDATA[
if (this.current_life_integer <= 0) {
this.dead_boolean = true
} else {
this.life_string = this.current_life_integer + "/" + this.maximum_life_integer + "Life"
}
]]></changedcurrent_life_integer>
<attr name="maximum_life_integer" type="int">500</attr>
<attr name="damage_integer" type="int">50</attr>
<attr name="dead_boolean" type="boolean">false</attr>
<fight_script type="script">
fight_function (player, this)
</fight_script>
</object>
</object>
<verb name="fight_verb">
<property>fight_script</property>
<pattern>fight</pattern>
<unresolved>You can't fight that!</unresolved>
</verb>
<function name="fight_function" parameters="self,enemy">
if (enemy.dead_boolean = false) {
msg ("Self: " + self.life_string)
msg ("Enemy: " + enemy.life_string)
msg ("")
enemy.current_life_integer = enemy.current_life_integer - self.damage_integer
msg (self.name + " attacks the " + enemy.name + " for " + self.damage_integer + " damage, leaving it with only " + enemy.current_life_integer + "life remaining.")
if (enemy.dead_boolean = false) {
msg ("Self: " + self.life_string)
msg ("Enemy: " + enemy.life_string)
msg ("")
self.current_life_integer = self.current_life_integer - enemy.damage_integer
msg ("The " + enemy.name + " attacks you for " + enemy.damage_integer + " damage, leaving with only " + self.current_life_integer + "life remaining.")
}
} else if (enemy.dead_boolean = true) {
msg ("The " + enemy.name + " is already dead, silly.")
}
game.global_turn_integer = game.global_turn_integer + 1
</function>
</asl>