if (orc.dead = false) {
// script1
} else if (orc.dead = true) {
// script2
}
<game name="guntraining">
<gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<shoot type="script">
if (Got(weapon.attribute)) {
msg ("The weapon fires in the direction you point. ")
}
else {
msg ("There's nothing to shoot at now.")
}
</shoot>
<object name="F49 Assualt Rifle">
<inherit name="editor_object" />
<alias>assaultrifle</alias>
<look>The rifle is long and somewhat bulky. It fires 500 rounds per minute with reloading clips of 60 per round. </look>
<alt type="stringlist">
<value>Assault Rifle</value>
</alt>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
<value>Reload</value>
</inventoryverbs>
<roundrifle type="int">60</roundrifle>
<take />
<fire type="string"></fire>
<shoot type="script"><![CDATA[
if (Got(F49 Assualt Rifle)) {
if (F49 Assualt Rifle.roundrifle <0) {
F49 Assualt Rifle.roundrifle = 0
msg ("reload.")
}
else {
set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle - GetRandomInt(10,60))
msg ("you fired " +F49 Assualt Rifle.roundrifle+ " rounds")
if (F49 Assualt Rifle.roundrifle <0) {
F49 Assualt Rifle.roundrifle = 0
msg ("reload. ")
}
}
}
]]></shoot>
<reload type="scriptdictionary">
<item key="F49 ammo"><![CDATA[
if (Got(F49 Assualt Rifle)) {
if (Got(F49 ammo)) {
if (F49 Assualt Rifle.roundrifle = 60) {
msg ("You don't need to reload.")
}
else if (F49 Assualt Rifle.roundrifle <60 ) {
set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle + F49 ammo.rifleclip)
if (F49 Assualt Rifle.roundrifle >60) {
F49 Assualt Rifle.roundrifle = 60
}
}
}
else if (not Got(F49 ammo)) {
msg ("You have no ammo to reload with. ")
}
}
else {
msg ("You can't do that now...")
}
]]></item>
</reload>
</object>
</object>
<object name="F49 ammo">
<inherit name="editor_object" />
<rifleclip type="int">60</rifleclip>
<take />
</object>
</object>
<verb>
<property>reload</property>
<pattern>reload #object#</pattern>
<defaultexpression>"You can't reload " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>shoot</property>
<pattern>shoot #object#; fire #object#</pattern>
<defaultexpression>"You can't shoot " + object.article + "."</defaultexpression>
<defaulttext>You can't do that here. </defaulttext>
<knockout type="script">
if (object.health = 0) {
MakeObjectInvisible (object.alias)
}
</knockout>
</verb>
if (F49 Assualt Rifle.roundrifle <0) {
F49 Assualt Rifle.roundrifle = 0
msg ("reload.")
}
<shoot type="script"><![CDATA[
if (Got(F49 Assualt Rifle)) {
if (player.F49 Assualt Rifle.roundrifle <0) {
player.F49 Assualt Rifle.roundrifle = 0
msg ("reload.")
}
// you'll need to fix up the rest of it, matching what's change with this part
<shoot type="script"><![CDATA[
if (Got(F49 Assualt Rifle)) {
if (F49 Assualt Rifle.roundrifle <0) {
F49 Assualt Rifle.roundrifle = 0
msg ("reload.")
}
OR
<shoot type="script"><![CDATA[
if (Got(F49 Assualt Rifle)) {
if (player.F49 Assualt Rifle.roundrifle <0) {
player.F49 Assualt Rifle.roundrifle = 0
msg ("reload.")
}
// you'll need to fix up the rest of it, matching what's change with this part
if (orc.dead = false) {
// script1
} else if (orc.dead = true) {
// script2
}
if (orc.dead = false)
if (orc.dead = true)
if (not orc.dead)
if (orc.dead)
if (orc.dead) {
// script2
} else{
// script1
}
if (1) {
if (2) {
// script
// script
// script
if (3) {
// script
// script
// script
if (4) {
// script
// script
// script
if (5) {
// script
// script
// script
if (6) {
// script
// script
// script
} else (6) {
// script
// script
// script
}
} else (5) {
// script
// script
// script
}
} else (4) {
// script
// script
// script
}
} else (3) {
// script
if (8) {
// script
// script
} else (8) {
// script
// script
if (9) {
if (10) {
}
} else (9) {
}
} else (11) {
// script
// script
} else if (7) {
// script
// script
// script
} else (7) {
// script
// script
// script
}
// script
// script
}
} else (2) {
// script
// script
// script
}
} else (1) {
// script
// script
// script
}
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="testing game stuff">
<gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
<attr name="count_integer" type="int">0</attr>
<start type="script">
test_function
</start>
</game>
<function name="test_function"><![CDATA[
msg ("(1) " + game.count_integer)
game.count_integer = game.count_integer - 1
msg ("(2) " + game.count_integer)
if (game.count_integer < 0) {
game.count_integer = 0
msg ("(3) " + game.count_integer)
} else {
msg ("(4) " + game.count_integer)
}
msg ("(5) " + game.count_integer)
]]></function>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>
HegemonKhan wrote:I'm not sure why the 'returning to zero' doesn't work, as I don't use the 'set' code syntax (i just use the: Object_name.Attribute_name = Value_or_Expression)
does it display your message of 'reload.' ???
as this will tell us that it is (or is not able to do the) running~executing (of) your 'if' Script:if (F49 Assualt Rifle.roundrifle <0) {
F49 Assualt Rifle.roundrifle = 0
msg ("reload.")
}
if you aren't seeing the 'reload.' message displayed, then maybe try to do this:<shoot type="script"><![CDATA[
if (Got(F49 Assualt Rifle)) {
if (player.F49 Assualt Rifle.roundrifle <0) {
player.F49 Assualt Rifle.roundrifle = 0
msg ("reload.")
}
// you'll need to fix up the rest of it, matching what's change with this part
-----------------
I don't know about quest version 550, but in quest version 540, there was a shift over to this syntax structure, which maybe you need for quest version 550 (did you do the entire code by writing it in yourself, or did you use the GUI~Editor's buttons and drop down menus, tabs, add, and etc to create your game ?):
<roundrifle type="int">60</roundrifle>
change it to this:
<attr name="roundrifle" type="int">60</attr>
try this with each of these combinations:<shoot type="script"><![CDATA[
if (Got(F49 Assualt Rifle)) {
if (F49 Assualt Rifle.roundrifle <0) {
F49 Assualt Rifle.roundrifle = 0
msg ("reload.")
}
OR
<shoot type="script"><![CDATA[
if (Got(F49 Assualt Rifle)) {
if (player.F49 Assualt Rifle.roundrifle <0) {
player.F49 Assualt Rifle.roundrifle = 0
msg ("reload.")
}
// you'll need to fix up the rest of it, matching what's change with this part
maybe, this'll get it to work...
-----------
otherwise, maybe it's just having trouble finding your weapon (as it has to string~sentence parse~look for it, via your weapon's name, and your spaces in it and~or your 'alt (alternative aliases)' for it may be causing it to get confused and not find it nor work correctly)
--------
or lastly, a typo somewhere
amount_to_shoot = GetRandomInt(10, 60)
if (amount_to_shoot > F49 Assualt Rifle.rifleround) {
amount_to_shoot = F49 Assualt Rifle.rifleround
}
<shoot type="script">
if (F49 Assualt Rifle.rifleround <0) {
F49 Assault Rifle.rifelround = 0
}
else {
set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle - GetRandomInt(10,60))
msg ("you fired " +F49 Assualt Rifle.roundrifle+ " rounds")
if (F49 Assualt Rifle.roundrifle <0) {
F49 Assualt Rifle.roundrifle = 0
msg ("reload. ")
player is attacking monster:
if (player.defending and monster.defending) {
monster.hp = monster.hp - player.weapon.damage * (player.strength/100) - player.weapon.damage * critical_function (if true, returns int2, if false, returns int1) * 2 (defending's bonus damage) + monster.armor_resistance * (monster.endurance/100) + monster.armor_resistance * 2 (defending's defense bonus)
} else if (player.defending and not monster defending) {
} else if ...
}
....
would I be able to color message that a critical hit was done, like maybe while this is running (I guess this would need to maybe use the 'while' code line, which is probably still too confusing advanced for me, if your stuff doesn't work for it), and I'd like to add in some mor stuff too into this equation, like if an elemental damage was done vs a physical damage, and whatever else I can think of.
also, for other scripts, I'd like to color messages for different magic effects and~or status effects (using FF6 partially for an example: pink for 'haste', white for 'slow', green for poison, etc etc etc)
if (some_check_about_type_of_damage) {
damage_class = "elemental_damage"
} else {
damage_class = "physical_damage"
}
msg("The something strikes you for <span class='" + damage_class + "'>" + damage_count + " damage</span>")
span.elemental_damage { color: red }
span.physical_damage { color: blue }
set (F49 Assualt Rifle, "roundrifle", +assaultround.rifleclip)
<reload type="scriptdictionary">
<item key="assault round"><![CDATA[
if (Got(F49 Assualt Rifle)) {
if (F49 Assualt Rifle.roundrifle=60) {
if (Got(assault round)) {
msg ("Your weapon is fully reloaded. ")
}
}
else {
if (F49 Assualt Rifle.roundrifle<=0) {
if (Got(assault round)) {
set (F49 Assualt Rifle, "roundrifle", assaultround.rifleclip)
msg ("You reloaded your rifle.")
}
}
}
}
else {
msg ("You don't have the weapon to reload.")
}
]]></item>
</reload>
You are in a room.
> shoot assaultrifle
you fired 60 rounds
> shoot assaultrifle
reload
> reload assaultrifle
Error running script: Error compiling expression 'F49 Assault Rifle.roundrifle<=0': Unknown object or variable 'F49 Assault Rifle'
Error running script: Error compiling expression 'F49 Assault Rifle.roundrifle<=0': Unknown object or variable 'F49 Assault Rifle'
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="guntraining">
<gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<shoot type="script">
if (Got(weapon.attribute)) {
msg ("The weapon fires in the direction you point. ")
}
else {
msg ("There's nothing to shoot at now.")
}
</shoot>
<object name="F49 Assualt Rifle">
<inherit name="editor_object" />
<scenery type="boolean">false</scenery>
<look>The rifle is long and somewhat bulky. It fires 500 rounds per minute with reloading clips of 60 per round. </look>
<alt type="stringlist">
<value>Assualt Rifle</value>
</alt>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
<value>Reload</value>
</inventoryverbs>
<roundrifle type="int">60</roundrifle>
<take />
<fire type="string"></fire>
<shoot type="script"><![CDATA[
if (not Got(F49 Assualt Rifle)) {
msg ("You don't have this weapon.")
}
else if (Got(F49 Assualt Rifle)) {
set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle - GetRandomInt(10,60))
if (F49 Assualt Rifle.roundrifle <=0) {
F49 Assualt Rifle.roundrifle = 0
firsttime {
F49 Assualt Rifle.roundrifle = 0
msg ("you fired your weapon. reload")
}
otherwise {
msg ("reload your weapon.")
}
}
else if (F49 Assualt Rifle.roundrifle>0) {
msg ("you fired your weapon.")
}
}
]]></shoot>
<reload type="scriptdictionary">
<item key="F49 ammo"><![CDATA[
if (not Got(F49 Assualt Rifle)) {
msg ("You don't have this weapon to reload...")
}
else if (Got(F49 Assualt Rifle)) {
if (not Got(F49 ammo)) {
msg ("You have no ammo to reload with...")
}
else if (Got(F49 ammo)) {
if (F49 Assualt Rifle.roundrifle =60) {
msg ("Your weapon is already fully reloaded")
}
else if (F49 Assualt Rifle.roundrifle <60) {
set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle + F49 ammo.rifleclip)
if (F49 Assualt Rifle.roundrifle >60) {
F49 Assualt Rifle.roundrifle = 60
msg ("your weapon is reloaded")
}
else {
msg ("Your weapon is reloaded (full).")
}
}
}
}
]]></item>
</reload>
<visible />
<usedefaultprefix />
</object>
</object>
<object name="F49 ammo">
<inherit name="editor_object" />
<rifleclip type="int">60</rifleclip>
<take />
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
</inventoryverbs>
<usedefaultprefix />
</object>
</object>
<verb>
<property>reload</property>
<pattern>reload #object#</pattern>
<defaultexpression>"You can't reload " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>shoot</property>
<pattern>shoot #object#; fire #object#</pattern>
<defaultexpression>"You can't shoot " + object.article + "."</defaultexpression>
<defaulttext>You can't do that here. </defaulttext>
</verb>
</asl>
if (not Got(F49 Assualt Rifle)) {
msg ("You don't have this weapon.")
}
else if (Got(F49 Assualt Rifle)) {
set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle - GetRandomInt(10,60))
if (F49 Assualt Rifle.roundrifle <=0) {
F49 Assualt Rifle.roundrifle = 0
firsttime {
F49 Assualt Rifle.roundrifle = 0
msg ("you fired your weapon. reload")
}
otherwise {
msg ("reload your weapon.")
}
}
else if (F49 Assualt Rifle.roundrifle>0) {
msg ("you fired your weapon.")
}
}
if (not Got(F49 Assualt Rifle)) {
msg ("You don't have this weapon to reload...")
}
else if (Got(F49 Assualt Rifle)) {
if (not Got(F49 ammo)) {
msg ("You have no ammo to reload with...")
}
else if (Got(F49 ammo)) {
if (F49 Assualt Rifle.roundrifle =60) {
msg ("Your weapon is already fully reloaded")
}
else if (F49 Assualt Rifle.roundrifle <60) {
set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle + F49 ammo.rifleclip)
if (F49 Assualt Rifle.roundrifle >60) {
F49 Assualt Rifle.roundrifle = 60
msg ("your weapon is reloaded")
}
else {
msg ("Your weapon is reloaded (full).")
}
}
}
}
<asl version="550">
 <include ref="English.aslx" />
 <include ref="Core.aslx" />
 <game name="guntraining">
  <gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
  <version>1.0</version>
  <firstpublished>2014</firstpublished>
 </game>
 <object name="room">
  <inherit name="editor_room" />
  <object name="player">
   <inherit name="editor_object" />
   <inherit name="editor_player" />
   <object name="F49 Assualt Rifle">
    <inherit name="editor_object" />
    <look>The rifle is long and somewhat bulky. It fires 500 rounds per minute with reloading clips of 60 per round. </look>
    <alt type="stringlist">
     <value>Assualt Rifle</value>
    </alt>
    <inventoryverbs type="stringlist">
     <value>Look at</value>
     <value>Use</value>
     <value>Drop</value>
    </inventoryverbs>
    <roundrifle type="int">60</roundrifle>
    <take />
    <shoot type="script"><![CDATA[
     if (not Got(F49 Assualt Rifle)) {
      msg ("You don't have this weapon.")
     }
     else if (Got(F49 Assualt Rifle)) {
if (F49 Assualt Rifle.roundrifle = 0) {
msg ("You need to reload your gun")
invoke (ScriptDictionaryItem (F49 Assualt Rifle.reload, F49 ammo) // this activates your reloading (your 'reload' scriptdictionary)
} else {
roundrifle_fired = GetRandomInt (0, F49 Assualt Rifle.roundrifle) // by doing the 'F49 Assualt Rifle.roundrifle' for your max value for the 'GetRandomInt', you'll never fire off more bullets than you have (so, no negative roundrifle value)
roundrifle_left = F49 Assualt Rifle.roundrifle - roundrifle_fired // this line could have been skipped by putting the subraction in your 'set' line below, but I moved it out here, as I think it makes it more clear for you (as you don't have to remember that your new roundrifle value is your remaining rounds).
// the two variable (roundrifle_fired and roundrifle_left) code lines above, are also for messaging how many rounds were fired and how many rounds remain
set (F49 Assualt Rifle, "roundrifle", roundrifle_left) // this could ahve had the subtraction (F49 Assualt Rifle.roundrifle - roundrifle_fired) for it's value, but I decided to separate it out for you to see~understand this script block more clearly.
msg ("You fired off " + roundrifle_fired + " rounds, and now have only " + roundrifle_left + " rounds left.")
if (roundrifle_left = 0) {
msg ("reload")
invoke (ScriptDictionaryItem (F49 Assualt Rifle.reload, F49 ammo) // this activates your reloading (your 'reload' scriptdictionary)
}
}
}
    ]]></shoot>
    <reload type="scriptdictionary">
     <item key="F49 ammo"><![CDATA[
      if (not Got(F49 Assualt Rifle)) {
       msg ("You don't have this weapon to reload...")
      }
      else if (Got(F49 Assualt Rifle)) {
       if (not Got(F49 ammo) or F49 ammo.rifleclip = 0) {
        msg ("You have no ammo to reload with...")
       }
       else if (Got(F49 ammo) and F49 ammo.rifleclip > 0) {
       set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle + F49 ammo.rifleclip)
msg ("You are fully loaded again.")
//
// some comments:
//
// if you want your F49 ammo to be a 'storage object' (can be emptied and restocked), let me know.
// if you want to 'reload' non-automatically (via a 'reload' Verb button or typed-in input), let me know.
// I took out other stuff too that wasn't needed, let me know if you want it back.
// if you want to be able to drop your F49 ammo, let me know, as it's a permanent and automatic roundrifle 'storage object', right now as I got it set up (well I forgot how to turn 'drop' to false, as it's been awhile since I won't with the built-in stuff, lol)
// I also took out the shooting of specific targets for now, as we don't have that implementd yet anyways.
// if you want anything else different or changed, let me know.
//
       }
      }
     ]]></item>
    </reload>
   </object>
  </object>
  <object name="F49 ammo">
   <inherit name="editor_object" />
   <rifleclip type="int">60</rifleclip>
   <take />
   <inventoryverbs type="stringlist">
    <value>Look at</value>
   </inventoryverbs>
   <usedefaultprefix />
  </object>
 </object>
 <verb>
  <property>shoot</property>
  <pattern>shoot</pattern>
  <defaultexpression>"You can't shoot " + object.article + "."</defaultexpression>
  <defaulttext>You can't do that here.</defaulttext>
 </verb>
</asl>
HegemonKhan wrote:ya, we were talking about your older code (it had spelling~typo issues in it, but not your newest code that you just provided: you already cleaned up all them)
----------
here you go (hopefully I fixed up your game code), see if you like this, and if it works or not:
(I was tired and it was late last night, but now I'm rested and staying focused this time, laughs. Being all rested up makes a big difference, lol. I could understand your code easily and have hopefully fixed it up, with it working perfectly... maybe, laughs)
(I included comments too, after you read them, you can remove them)
(comments only work within script blocks, and are initiated by the: //, so you can delete these and to the right of them to the end of the comment, but don't delete your actual code lines, obviously)<asl version="550">
 <include ref="English.aslx" />
 <include ref="Core.aslx" />
 <game name="guntraining">
  <gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
  <version>1.0</version>
  <firstpublished>2014</firstpublished>
 </game>
 <object name="room">
  <inherit name="editor_room" />
  <object name="player">
   <inherit name="editor_object" />
   <inherit name="editor_player" />
   <object name="F49 Assualt Rifle">
    <inherit name="editor_object" />
    <look>The rifle is long and somewhat bulky. It fires 500 rounds per minute with reloading clips of 60 per round. </look>
    <alt type="stringlist">
     <value>Assualt Rifle</value>
    </alt>
    <inventoryverbs type="stringlist">
     <value>Look at</value>
     <value>Use</value>
     <value>Drop</value>
    </inventoryverbs>
    <roundrifle type="int">60</roundrifle>
    <take />
    <shoot type="script"><![CDATA[
     if (not Got(F49 Assualt Rifle)) {
      msg ("You don't have this weapon.")
     }
     else if (Got(F49 Assualt Rifle)) {
if (F49 Assualt Rifle.roundrifle = 0) {
msg ("You need to reload your gun")
invoke (ScriptDictionaryItem (F49 Assualt Rifle.reload, F49 ammo) // this activates your reloading (your 'reload' scriptdictionary)
} else {
roundrifle_fired = GetRandomInt (0, F49 Assualt Rifle.roundrifle) // by doing the 'F49 Assualt Rifle.roundrifle' for your max value for the 'GetRandomInt', you'll never fire off more bullets than you have (so, no negative roundrifle value)
roundrifle_left = F49 Assualt Rifle.roundrifle - roundrifle_fired // this line could have been skipped by putting the subraction in your 'set' line below, but I moved it out here, as I think it makes it more clear for you (as you don't have to remember that your new roundrifle value is your remaining rounds).
// the two variable (roundrifle_fired and roundrifle_left) code lines above, are also for messaging how many rounds were fired and how many rounds remain
set (F49 Assualt Rifle, "roundrifle", roundrifle_left) // this could ahve had the subtraction (F49 Assualt Rifle.roundrifle - roundrifle_fired) for it's value, but I decided to separate it out for you to see~understand this script block more clearly.
msg ("You fired off " + roundrifle_fired + " rounds, and now have only " + roundrifle_left + " rounds left.")
if (roundrifle_left = 0) {
msg ("reload")
invoke (ScriptDictionaryItem (F49 Assualt Rifle.reload, F49 ammo) // this activates your reloading (your 'reload' scriptdictionary)
}
}
}
    ]]></shoot>
    <reload type="scriptdictionary">
     <item key="F49 ammo"><![CDATA[
      if (not Got(F49 Assualt Rifle)) {
       msg ("You don't have this weapon to reload...")
      }
      else if (Got(F49 Assualt Rifle)) {
       if (not Got(F49 ammo) or F49 ammo.rifleclip = 0) {
        msg ("You have no ammo to reload with...")
       }
       else if (Got(F49 ammo) and F49 ammo.rifleclip > 0) {
       set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle + F49 ammo.rifleclip)
msg ("You are fully loaded again.")
//
// some comments:
//
// if you want your F49 ammo to be a 'storage object' (can be emptied and restocked), let me know.
// if you want to 'reload' non-automatically (via a 'reload' Verb button or typed-in input), let me know.
// I took out other stuff too that wasn't needed, let me know if you want it back.
// if you want to be able to drop your F49 ammo, let me know, as it's a permanent and automatic roundrifle 'storage object', right now as I got it set up (well I forgot how to turn 'drop' to false, as it's been awhile since I won't with the built-in stuff, lol)
// I also took out the shooting of specific targets for now, as we don't have that implementd yet anyways.
// if you want anything else different or changed, let me know.
//
       }
      }
     ]]></item>
    </reload>
   </object>
  </object>
  <object name="F49 ammo">
   <inherit name="editor_object" />
   <rifleclip type="int">60</rifleclip>
   <take />
   <inventoryverbs type="stringlist">
    <value>Look at</value>
   </inventoryverbs>
   <usedefaultprefix />
  </object>
 </object>
 <verb>
  <property>shoot</property>
  <pattern>shoot</pattern>
  <defaultexpression>"You can't shoot " + object.article + "."</defaultexpression>
  <defaulttext>You can't do that here.</defaulttext>
 </verb>
</asl>
else if (Got(F49 Assualt Rifle)) {
if (not Got(F49 ammo) or F49 ammo.rifleclip = 0) {
msg ("You have no ammo to reload with...")
}
else if (Got(F49 ammo) and F49 ammo.rifleclip > 0) {
set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle + F49 ammo.rifleclip)
msg ("You are fully loaded again.")
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="guntraining">
<gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<object name="F49 Assualt Rifle">
<inherit name="editor_object" />
<look>The rifle is long and somewhat bulky. It fires 500 rounds per minute with reloading clips of 60 per round. </look>
<alt type="stringlist">
<value>Assualt Rifle</value>
</alt>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
</inventoryverbs>
<roundrifle type="int">60</roundrifle>
<take />
<shoot type="script"><![CDATA[
if (not Got(F49 Assualt Rifle)) {
msg ("You don't have this weapon.")
}
else if (Got(F49 Assualt Rifle)) {
if (F49 Assualt Rifle.roundrifle = 0) {
msg ("You need to reload your gun")
invoke (ScriptDictionaryItem (F49 Assualt Rifle.reload, F49 ammo)
} else {
roundrifle_fired = GetRandomInt (0, F49 Assualt Rifle.roundrifle)
roundrifle_left = F49 Assualt Rifle.roundrifle - roundrifle_fired
set (F49 Assualt Rifle, "roundrifle", roundrifle_left)
msg ("You fired off " + roundrifle_fired + " rounds, and now have only " + roundrifle_left + " rounds left.")
if (roundrifle_left = 0) {
msg ("reload")
invoke (ScriptDictionaryItem (F49 Assualt Rifle.reload, F49 ammo) // this activates your reloading (your 'reload' scriptdictionary)
}
}
}
]]></shoot>
<reload type="scriptdictionary">
<item key="F49 ammo"><![CDATA[
if (not Got(F49 Assualt Rifle)) {
msg ("You don't have this weapon to reload...")
}
else if (Got(F49 Assualt Rifle)) {
if (not Got(F49 ammo)) {
msg ("You have no ammo to reload with...")
}
else if (Got(F49 ammo)) {
if (F49 ammo.rifleclip = 0) {
msg ("You have no ammo to reload with...")
} else {
reloading_rounds = F49 Assualt Rifle.roundrifle + F49 ammo.rifleclip
set (F49 Assualt Rifle, "roundrifle", reloading_rounds)
if (F49 Assualt Rifle.roundrifle = 60) {
msg ("You are fully loaded again.")
} else {
msg ("You are partially reloaded again.")
}
}
}
}
]]></item>
</reload>
</object>
</object>
<object name="F49 ammo">
<inherit name="editor_object" />
<rifleclip type="int">60</rifleclip>
<take />
<inventoryverbs type="stringlist">
<value>Look at</value>
</inventoryverbs>
<usedefaultprefix />
</object>
</object>
<verb>
<property>shoot</property>
<pattern>shoot</pattern>
<defaultexpression>"You can't shoot " + object.article + "."</defaultexpression>
<defaulttext>You can't do that here.</defaulttext>
</verb>
</asl>
HP (hit~health:life points)
MP (magic~mana points)
SP (skill~spell points)
LV or LVL (level)
G (gold ~ currency)
STR (strength)
END (endurance)
CON (constitution)
SPI (spirituality)
INT (intelligence)
MEN (mentality)
DEX (desterity)
AGI (agility)
SPE or SPD (speed)
LUK (luck)
SWD (sword)
SPR ~ SPE (spear)
PC (playable character)
NPC (nonplayable character)
ALI (alignment: evil~chaos, neutral, good~order)
CHA (charisma)
PIE (piety)
AR (attack rating)
AC (armor class)
DMG or DAM (damage)
PDEF (physical defense)
MDEF (magical defense)
etc etc etc
<object name="player_1"></object>
<object name="player_2"></object>
<object name="player_3"></object>
<object name="person_1"></object>
<object name="person_2"></object>
<object name="person_3"></object>
<object name="dragon_1"></object>
<object name="dragon_2"></object>
<object name="dragon_3"></object>
<object name="orc_1"></object>
<object name="orc_2"></object>
<object name="orc_3"></object>
<object name="home_1"></object>
<object name="home_2"></object>
<object name="home_3"></object>
<object name="inn_1"></object>
<object name="inn_2"></object>
<object name="inn_3"></object>
<object name="weapon_shop_1"></object>
<object name="weapon_shop_2"></object>
<object name="weapon_shop_3"></object>
<object name="armor_shop_1"></object>
<object name="armor_shop_2"></object>
<object name="armor_shop_3"></object>
<object name="spell_shop_1"></object>
<object name="spell_shop_2"></object>
<object name="spell_shop_3"></object>
<object name="item_shop_1"></object>
<object name="item_shop_2"></object>
<object name="item_shop_3"></object>
<object name="sword_1"></object>
<object name="sword_2"></object>
<object name="sword_3"></object>
etc etc etc
<game name="guntraining">
<gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<object name="F49 Assualt Rifle">
<inherit name="editor_object" />
<look>The rifle is long and somewhat bulky. It fires 500 rounds per minute with reloading clips of 60 per round. </look>
<alt type="stringlist">
<value>Assualt Rifle</value>
</alt>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
</inventoryverbs>
<roundrifle type="int">60</roundrifle>
<take />
<shoot type="script">
if (not Got(F49 Assualt Rifle)) {
msg ("You don't have this weapon.")
}
else if (Got(F49 Assualt Rifle)) {
if (F49 Assualt Rifle.roundrifle = 0) {
msg ("You need to reload your weapon")
invoke (ScriptDictionaryItem (F49 Assualt Rifle.reload, F49 ammo))
}
else {
roundrifle_fired = GetRandomInt (10, F49 Assualt Rifle.roundrifle)
roundrifle_left = F49 Assualt Rifle.roundrifle - roundrifle_fired
set (F49 Assualt Rifle, "roundrifle", roundrifle_left)
msg ("You fired off " + roundrifle_fired + " rounds, and now have only " + roundrifle_left + " rounds left.")
if (roundrifle_left = 0) {
msg ("reload")
invoke (ScriptDictionaryItem (F49 Assualt Rifle.reload, F49 ammo))
}
}
}
</shoot>
<reload type="scriptdictionary">
<item key="F49 ammo"><![CDATA[
if (not Got(F49 Assualt Rifle)) {
msg ("You don't have this weapon to reload...")
}
else if (Got(F49 Assualt Rifle)) {
if (not Got(F49 ammo) or F49 ammo.rifleclip = 0) {
msg ("You have no ammo to reload with...")
}
else if (Got(F49 ammo) and F49 Assualt Rifle.roundrifle =60) {
msg ("You rifle is already fully loaded. ")
}
else if (Got(F49 ammo) and F49 ammo.rifleclip > 0) {
set (F49 Assualt Rifle, "roundrifle", F49 Assualt Rifle.roundrifle + F49 ammo.rifleclip)
msg ("You reloaded your rifle. ")
}
}
]]></item>
</reload>
</object>
</object>
<object name="F49 ammo">
<inherit name="editor_object" />
<rifleclip type="int">60</rifleclip>
<take />
<inventoryverbs type="stringlist">
<value>Look at</value>
</inventoryverbs>
<usedefaultprefix />
</object>
</object>
<verb>
<property>shoot</property>
<pattern>shoot #object#; fire #object#</pattern>
<defaultexpression>"You can't shoot " + object.article + "."</defaultexpression>
<defaulttext>You can't do that here.</defaulttext>
</verb>
<verb>
<pattern>reload #object#</pattern>
<property>reload</property>
<defaulttext>You can't reload</defaulttext>
</verb>
Error running script: Error evaluating expression 'GetRandomInt (10, F49 Assualt Rifle.roundrifle)': 'minValue' cannot be greater than maxValue.Parameter name: minValue
roundrifle_fired = GetRandomInt (10, F49 Assualt Rifle.roundrifle)
if (not Got(F49 Assault Rifle)) {
msg ("You don't have this weapon.")
}
else if (Got(F49 Assault Rifle)) {
if (F49 Assault Rifle.roundrifle = 0) {
msg ("You need to reload your weapon")
}
else {
roundrifle_fired = GetRandomInt (10, 60)
roundrifle_left = F49 Assault Rifle.roundrifle - roundrifle_fired
F49 Assault Rifle.roundrifle = roundrifle_left
if (roundrifle_fired > roundrifle_left) {
roundrifle_fired = roundrifle_left
roundrifle_left = 0
msg ("You fired off " + roundrifle_fired + " rounds, and now have only " + roundrifle_left + " rounds left. reload rifle")
if (roundrifle_left = 0) {
F49 Assault Rifle.roundrifle = 0
}
else if (roundrifle_left <=0) {
roundrifle_left = 0
msg ("reload...")
}
}
}
}
if (not Got(F49 Assault Rifle)) {
msg ("You don't have this weapon.")
}
else if (Got(F49 Assault Rifle)) {
if (F49 Assault Rifle.roundrifle = 0) {
msg ("You need to reload your weapon")
}
else if (F49 Assault Rifle.roundrifle >0) {
roundrifle_fired = GetRandomInt (10, 60)
roundrifle_left = F49 Assault Rifle.roundrifle - roundrifle_fired
if (roundrifle_fired > roundrifle_left) {
roundrifle_fired = roundrifle_left
roundrifle_left = 0
msg ("reload....")
F49 Assault Rifle.roundrifle = 0
}
else {
msg ("Your fired " +roundrifle_fired+ " and now have " +roundrifle_left+ ".")
}
}
}
if (not Got(F49 Assault Rifle)) {
msg ("You don't have this weapon to reload...")
}
else if (Got(F49 Assault Rifle)) {
if (not Got(F49 ammo) or F49 ammo.rifleclip = 0) {
msg ("You have no ammo to reload with...")
}
else if (Got(F49 ammo) and F49 Assault Rifle.roundrifle =60) {
msg ("You rifle is already fully loaded. ")
}
else if (Got(Got(F49 ammo) and Got(F49 Assault Rifle.roundrifle <60))) {
F49 Assault Rifle.roundrifle = F49 Assualt Rifle.roundrifle + F49 ammo.rifleclip
msg ("You reloaded your rifle. ")
}
}
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="guntraining">
<gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<shoot type="script">
if (Got(weapon.attribute)) {
msg ("The weapon fires in the direction you point. ")
}
else {
msg ("There's nothing to shoot at now.")
}
</shoot>
<object name="Assault Rifle">
<inherit name="editor_object" />
<inherit name="weaponhuman" />
<alias>F49 Assault Rifle</alias>
<look>The rifle is long and somewhat bulky. It fires 500 rounds per minute with reloading clips of 60 per round. </look>
<alt type="stringlist">
<value>Assault Rifle</value>
<value>weapon</value>
</alt>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
<value>Reload</value>
</inventoryverbs>
<roundrifle type="int">60</roundrifle>
<take />
<fire type="string"></fire>
<human />
<listalias>Assault Rifle</listalias>
</object>
</object>
<object name="F49 ammo">
<inherit name="editor_object" />
<rifleclip type="int">60</rifleclip>
<take />
</object>
</object>
<verb>
<property>reload</property>
<pattern>reload #object#</pattern>
<defaultexpression>"You can't reload " + object.article + "."</defaultexpression>
<rounds type="scriptdictionary">
<item key="round rifle"><![CDATA[
if (Got(Assault Rifle)) {
if (Assault Rifle.roundrifle=60) {
if (Got(F49 ammo)) {
msg ("Your weapon is fully reloaded. ")
}
}
else {
if (Assault Rifle.roundrifle<=0) {
if (Got(F49 ammo)) {
set (Assault Rifle, "roundrifle", F49 ammo.rifleclip)
msg ("You reloaded your rifle.")
}
}
}
}
else {
msg ("You don't have the weapon to reload.")
}
]]></item>
</rounds>
</verb>
<verb>
<property>shoot</property>
<pattern>shoot #object#; fire #object#</pattern>
<defaultexpression>"You can't shoot " + object.article + "."</defaultexpression>
<defaulttext>You can't do that here. </defaulttext>
</verb>
<type name="weaponhuman">
<inherit name="editor_object" />
<weapontrash type="boolean">false</weapontrash>
<shoot type="script"><![CDATA[
if (Got(Assault Rifle)) {
msg ("You don't have this weapon.")
}
else if (Got(Assault Rifle)) {
rifleshot_fired = GetRandomInt(10,60)
rifleshot_left = Assault Rifle.roundrifle - rifleshot_fired
Assault Rifle.roundrifle = rifleshot_left
if (Assault Rifle.roundrifle <=0) {
Assault Rifle.roundrifle = 0
msg ("reload your weapon.")
}
else if (Assault Rifle.roundrifle >0) {
msg ("gun shot. " +rifleshot_fired+ " fired. " +rifleshot_left+ " shots left.")
}
}
]]></shoot>
<reload type="script"><![CDATA[
if (not Got(Assault Rifle)) {
msg ("You don't have this weapon to reload...")
}
else if (Got(Assault Rifle)) {
if (not Got(F49 ammo)) {
msg ("You have no ammo to reload with...")
}
else if (Got(F49 ammo)) {
if (Assault Rifle.roundrifle =60) {
msg ("Your weapon is fully reloaded")
}
else if (Assault Rifle.roundrifle <60) {
set (Assault Rifle, "roundrifle", Assault Rifle.roundrifle + F49 ammo.rifleclip)
if (Assault Rifle.roundrifle >60) {
Assault Rifle.roundrifle = 60
msg ("your weapon is reloaded")
}
}
}
}
]]></reload>
<changedweapontrash type="script">
if (weapontrash= true) {
MakeObjectInvisible (Assault Rifle)
}
</changedweapontrash>
</type>
</asl>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="character_object_type" />
</object>
<object name="monster">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="character_object_type" />
</object>
<type name="character_object_type">
<attr name="strength_integer" type="int">0</attr>
<attr name="endurance_integer" type="int">0</attr>
<attr name="dexterity_integer" type="int">0</attr>
<attr name="agility_integer" type="int">0</attr>
<attr name="speed_integer" type="int">0</attr>
<attr name="luck_integer" type="int">0</attr>
<attr name="piety_integer" type="int">0</attr>
<attr name="intelligence_integer" type="int">0</attr>
<attr name="spirituality_integer" type="int">0</attr>
<attr name="mentality_integer" type="int">0</attr>
<attr name="perception_integer" type="int">0</attr>
<attr name="deception_integer" type="int">0</attr>
<attr name="personality_integer" type="int">0</attr>
<attr name="alignment_integer" type="int">0</attr>
<attr name="charisma_integer" type="int">0</attr>
<attr name="leadership_integer" type="int">0</attr>
<attr name="current_life_integer" type="int">0</attr>
<attr name="maximum_life_integer" type="int">0</attr>
<attr name="current_mana_integer" type="int">0</attr>
<attr name="maximum_mana_integer" type="int">0</attr>
<attr name="level_integer" type="int">0</attr>
<attr name="experience_integer" type="int">0</attr>
<attr name="cash_integer" type="int">0</attr>
<attr name="life_string" type="string">0 / 0</attr>
<attr name="mana_string" type="string">0 / 0</attr>
<attr name="fight" type="script">
// script block code lines
</attr>
</type>
<object name="sword_1">
<inherit name="editor_object" />
<inherit name="equipment_object_type" />
<inherit name="weapon_object_type" />
<alias>claymore</alias>
</object>
<object name="armor_1">
<inherit name="editor_object" />
<inherit name="equipment_object_type" />
<inherit name="armor_object_type" />
<alias>obsidian full plate armor</alias>
</object>
<type name="equipment_object_type">
<attr name="price_integer" type="int">0</attr>
<attr name="equipment_type_string" type="string">unknown</attr>
<attr name="weight_integer" type="int">0</attr>
<attr name="equipment_slot_stringlist" type="simplestringlist"></attr>
<attr name="equipment_layer_integer" type="int">0</attr>
<attr name="status_effect_stringlist" type="simplestringlist"></attr>
<attr name="magic_effect_stringlist" type="simplestringlist"></attr>
<attr name="equip" type="script">
// script block code lines
</attr>
</type>
<type name="weapon_object_type">
<attr name="weapon_type_stringlist" type="simplestringlist"></attr>
<attr name="attack_rating_integer" type="int">0</attr>
<attr name="physical_damage_integer" type="int">0</attr>
<attr name="magical_damage_integer" type="int">0</attr>
<attr name="fire_damage_integer" type="int">0</attr>
<attr name="water_damage_integer" type="int">0</attr>
<attr name="air_damage_integer" type="int">0</attr>
<attr name="earth_damage_integer" type="int">0</attr>
<attr name="light_damage_integer" type="int">0</attr>
<attr name="dark_damage_integer" type="int">0</attr>
<attr name="holy_damage_integer" type="int">0</attr>
<attr name="unholy_damage_integer" type="int">0</attr>
</type>
<type name="armor_object_type">
<attr name="armor_type_stringlist" type="simplestringlist"></attr>
<attr name="armor_class_integer" type="int">0</attr>
<attr name="physical_resistance_integer" type="int">0</attr>
<attr name="magical_resistance_integer" type="int">0</attr>
<attr name="fire_resistance_integer" type="int">0</attr>
<attr name="water_resistance_integer" type="int">0</attr>
<attr name="air_resistance_integer" type="int">0</attr>
<attr name="earth_resistance_integer" type="int">0</attr>
<attr name="light_resistance_integer" type="int">0</attr>
<attr name="dark_resistance_integer" type="int">0</attr>
<attr name="holy_resistance_integer" type="int">0</attr>
<attr name="unholy_resistance_integer" type="int">0</attr>
</type>
<type name="clothing_object_type">
</type>
<object name="orc">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'orc' Object's Verb
if (orc.dead) {
} else if (not orc.dead) {
}
</attr>
</object>
<object name="ogre">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'ogre' Object's Verb
if (ogre.dead) {
} else if (not ogre.dead) {
}
</attr>
</object>
<object name="troll">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'troll' Object's Verb
if (troll.dead) {
} else if (not troll.dead) {
}
</attr>
</object>
<object name="goblin">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'goblin' Object's Verb
if (goblin.dead) {
} else if (not goblin.dead) {
}
</attr>
</object>
<object name="gremlin">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'gremlin' Object's Verb
if (gremlin.dead) {
} else if (not ogre.gremlin) {
}
</attr>
</object>
<object name="dragon">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'dragon Object's Verb
if (dragon.dead) {
} else if (not dragon.dead) {
}
</attr>
</object>
<object name="townsperson">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'townsperson' Object's Verb
if (townsperson.dead) {
} else if (not townsperson.dead) {
}
</attr>
</object>
<object name="rogue">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'rogue' Object's Verb
if (rogue.dead) {
} else if (not rogue.dead) {
}
</attr>
</object>
<object name="mage_guild_acolyte">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'mage guild acolyte' Object's Verb
if (mage_guild_acolyte.dead) {
} else if (not acolyte.dead) {
}
</attr>
</object>
<verb>
<property>fight</property>
<pattern>fight</fight>
<defaultexpression>blah</defaultexpression>
</verb>
<object name="orc">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'orc' Object's Verb
if (this.dead) {
} else if (not this.dead) {
}
</attr>
</object>
<object name="ogre">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'ogre' Object's Verb
if (this.dead) {
} else if (not this.dead) {
}
</attr>
</object>
<object name="troll">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'troll' Object's Verb
if (this.dead) {
} else if (not this.dead) {
}
</attr>
</object>
<object name="goblin">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'goblin' Object's Verb
if (this.dead) {
} else if (not this.dead) {
}
</attr>
</object>
<object name="gremlin">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'gremlin' Object's Verb
if (this.dead) {
} else if (not this.gremlin) {
}
</attr>
</object>
<object name="dragon">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'dragon Object's Verb
if (this.dead) {
} else if (not this.dead) {
}
</attr>
</object>
<object name="townsperson">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'townsperson' Object's Verb
if (this.dead) {
} else if (not this.dead) {
}
</attr>
</object>
<object name="rogue">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'rogue' Object's Verb
if (this.dead) {
} else if (not this.dead) {
}
</attr>
</object>
<object name="mage_guild_acolyte">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script"> // this is your 'mage guild acolyte' Object's Verb
if (this.dead) {
} else if (not this.dead) {
}
</attr>
</object>
<verb>
<property>fight</property>
<pattern>fight</fight>
<defaultexpression>blah</defaultexpression>
</verb>
<object name="orc">
<inherit name="non_playable_character_object_type" />
</object>
<object name="ogre">
<inherit name="non_playable_character_object_type" />
</object>
<object name="troll">
<inherit name="non_playable_character_object_type" />
</object>
<object name="goblin">
<inherit name="non_playable_character_object_type" />
</object>
<object name="gremlin">
<inherit name="non_playable_character_object_type" />
</object>
<object name="dragon">
<inherit name="non_playable_character_object_type" />
</object>
<object name="townsperson">
<inherit name="non_playable_character_object_type" />
</object>
<object name="rogue">
<inherit name="non_playable_character_object_type" />
</object>
<object name="shop_owner">
<inherit name="non_playable_character_object_type" />
</object>
<object name="mage_guild_acolyte">
<inherit name="non_playable_character_object_type" />
</object>
<verb>
<property>fight</property>
<pattern>fight</fight>
<defaultexpression>blah</defaultexpression>
</verb>
<type name="non_playable_character_object_type">
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script">
if (this.dead) {
} else if (not this.dead) {
}
</attr>
</type>
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="testing game stuff">
<gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
<attr name="test" type="boolean">false</attr>
<attr name="count" type="int">0</attr>
<start type="script">
msg ("bye")
test_function
</start>
</game>
<function name="test_function"><![CDATA[
if (game.count <= 10) {
if (game.test = false) {
game.test = true
msg ("hi")
} else if (game.test = true) {
game.test = false
msg ("bye")
}
game.count = game.count + 1
test_function
}
]]></function>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>
if (not Got(this)) {
msg ("pick it up first")
this.equipped = False
}
else if (Got(this)) {
this.equipped = True
if (this.equipped = True) {
msg ("you shoot")
do (this, "weapon_type")
}
}
<object name="player">
<attr name="equipped_weapon_object" type="object">unarmed</attr> // you'll need an 'equip' script to set that weapon to this attribute
</object>
<object name="monster">
<inherit name="non_playable_character_object_type" />
</object>
<type name="non_playable_character_object_type">
<shoot type="script><![CDATA[
weapon_x = GetObject (player.equipped_weapon_object)
if (not Got(weapon_x)) {
msg ("You don't have this weapon.")
}
else if (Got(weapon_x)) {
rounds_fired = GetRandomInt(10,60)
rounds_left = weapon_x.rounds - rounds_fired
weapon_x.rounds = rounds_left
if (weapon_x.rounds <=0) {
weapon_x.rounds = 0
msg ("reload your weapon.")
}
else if (weapon_x.rounds >0) {
msg ("gun shot. " +rounds_fired+ " fired. " +rounds_left+ " shots left.")
}
}
]]></shoot>
</attr>
</type>
omega wrote:Any way I can invoke a scriptdictionary to an object type attribute?
<type name="blah">
<attr name="blah" type="script">
invoke (ScriptDictionaryItem (Object.ScriptDictionary, Value)
</attr>
</type>
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="guntraining">
<gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<listalias>Assault Rifle</listalias>
</object>
<object name="F49 ammo">
<inherit name="editor_object" />
<rifleclip type="int">60</rifleclip>
<take />
</object>
<object name="pistol">
<inherit name="editor_object" />
<inherit name="weapon_human" />
<rounds type="int">10</rounds>
<attr name="weapon_type">handgun</attr>
<take />
<minam type="int">1</minam>
<maxam type="int">10</maxam>
</object>
<object name="Assault Rifle">
<inherit name="editor_object" />
<inherit name="weapon_human" />
<take />
<minam type="int">10</minam>
<alt type="stringlist">
<value>rifle</value>
</alt>
<maxam type="int">60</maxam>
<rounds type="int">60</rounds>
<attr name="weapon_type">mediumrifle</attr>
</object>
</object>
<verb>
<property>reload</property>
<pattern>reload #object#</pattern>
<defaultexpression>"You can't reload " + object.article + "."</defaultexpression>
<rounds type="scriptdictionary">
<item key="round rifle"><![CDATA[
if (Got(Assault Rifle)) {
if (Assault Rifle.roundrifle=60) {
if (Got(F49 ammo)) {
msg ("Your weapon is fully reloaded. ")
}
}
else {
if (Assault Rifle.roundrifle<=0) {
if (Got(F49 ammo)) {
set (Assault Rifle, "roundrifle", F49 ammo.rifleclip)
msg ("You reloaded your rifle.")
}
}
}
}
else {
msg ("You don't have the weapon to reload.")
}
]]></item>
</rounds>
</verb>
<verb>
<property>shoot</property>
<pattern>shoot #object#; fire #object#</pattern>
<defaultexpression>"You can't shoot " + object.article + "."</defaultexpression>
<defaulttext>You can't do that here. </defaulttext>
</verb>
<type name="weapon_human">
<equipped type="boolean">false</equipped>
<fire>shoot</fire>
<shoot type="script"><![CDATA[
if (not Got(this)) {
msg ("You don't have this weapon.")
}
else if (Got(this)) {
this.equipped = True
shot_fired = GetRandomInt(this.minam,this.maxam)
shot_left = this.rounds - shot_fired
if (shot_left <=0) {
shot_left = 0
msg ("reload....")
}
else if (shot_fired > shot_left) {
shot_fired = shot_left
shot_left = 0
msg ("you shot all your bullets. reload")
}
else {
msg ("you shot " +shot_fired+ " and have " +shot_left+ ".")
}
}
]]></shoot>
</type>
</asl>
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="guntraining">
<gameid>eaba3834-ff71-459e-8be5-5f72b041cfe9</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<listalias>Assault Rifle</listalias>
<object name="Assault Rifle">
<inherit name="editor_object" />
<inherit name="weapon_human" />
<take />
<minam type="int">10</minam>
<alt type="stringlist">
<value>rifle</value>
</alt>
<maxam type="int">60</maxam>
<rounds type="int">60</rounds>
<look>The F49 Assault Rifle is an effective weapon best used in group combat. Can fire 500 rpm. Max shots per round is 60. Range type: Medium to Close</look>
<F49reload type="boolean">false</F49reload>
<reload type="script">
if (not Got(F49 ammo)) {
msg ("you don't have the ammo")
}
else if (Got(F49 ammo)) {
invoke (ScriptDictionaryItem(this.weapon_to_ammo, "Assault Rifle"))
}
</reload>
</object>
<object name="F49 ammo">
<inherit name="editor_object" />
<inherit name="ammo_taken" />
<clip type="int">300</clip>
<take />
<alt type="stringlist">
<value>rifle ammo</value>
</alt>
<look>Ammo used with Assualt Rifle. Carrying capacity: 300</look>
<maxclip type="int">300</maxclip>
</object>
<object name="Pistol">
<inherit name="editor_object" />
<inherit name="weapon_human" />
<rounds type="int">10</rounds>
<attr name="weapon_type">handgunG9</attr>
<take />
<minam type="int">1</minam>
<maxam type="int">10</maxam>
<reload type="script">
if (not Got(G9 ammo)) {
msg ("you don't have the ammo")
}
else if (Got(G9 ammo)) {
invoke (ScriptDictionaryItem(this.weapon_to_ammo, "Pistol"))
}
</reload>
<look><![CDATA[This enhanced pistol is heavy and requires two hands to hold, but can fire shots as powerful as a .50 Dessert Eagle. <br/>Can fire off 10 shots per round with Range Combat: Close ]]></look>
</object>
<object name="G9 ammo">
<inherit name="editor_object" />
<inherit name="ammo_taken" />
<clip type="int">10</clip>
<alt type="stringlist">
<value>pistol ammo</value>
</alt>
<take />
<maxclip type="int">50</maxclip>
<look>Ammo used with G9 Pistol. Carrying capacity: 50</look>
</object>
<object name="STK Rifle">
<inherit name="editor_object" />
<inherit name="weapon_human" />
<minam type="int">10</minam>
<maxam type="int">30</maxam>
<rounds type="int">30</rounds>
<take />
<reload type="script">
if (not Got(Cal30 ammo)) {
msg ("you don't have the ammo")
}
else if (Got(Cal30 ammo)) {
invoke (ScriptDictionaryItem(this.weapon_to_ammo, "STK Rifle"))
}
</reload>
<alt type="stringlist">
<value>stk</value>
</alt>
</object>
<object name="Cal30 ammo">
<inherit name="editor_object" />
<inherit name="ammo_taken" />
<clip type="int">30</clip>
<maxclip type="int">180</maxclip>
<take />
<alt type="stringlist">
<value>stk ammo</value>
</alt>
</object>
</object>
</object>
<verb>
<property>reload</property>
<pattern>reload #object#</pattern>
<defaultexpression>"You can't reload " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>shoot</property>
<pattern>shoot #object#; fire #object#</pattern>
<defaultexpression>"You can't shoot " + object.article + "."</defaultexpression>
<defaulttext>You can't do that here. </defaulttext>
</verb>
<object name="pile room">
<inherit name="editor_room" />
</object>
<type name="weapon_human">
<equipped type="boolean">false</equipped>
<fire>shoot</fire>
<shoot type="script"><![CDATA[
if (not Got(this)) {
msg ("You don't have this weapon.")
}
else if (Got(this)) {
if (this.rounds <=0) {
this.rounds = 0
msg ("reload....")
}
else if (this.rounds>0) {
this.equipped = True
shot_fired = GetRandomInt(this.minam,this.maxam)
shot_left = this.rounds - shot_fired
this.rounds = shot_left
if (shot_left <=0) {
shot_fired = shot_left
shot_left = 0
msg ("You fired all your rounds. Reload. ")
this.rounds = 0
}
else if (shot_left>0) {
msg ("You shot " +shot_fired+ " and have " +shot_left+ ".")
}
}
}
]]></shoot>
<weapon_to_ammo type="scriptdictionary">
<item key="Assault Rifle"><![CDATA[
if (Assault Rifle.rounds = Assault Rifle.maxam) {
msg ("Your weapon is fully loaded. ")
}
else if (Assault Rifle.rounds < Assault Rifle.maxam) {
if (F49 ammo.clip <= 0) {
msg ("There's no ammo left. ")
F49 ammo.usedammo = True
}
else if (F49 ammo.clip > 0 ) {
if (Assault Rifle.rounds = 0) {
Assault Rifle.rounds = F49 ammo.clip
F49 ammo.clip = 0
msg ("You reloaded with all your ammo.")
F49 ammo.usedammo = True
}
else if (Assault Rifle.rounds <= F49 ammo.clip) {
xii = Assault Rifle.rounds
Assault Rifle.rounds = Assault Rifle.rounds + F49 ammo.clip
if (Assault Rifle.rounds >=30) {
F49 ammo.clip = xii
msg ("You reloaded.")
Assault Rifle.rounds = 30
}
else if (Assault Rifle.rounds < xii) {
msg ("You reloaded.")
F49 ammo.clip = 0
F49 ammo.usedammo = True
}
}
else if (Assault Rifle.rounds>F49 ammo.clip) {
xi = F49 ammo.clip - Assault Rifle.rounds
Assault Rifle.rounds = F49 ammo.clip + Assault Rifle.rounds
if (Assault Rifle.rounds >= 30) {
Assault Rifle.rounds = 30
F49 ammo.clip = xi
if (F49 ammo.clip <= 0) {
F49 ammo.usedammo = True
}
msg ("You reloaded your weapon.")
}
else if (Assault Rifle.rounds >xi) {
F49 ammo.clip = 0
msg ("You reloaded.")
F49 ammo.usedammo = True
}
}
}
}
]]></item>
<item key="Pistol"><![CDATA[
if (Pistol.rounds = Pistol.maxam) {
msg ("Your weapon is fully loaded. ")
}
else if (Pistol.rounds < Pistol.maxam) {
if (G9 ammo.clip <= 0) {
msg ("There's no ammo left. ")
G9 ammo.usedammo = True
}
else if (G9 ammo.clip > 0 ) {
if (Pistol.rounds = 0) {
Pistol.rounds = G9 ammo.clip
G9 ammo.clip = 0
msg ("You reloaded with all your ammo.")
G9 ammo.usedammo = True
}
else if (Pistol.rounds <= G9 ammo.clip) {
xii = Pistol.rounds
Pistol.rounds = Pistol.rounds + G9 ammo.clip
if (Pistol.rounds >=30) {
G9 ammo.clip = xii
msg ("You reloaded.")
Pistol.rounds = 30
}
else if (Pistol.rounds < xii) {
msg ("You reloaded.")
G9 ammo.clip = 0
G9 ammo.usedammo = True
}
}
else if (Pistol.rounds> G9 ammo.clip) {
xi = G9 ammo.clip - Pistol.rounds
Pistol.rounds = G9 ammo.clip + Pistol.rounds
if (Pistol.rounds >= 30) {
Pistol.rounds = 30
G9 ammo.clip = xi
if (G9 ammo.clip <= 0) {
G9 ammo.usedammo = True
}
msg ("You reloaded your weapon.")
}
else if (Pistol.rounds >xi) {
G9 ammo.clip = 0
msg ("You reloaded")
G9 ammo.usedammo = True
}
}
}
}
]]></item>
<item key="STK Rifle"><![CDATA[
if (STK Rifle.rounds = STK Rifle.maxam) {
msg ("Your weapon is fully loaded. ")
}
else if (STK Rifle.rounds < STK Rifle.maxam) {
if (Cal30 ammo.clip <= 0) {
msg ("There's no ammo left. ")
Cal30 ammo.usedammo = True
}
else if (Cal30 ammo.clip > 0 ) {
if (STK Rifle.rounds = 0) {
STK Rifle.rounds = Cal30 ammo.clip
Cal30 ammo.clip = 0
msg ("You reloaded with all your ammo.")
Cal30 ammo.usedammo = True
}
else if (STK Rifle.rounds <= Cal30 ammo.clip) {
xii = STK Rifle.rounds
STK Rifle.rounds = STK Rifle.rounds + Cal30 ammo.clip
if (STK Rifle.rounds >=30) {
Cal30 ammo.clip = xii
msg ("You reloaded.")
STK Rifle.rounds = 30
}
else if (STK Rifle.rounds < xii) {
msg ("You reloaded (2).")
Cal30 ammo.clip = 0
Cal30 ammo.usedammo = True
}
}
else if (STK Rifle.rounds>Cal30 ammo.clip) {
xi = Cal30 ammo.clip - STK Rifle.rounds
STK Rifle.rounds = Cal30 ammo.clip + STK Rifle.rounds
if (STK Rifle.rounds >= 30) {
STK Rifle.rounds = 30
Cal30 ammo.clip = xi
if (Cal30 ammo.clip <= 0) {
Cal30 ammo.usedammo = True
}
msg ("You reloaded your weapon.")
}
else if (STK Rifle.rounds >xi) {
Cal30 ammo.clip = 0
msg ("You reloaded 1234")
Cal30 ammo.usedammo = True
}
}
}
}
]]></item>
</weapon_to_ammo>
</type>
<type name="ammo_taken">
<usedammo type="boolean">false</usedammo>
<changedusedammo type="script">
if (this.usedammo = True) {
MoveObject (this, pile room)
}
</changedusedammo>
</type>
</asl>
variable_x = GetRandomInt (min_value,max_value)
// the 'switch' code is just a different structure~design of~for doing multiple 'if' code lines
switch (variable_x) {
case (1) {
// 'shoot' scripting
}
case (2) {
// 'defend' scripting
}
case (3) {
// 'power ~ special ability' scripting
}
case (4) {
// 'item' scripting
}
// etc 'cases'
}