if (this.parent = game.pov) {
if (not game.pov.equipped = null and not this.alias=game.pov.equipped) {
msg ("You put away your " + game.pov.equipped.alias + " and draw your " + this.alias + ".")
game.pov.equipped.inventoryverbs = Split ("Look at;Drop;Equip(LHand)", ";")
}
else {
msg ("You draw your " + this.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip(LHand)", ";")
game.pov.equippedstatusl = "Wielding(LHand): " + this.alias
}
else if (this.alias=game.pov.equipped) {
msg ("Already equipped")
}
else {
msg ("You don't have it.")
}
What you want is two "equipped" attributes, one for the left hand and one for the right hand (e.g. equippedl and equippedr, following the pattern you've set up). Then to see if an item is equipped in the left hand, check if "this = game.pov.equippedl" and similarly for the right (equippedr).
<library>
<!-- New Game Code -->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>bbc85c01-6e80-4a71-8abf-c1e870fb5b42</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>
<!-- Game Code -->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>bbc85c01-6e80-4a71-8abf-c1e870fb5b42</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="character_object_type" />
<strength type="int">100</strength>
<endurance type="int">100</endurance>
<dexterity type="int">100</dexterity>
<agility type="int">100</agility>
<speed type="int">100</speed>
<intelligence type="int">100</intelligence>
<spirituality type="int">100</spirituality>
<mentality type="int">100</mentality>
<piety type="int">100</piety>
<luck type="int">100</luck>
<current_hit_points type="int">999</current_hit_points>
<maximum_hit_points type="int">999</maximum_hit_points>
<current_mana_points type="int">99</current_mana_points>
<maximum_mana_points type="int">99</maximum_mana_points>
</object>
<object name="orc_1">
<inherit name="editor_object" />
<inherit name="character_object_type" />
<alias>orc</alias>
<strength type="int">25</strength>
<endurance type="int">25</endurance>
<dexterity type="int">25</dexterity>
<agility type="int">25</agility>
<speed type="int">25</speed>
<intelligence type="int">25</intelligence>
<spirituality type="int">25</spirituality>
<mentality type="int">25</mentality>
<piety type="int">25</piety>
<luck type="int">25</luck>
<current_hit_points type="int">500</current_hit_points>
<maximum_hit_points type="int">500</maximum_hit_points>
<current_mana_points type="int">50</current_mana_points>
<maximum_mana_points type="int">50</maximum_mana_points>
<experience_points type="int">100</experience_points>
<cash type="int">100</cash>
</object>
</object>
</asl>
<!-- Object Types -->
<type name="character_object_type">
<strength type="int">0</strength>
<endurance type="int">0</endurance>
<dexterity type="int">0</dexterity>
<agility type="int">0</agility>
<speed type="int">0</speed>
<intelligence type="int">0</intelligence>
<spirituality type="int">0</spirituality>
<mentality type="int">0</mentality>
<piety type="int">0</piety>
<luck type="int">0</luck>
<dead type="boolean">false</dead>
<undead type="boolean">false</undead>
<defending type="boolean">false</defending>
<casting type="boolean">false</casting>
<experience_points type="int">0</experience_points>
<cash type="int">0</cash>
<level type="int">0</level>
<hit_points type="string">0/0</hit_points>
<mana_points type="string">0/0</mana_points>
<current_hit_points type="int">0</current_hit_points>
<maximum_hit_points type="int">0</maximum_hit_points>
<current_mana_points type="int">0</current_mana_points>
<maximum_mana_points type="int">0</maximum_mana_points>
</type>
<!-- Turnscripts -->
<turnscript name="global_events_turnscript">
status_attributes_function
leveling_function
game.turns = game.turns + 1
</turnscript>
<!-- Commands -->
<command name="fight_command">
<pattern>fight #text#</pattern>
<script>
fight_function (game.pov,text)
</script>
</command>
<!-- Functions -->
<function name="fight_function" parameters="self,text">
enemy=GetObject(text)
if (enemy=null) {
foreach (object_x,AllObjects()) {
if (object_x.alias=text) {
enemy=object_x
}
}
}
on ready {
if (enemy=null) {
msg ("There seemingly is no " + text + " here.")
} else if (not check_reachable_function (enemy) = true) {
msg ("There seemingly is no " + enemy.alias + " here.")
} else if (not DoesInherit (enemy,"character_object_type")) {
msg (enemy.alias + "is seemingly not something that you can battle.")
} else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is seemingly not something that you can battle.")
} else if (GetBoolean (enemy,"dead") = true) {
msg (enemy.alias + " is already dead.")
} else {
battle_sequence_function (self,enemy)
}
}
</function>
<function name="battle_sequence_function" parameters="self,enemy"><![CDATA[
if (enemy.dead=false or self.escaped=false) {
you_go_first=false
if (GetInt (self,"speed") > GetInt (enemy,"speed") {
you_go_first=true
} else if (GetInt (self,"speed") = GetInt (enemy,"speed") and RandomChance (50)=true) {
you_go_first=true
}
if (you_go_first=true) {
msg ("You get to go first for this round")
self_battle_turn_function (self,enemy)
on ready {
if (not enemy.dead=true or not self.escaped=true){
enemy_battle_turn_function (self,enemy)
}
}
} else {
msg (enemy.alias + " gets to go first for this round.")
enemy_battle_turn_function (self,enemy)
on ready {
if (not enemy.dead=true or not self.escaped=true){
msg ("It is now your turn.")
self_battle_turn_function (self,enemy)
}
}
}
on ready {
msg ("The round has ended.")
battle_sequence_function (self,enemy)
}
} else {
msg ("The battle is over.")
}
]]></function>
<function name="self_battle_turn_function" parameters="self,enemy"><![CDATA[
msg (self.alias + " has " + self.current_hit_points + " HP left.")
msg (enemy.alias + " has " + enemy.current_hit_points + " HP left.")
wait {
show menu ("What is your battle choice?", split ("Attack;Defend;Cast;Item;Run", ";"), false) {
switch (result) {
case ("Attack") {
self_attack_failed = false
if (RandomChance (GetInt (enemy,"agility") - GetInt (self,"speed")) = true) {
msg (enemy.alias + "evaded your attack!")
self_attack_failed = true
self.defending = false
} else if (RandomChance (GetInt (enemy,"dexterity") - GetInt (self,"agility")) = true) {
msg (enemy.alias + "parried your attack!")
self_attack_failed = true
self.defending = false
} else if (RandomChance (GetInt (enemy,"agility") - GetInt (self,"dexterity")) = true) {
msg (enemy.alias + "blocked your attack!")
self_attack_failed = true
self.defending = false
} else if (RandomChance (GetInt (self,"dexterity") - GetInt (enemy,"speed")) = false) {
msg ("Your attack missed " + enemy.alias +"!")
self_attack_failed = true
self.defending = false
} else if (RandomChance (GetInt (enemy,"armor_class") - GetInt (self,"attack_rating")) = true) {
msg ("Your attack failed to penetrate " + enemy.alias +"!")
self_attack_failed = true
self.defending = false
}
on ready {
if (self_attack_failed = false) {
if (self.defending = true and enemy.defending = true) {
enemy.current_hit_points = enemy.current_hit_points - (critical_hit_function (self) * 2 * GetInt (self,"physical_damage") / 2 + GetInt (self,"physical_damage") * (GetInt (self,"strength") - GetInt (enemy,"endurance")) / 100)
msg (enemy.alias + " has " + enemy.current_hit_points + " HP left.")
self.defending = false
} else if (self.defending = true and enemy.defending = false) {
enemy.current_hit_points = enemy.current_hit_points - (critical_hit_function (self) * 2 * GetInt (self,"physical_damage") + GetInt (self,"physical_damage") * (GetInt (self,"strength") - GetInt (enemy,"endurance")) / 100)
msg (enemy.alias + " has " + enemy.current_hit_points + " HP left.")
self.defending = false
} else if (self.defending = false and enemy.defending = true) {
enemy.current_hit_points = enemy.current_hit_points - (critical_hit_function (self) * GetInt (self,"physical_damage") / 2 + GetInt (self,"physical_damage") * (GetInt (self,"strength") - GetInt (enemy,"endurance")) / 100)
msg (enemy.alias + " has " + enemy.current_hit_points + " HP left.")
} else if (self.defending = false and enemy.defending = false) {
enemy.current_hit_points = enemy.current_hit_points - (critical_hit_function (self) * GetInt (self,"physical_damage") + GetInt (self,"physical_damage") * (GetInt (self,"strength") - GetInt (enemy,"endurance")) / 100)
msg (enemy.alias + " has " + enemy.current_hit_points + " HP left.")
}
}
}
}
case ("Defend") {
if (self.defending = true) {
msg ("You continue to defend yourself against " + enemy.alias)
} else if (self.defending = false) {
msg ("You defend yourself against " + enemy.alias)
self.defending = true
}
}
case ("Cast") {
self.defending = false
}
case ("Item") {
self.defending = false
}
case ("Run") {
self.defending = false
self.escaping = true
}
}
on ready {
if (GetInt (enemy,"current_hit_points") > 0) {
if (RandomChance (GetInt (self,"speed") - GetInt (enemy,"speed"))= true) {
msg ("You get an extra battle turn!")
self_battle_turn (self,enemy)
} else {
msg ("Your battle turn is over.")
}
} else if (GetInt (enemy,"current_hit_points") <= 0) {
msg (enemy.alias + " is dead.")
msg ("You have won the battle!")
self.defending = false
self.escaping = false
enemy.defending = false
enemy.dead = true
}
}
}
}
]]></function>
<function name="enemy_battle_turn_function" parameters="self,enemy"><![CDATA[
msg (self.alias + " has " + self.current_hit_points + " HP left.")
msg (enemy.alias + " has " + enemy.current_hit_points + " HP left.")
result = GetRandomInt (1,3)
switch (result) {
case (1) {
enemy_attack_failed = false
if (RandomChance (GetInt (self,"agility") - GetInt (enemy,"speed")) = true) {
msg ("You have evaded the attack!")
enemy_attack_failed = true
enemy.defending = false
} else if (RandomChance (GetInt (self,"dexterity") - GetInt (enemy,"agility")) = true) {
msg ("You have parried the attack!")
enemy_attack_failed = true
enemy.defending = false
} else if (RandomChance (GetInt (self,"agility") - GetInt (enemy,"dexterity")) = true) {
msg ("You have blocked the attack!")
enemy_attack_failed = true
enemy.defending = false
} else if (RandomChance (GetInt (enemy,"dexterity") - GetInt (self,"speed")) = false) {
msg (enemy.alias +"'s attack missed!")
enemy_attack_failed = true
enemy.defending = false
} else if (RandomChance (GetInt (self,"armor_class") - GetInt (enemy,"attack_rating")) = true) {
msg ("You weren't penetrated by the attack!")
enemy_attack_failed = true
enemy.defending = false
}
on ready {
if (enemy_attack_failed = false) {
if (enemy.defending = true and self.defending = true) {
self.current_hit_points = self.current_hit_points - (critical_hit_function (enemy) * 2 * GetInt (enemy,"physical_damage") / 2 + GetInt (enemy,"physical_damage") * (GetInt (enemy,"strength") - GetInt (self,"endurance")) / 100)
msg (self.alias + " has " + self.current_hit_points + " HP left.")
enemy.defending = false
} else if (enemy.defending = true and self.defending = false) {
self.current_hit_points = self.current_hit_points - (critical_hit_function (enemy) * 2 * GetInt (enemy,"physical_damage") + GetInt (enemy,"physical_damage") * (GetInt (enemy,"strength") - GetInt (self,"endurance")) / 100)
msg (self.alias + " has " + self.current_hit_points + " HP left.")
enemy.defending = false
} else if (enemy.defending = false and self.defending = true) {
self.current_hit_points = self.current_hit_points - (critical_hit_function (enemy) * GetInt (enemy,"physical_damage") / 2 + GetInt (enemy,"physical_damage") * (GetInt (enemy,"strength") - GetInt (self,"endurance")) / 100)
msg (self.alias + " has " + self.current_hit_points + " HP left.")
} else if (enemy.defending = false and self.defending = false) {
self.current_hit_points = self.current_hit_points - (critical_hit_function (enemy) * GetInt (enemy,"physical_damage") + GetInt (enemy,"physical_damage") * (GetInt (enemy,"strength") - GetInt (self,"endurance")) / 100)
msg (self.alias + " has " + self.current_hit_points + " HP left.")
}
}
}
}
case (2) {
if (enemy.defending = true) {
msg (enemy.alias + " is still defending itself.")
} else if (enemy.defending = false) {
msg (enemy.alias + " has choosen to defend itself.")
enemy.defending = true
}
}
case (3) {
enemy.defending = false
msg ("Cast")
}
}
on ready {
if (GetInt (self,"current_hit_points") > 0) {
if (RandomChance (GetInt (enemy,"speed") - GetInt (self,"speed")) = true) {
msg (enemy.alias + " gets an extra battle turn!")
on ready {
wait {
enemy_battle_turn (self,enemy)
}
}
} else {
msg (enemy.alias + " 's battle turn is over.")
}
} else if (GetInt (self,"current_hit_points") <= 0) {
msg (self.alias + " has died.")
msg ("GAME OVER")
finish
}
}
]]></function>
<function name="check_reachable_function" parameters="enemy" type="boolean">
foreach (object_x,ScopeReachableNotHeld ()) {
if (object_x=enemy) {
value = true
} else {
value = false
}
}
return (value)
</function>
<function name="critical_hit_function" parameters="object_x" type="int">
if (RandomChance (GetInt (object_x,"luck")) = true) {
value = 2
} else {
value = 1
}
return (value)
</function>
<function name="leveling_function"><![CDATA[
if (game.pov.experience_points >= game.pov.level * 100 + 100) {
game.pov.experience_points = game.pov.experience_points - (game.pov.level * 100 + 100)
game.pov.level = game.pov.level + 1
leveling_function
}
]]></function>
<function name="status_attributes_function">
game.pov.hit_points = game.pov.current_hit_points + "/" + game.pov.maximum_hit_points
game.pov.mana_points = game.pov.current_mana_points + "/" + game.pov.maximum_mana_points
</function>
</library>
game.pov.equippedl = sword
game.pov.equippedl = null
if (HasAttribute(game.pov, "equippedl"))
if (o = GetAttribute(game.pov, "equippedl"))
if (this.parent = game.pov) {
if (game.pov.equippedl = this) {
msg ("You already have this weapon equipped")
} else if (game.pov.equippedr = this) {
msg ("You already have this weapon equipped in your left hand")
} else if (game.pov.equippedl = null) {
msg ("You draw your " + this.alias + ".")
this.inventoryverbs = Split ("Look at;Drop;Unequip'(LHand)'", ";")
game.pov.equippedstatusl = "Wielding'(LHand)': " + this.alias
game.pov.equippedl.inventoryverbs = Split ("Look at;Drop;Equip'(LHand)'", ";")
} else {
msg ("You put away your " + game.pov.equippedl.alias + " and draw your " + this.alias + ".")
game.pov.equippedl = this
this.inventoryverbs = Split ("Look at;Drop;Unequip'(LHand)'", ";")
game.pov.equippedstatusl = "Wielding'(LHand)': " + this.alias
game.pov.equippedl.inventoryverbs = Split ("Look at;Drop;Equip'(LHand)'", ";")
}
} else {
msg ("You don't have it.")
}
if (this.parent = game.pov) {
if (this = GetAttribute(game.pov, "equippedl")) {
msg ("You already have this weapon equipped in your left hand.")
}
else if (this = GetAttribute(game.pov, "equippedr")) {
msg ("You already have this weapon equipped in your right hand")
}
else if (null = GetAttribute(game.pov, "equippedl")) {
msg ("You draw your " + this.alias + ".")
game.pov.equippedl = this
this.inventoryverbs = Split ("Look at;Drop;Unequipl", ";")
game.pov.equippedstatusl = "Wielding'(LHand)': " + this.alias
}
else {
msg ("You put away your " + game.pov.equippedl + " and draw your " + this.alias + ".")
game.pov.equippedl.inventoryverbs = Split ("Look at;Drop;Equipl;Equipr", ";")
game.pov.equippedl = this
this.inventoryverbs = Split ("Look at;Drop;Unequipl", ";")
game.pov.equippedstatusl = "Wielding'(LHand)': " + this.alias
}
}
else {
msg ("You don't have it.")
}
if (this.parent = game.pov) {
if (this = GetAttribute(game.pov, "equippedl")) {
msg ("You already have this weapon equipped in your left hand.")
}
else if (this = GetAttribute(game.pov, "equippedr")) {
msg ("You already have this weapon equipped in your right hand")
}
else {
if (null = GetAttribute(game.pov, "equippedl")) {
msg ("You draw your " + this.alias + ".")
} else {
msg ("You put away your " + game.pov.equippedl + " and draw your " + this.alias + ".")
}
game.pov.equippedl = this
this.inventoryverbs = Split ("Look at;Drop;Unequipl", ";")
game.pov.equippedstatusl = "Wielding'(LHand)': " + this.alias
}
}
else {
msg ("You don't have it.")
}
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>cd102f9d-370a-4bda-b6ea-ca42288f619c</gameid>
<version>1.0</version>
<start type="script">
msg ("What is your name?")
get input {
msg ("- " + result)
player.alias = result
show menu ("What is your gender?", split ("male;female" , ";"), false) {
player.gender_x = result
show menu ("What is your race?", split ("human;elf;dwarf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
msg (player.alias + " is a " + " " + player.gender_x + " " + player.race + " " + player.class + ".")
}
}
}
}
</start>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">turns = </statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_player" />
<inherit name="editor_object" />
<gender_x type="string"></gender_x>
<strength type="int">0</strength>
<intelligence type="int">0</intelligence>
<agility type="int">0</agility>
<statusattributes type="simplestringdictionary">alias = Name: !;gender_x = Gender: !;strength = ;intelligence = ;agility = ;level = ;experience = ;cash = </statusattributes>
<level type="int">0</level>
<experience type="int">0</experience>
<cash type="int">0</cash>
</object>
<object name="potion100">
<inherit name="editor_object" />
<alias>potexp100</alias>
<take />
<displayverbs type="simplestringlist">Look at; Take; Drink</displayverbs>
<inventoryverbs type="simplestringlist">Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
player.experience = player.experience + 100
</drink>
</object>
<object name="potion300">
<inherit name="editor_object" />
<alias>potexp300</alias>
<take />
<displayverbs type="simplestringlist">Look at; Take; Drink</displayverbs>
<inventoryverbs type="simplestringlist">Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
player.experience = player.experience + 300
</drink>
</object>
</object>
<turnscript name="global_events_turnscript">
<enabled />
<script>
leveling_function
game.turns = game.turns + 1
</script>
</turnscript>
<function name="leveling_function"><![CDATA[
if (player.experience >= player.level * 100 + 100) {
player.experience = player.experience - (player.level * 100 + 100)
player.level = player.level + 1
switch (player.gender_x) {
case ("male") {
player.strength = player.strength + 1
}
case ("female") {
player.agility = player.agility + 1
}
}
switch (player.race) {
case ("dwarf") {
player.strength = player.strength + 2
}
case ("elf") {
player.agility = player.intelligence + 2
}
case ("human") {
player.strength = player.strength + 1
player.agility = player.agility + 1
}
}
switch (player.class) {
case ("warrior") {
player.strength = player.strength + 2
}
case ("cleric") {
player.intelligence = player.intelligence + 1
player.agility = player.agility + 1
}
case ("mage") {
player.intelligence = player.intelligence + 2
}
case ("thief") {
player.strength = player.strength + 1
player.agility = player.agility + 1
}
}
leveling_function
}
]]></function>
</asl>
if (this.parent = game.pov) {
if (this.location="dhand") {
msg ("Please use the command 'equip' for two handed weapons.")
}
else if (HasAttribute(game.pov, "equippedt")) {
msg ("You put away your " + game.pov.equippedt.alias + " and draw your " + this.alias + ".")
game.pov.equippedt.inventoryverbs = Split ("Look at;Drop;Equip", ";")
game.pov.equippedl = this
game.pov.equippedt = null
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatusl = "Wielding'(LHand)': " + this.alias
game.pov.equippedstatusr = "Wielding'(RHand)': nothing"
}
else if (this = GetAttribute(game.pov, "equippedl")) {
msg ("You already have this weapon equipped in your left hand.")
}
else if (this = GetAttribute(game.pov, "equippedr")) {
msg ("You already have this weapon equipped in your right hand")
}
else if (null = GetAttribute(game.pov, "equippedl")) {
msg ("You draw your " + this.alias + ".")
game.pov.equippedl = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatusl = "Wielding'(LHand)': " + this.alias
}
else {
msg ("You put away your " + game.pov.equippedl.alias + " and draw your " + this.alias + ".")
game.pov.equippedl.inventoryverbs = Split ("Look at;Drop;Equipl;Equipr", ";")
game.pov.equippedl = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatusl = "Wielding'(LHand)': " + this.alias
}
}
else {
msg ("You don't have it.")
}
if (this.parent = game.pov) {
if (this.location="dhand") {
msg ("Please use the command 'equip' for two handed weapons.")
}
else if (HasAttribute(game.pov, "equippedt")) {
msg ("You put away your " + game.pov.equippedt.alias + " and draw your " + this.alias + ".")
game.pov.equippedt.inventoryverbs = Split ("Look at;Drop;Equip", ";")
game.pov.equippedr = this
game.pov.equippedt = null
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatusr = "Wielding'(LHand)': " + this.alias
game.pov.equippedstatusl = "Wielding'(RHand)': nothing"
}
else if (this = GetAttribute(game.pov, "equippedl")) {
msg ("You already have this weapon equipped in your left hand.")
}
else if (this = GetAttribute(game.pov, "equippedr")) {
msg ("You already have this weapon equipped in your right hand")
}
else if (null = GetAttribute(game.pov, "equippedr")) {
msg ("You draw your " + this.alias + ".")
game.pov.equippedr = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatusr = "Wielding'(RHand)': " + this.alias
}
else {
msg ("You put away your " + game.pov.equippedr.alias + " and draw your " + this.alias + ".")
game.pov.equippedr.inventoryverbs = Split ("Look at;Drop;Equipl;Equipr", ";")
game.pov.equippedr = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatusr = "Wielding'(RHand)': " + this.alias
}
}
else {
msg ("You don't have it.")
}
if (this.parent = game.pov) {
if (this.location="single" and this = GetAttribute(game.pov, "equippedl")) {
msg ("You put away your " + game.pov.equippedl.alias + ".")
game.pov.equippedl = null
this.inventoryverbs = Split ("Look at;Drop;Equipl;Equipr", ";")
game.pov.equippedstatusl = "Wielding(LHand): nothing"
}
else if (this.location="single" and this = GetAttribute(game.pov, "equippedr")) {
msg ("You put away your " + game.pov.equippedr.alias + ".")
game.pov.equippedr = null
this.inventoryverbs = Split ("Look at;Drop;Equipl;Equipr", ";")
game.pov.equippedstatusr = "Wielding(RHand): nothing"
}
else if (this.location="dhand") {
msg ("You put away your " + game.pov.equippedt.alias + ".")
game.pov.equippedr = null
game.pov.equippedl = null
game.pov.equippedt = null
this.inventoryverbs = Split ("Look at;Drop;Equip", ";")
game.pov.equippedstatusl = "Wielding(LHand): nothing"
game.pov.equippedstatusr = "Wielding(RHand): nothing"
}
}
else {
msg ("You don't have it.")
}
if (this.parent = game.pov) {
if (this.location="single") {
msg ("Use the command 'equipl' or 'equipr' for single handed weapons or shields.")
}
else if (this = GetAttribute(game.pov, "equippedt") and this.location="dhand") {
msg ("You already have this weapon equipped.")
}
else if (HasAttribute(game.pov, "equippedr") and HasAttribute(game.pov, "equippedl")) {
msg ("You put away your " + game.pov.equippedr.alias + " and " + game.pov.equippedl.alias + " and draw your " + this.alias + ".")
game.pov.equippedl.inventoryverbs = Split ("Look at;Drop;Equipl;Equipr", ";")
game.pov.equippedr.inventoryverbs = Split ("Look at;Drop;Equipl;Equipr", ";")
game.pov.equippedt = this
game.pov.equippedr = null
game.pov.equippedl = null
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatusl = "Wielding(LHand): " + this.alias
game.pov.equippedstatusr = "Wielding(RHand): " + this.alias
}
else if (null = GetAttribute(game.pov, "equippedl") and null = GetAttribute(game.pov, "equippedr")) {
msg ("You draw your " + this.alias + ".")
game.pov.equippedt = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatusl = "Wielding(LHand): " + this.alias
game.pov.equippedstatusr = "Wielding(RHand): " + this.alias
}
else if (HasAttribute(game.pov, "equippedl")) {
msg ("You put away your " + game.pov.equippedl.alias + " and draw your " + this.alias + ".")
game.pov.equippedl.inventoryverbs = Split ("Look at;Drop;Equipl;Equipr", ";")
game.pov.equippedt = this
game.pov.equippedl = null
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatusl = "Wielding(LHand): " + this.alias
game.pov.equippedstatusr = "Wielding(RHand): " + this.alias
}
else if (HasAttribute(game.pov, "equippedr")) {
msg ("You put away your " + game.pov.equippedr.alias + " and draw your " + this.alias + ".")
game.pov.equippedr.inventoryverbs = Split ("Look at;Drop;Equipl;Equipr", ";")
game.pov.equippedt = this
game.pov.equippedr = null
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatusl = "Wielding(LHand): " + this.alias
game.pov.equippedstatusr = "Wielding(RHand): " + this.alias
}
}
else {
msg ("You don't have it.")
}
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>eef801a1-4e6b-4b0a-bdbf-8f3ecfa8389c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">turns=</statusattributes>
</game>
<object name="homeland">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="grassland">
<inherit name="editor_room" />
</object>
<object name="plains">
<inherit name="editor_room" />
</object>
<object name="desert">
<inherit name="editor_room" />
</object>
<object name="tundra">
<inherit name="editor_room" />
</object>
<object name="swampland">
<inherit name="editor_room" />
</object>
<object name="mountains">
<inherit name="editor_room" />
</object>
<object name="forest">
<inherit name="editor_room" />
</object>
<object name="wasteland">
<inherit name="editor_room" />
</object>
<object name="coastland">
<inherit name="editor_room" />
</object>
<object name="hills">
<inherit name="editor_room" />
</object>
<command name="help_command">
<pattern>help</pattern>
<script>
help_function
</script>
</command>
<command name="explore_command">
<pattern>explore</pattern>
<script>
explore_function
</script>
</command>
<command name="travel_command">
<pattern>travel</pattern>
<script>
travel_function
</script>
</command>
<object name="data_object">
<inherit name="editor_object" />
<travel_string_list type="simplestringlist">homeland</travel_string_list>
<homeland_events_string_list type="simplestringlist">grassland_discovery;plains_discovery;desert_discovery;tundra_discovery;swampland_discovery;forest_discovery;mountains_discovery;hills_discovery;wasteland_discovery;coastland_discovery</homeland_events_string_list>
<homeland_events_script_dictionary type="scriptdictionary">
<item key="grassland_discovery">
list add (data_object.travel_string_list, "grassland")
msg ("You've discovered the grassland! Now, you can travel to the grassland and explore it!")
</item>
<item key="plains_discovery">
list add (data_object.travel_string_list, "plains")
msg ("You've discovered the plains! Now, you can travel to the plains and explore it!")
</item>
<item key="desert_discovery">
list add (data_object.travel_string_list, "desert")
msg ("You've discovered the desert! Now, you can travel to the desert and explore it!")
</item>
<item key="tundra_discovery">
list add (data_object.travel_string_list, "tundra")
msg ("You've discovered the tundra! Now, you can travel to the tundra and explore it!")
</item>
<item key="swampland_discovery">
list add (data_object.travel_string_list, "swampland")
msg ("You've discovered the swampland! Now, you can travel to the swampland and explore it!")
</item>
<item key="forest_discovery">
list add (data_object.travel_string_list, "forest")
msg ("You've discovered the forest! Now, you can travel to the forest and explore it!")
</item>
<item key="mountains_discovery">
list add (data_object.travel_string_list, "mountains")
msg ("You've discovered the mountains! Now, you can travel to the mountains and explore it!")
</item>
<item key="hills_discovery">
list add (data_object.travel_string_list, "hills")
msg ("You've discovered the hills! Now, you can travel to the hills and explore it!")
</item>
<item key="wasteland_discovery">
list add (data_object.travel_string_list, "wasteland")
msg ("You've discovered the wasteland! Now, you can travel to the wasteland and explore it!")
</item>
<item key="coastland_discovery">
list add (data_object.travel_string_list, "coastland")
msg ("You've discovered the coastland! Now, you can travel to the coastland and explore it!")
</item>
</homeland_events_script_dictionary>
</object>
<turnscript name="global_turnscript">
<enabled />
<script>
game.turns = game.turns + 1
</script>
</turnscript>
<function name="help_function">
msg ("Type 'explore' to explore your area.")
msg ("Type 'travel' to travel to different areas.")
</function>
<function name="explore_function"><![CDATA[
switch (game.pov.parent) {
case (homeland) {
result_1 = ListCount (data_object.homeland_events_string_list) - 1
if (result_1 >= 0) {
result_2 = StringListItem (data_object.homeland_events_string_list,GetRandomInt(0,result_1))
invoke (ScriptDictionaryItem (data_object.homeland_events_script_dictionary,result_2))
on ready {
foreach (item_x, split ("grassland_discovery;plains_discovery;desert_discovery;tundra_discovery;swampland_discovery;forest_discovery;mountains_discovery;hills_discovery;wasteland_discovery;coastland_discovery",";")) {
if (result_2 = item_x) {
list remove (data_object.homeland_events_string_list, result_2)
}
}
}
} else {
msg ("There seemingly is nothing left to explore in this area.")
}
}
}
]]></function>
<function name="travel_function">
show menu ("Where do you wish to travel?",data_object.travel_string_list,false) {
if (not game.pov.parent = GetObject (result)) {
game.pov.parent = GetObject (result)
} else {
msg ("You are already at this area.")
ask ("Try again?") {
if (result=true) {
travel_function
} else {
msg ("You realize that you need to discover a new area to travel to first, before you can travel to that place.")
}
}
}
}
</function>
</asl>
if (player.health = player.max_health) {
msg ("You are already at maximum health!")
}
else if (player.health < player.max_health) {
player.health = player.health + object.health
}
else {
player.health = player.max_health
}
<command name="drink_command">
<pattern>drink #text#</pattern>
<script>
drink_function (player, text)
</script>
</command>
<function name="drink_function" parameters="self, text"><![CDATA[
item_x = GetObject (text)
if (item_x = null) {
foreach (object_x, ScopeInventory ()) {
if (object_x.alias = text or object_x.alt = text)
item_x = object_x
}
}
}
if (item_x = null) {
msg ("you don't have that item in your inventory")
} else if (GetString (item_x, "item_type") = hit_points_potion) {
invoke (item_x.drink)
// or:
// if (self.current_hit_points = self.maximum_hit_points) {
// msg ("you already have full hit_points")
// } else {
// self.current_hit_points = self.current_hit_points + item_x.hit_points
// msg ("you drink " + item_x.alias + ", restoring your hit_points by " + item_x.hit_points)
// if (self.current_hit_points > self.maximum_hit_points) {
// self.current_hit_points = self.maximum_hit_points
// }
// }
} // else if...
// blah scripts
} else {
msg ("you can't drink this item")
}
]]></function>
<object name="50_hit_point_potion">
<inherit name="editor_object" />
<take />
<alias>50_hp_pot</alias>
<alt type="simplestringlist">pot;hppot;pothp;50hppot;pot50hp;pothp50;hp;50hp;hp50</alt> // or whatever is it's correct syntax, meh
<hit_points type="int">50</hit_points>
<item_type type="string">hit_points_potion</item_type>
<drink type="script"><![CDATA[
if (player.current_hit_points=player.maximum_hit_points) {
msg ("you already have full hit_points")
} else {
player.current_hit_points = player.current_hit_points + 50_hit_point_potion.hit_points
msg ("you restore your hit_points by 50")
if (player.current_hit_points > player.maximum_hit_points) {
player.current_hit_points = player.maximum_hit_points
}
}
]]></drink>
<displayverbs type="simplestringlist">Take</displayverbs>
<inventoryverbs type="simplestringlist">Drop;Drink</inventoryverbs>
</object>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<current_hit_points type="int">500</current_hit_points>
<maximum_hit_points type="int">999</maximum_hit_points>
<hit_points type="string">0/0</hit_points>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">hit_points =!;turns =</statusattributes>
</object>
<turnscript name="global_events_turnscript">
<enabled />
<script>
player.hit_points = "HP: " + player.current_hit_points + "/" + player.maximum_hit_points
player.turns = player.turns + 1
</script>
</turnscript>