call an attribute script

Avantar
14 Nov 2013, 21:20
I hope someone can help me:

I make use of verbs (equipl, equipr and equip) to equip my weapons. I then have an object type called "weapon" with attributes of equipl, equipr and equip. Each of these are running a script.

Now in my combat script it asks for your battle choice: Attack, Defend or Equip a weapon (Thanx to Pertex)
I have two-handed and single-handed weapons that are defined with the attribute - "location"
"dhand" is for two-handed and "single" - well for one-handed.
What I fail to do in my script is say the following: "run the script on the equipl attribute located on the object type weapon (or I suppose the weapon in question as weapon type is being inherited by that weapon?)" or maybe even say: "call the verb equipl (like you would call a function: equipl result)
I have tried to use the "do" command, but not to sure how to use it. I hope this makes sense.
Here is the code when choosing the option to Equip a weapon:
weaponlist = NewStringList()
foreach (object, ScopeInventory()) {
if (DoesInherit(object, "weapon") and object.location = "single") {
msg (object + " is a single handed weapon")
list add (weaponlist, object.alias)
}
else if (DoesInherit(object, "weapon") and object.location = "dhand") {
msg (object + " is a two handed weapon")
list add (weaponlist, object.alias)
}
}
show menu ("Which weapon do you want to equip:", weaponlist, true) {
if (result<>null and object.location="dhand") {
msg ("You have chosen the " + result)
do (object, equip)
}
else {
msg ("You have chosen to press cancel")
}
}


Thank you in advance!

Liam315
14 Nov 2013, 23:46
All you're missing is a couple of quotations marks. It should look like this:

do (object,"equip")

Avantar
15 Nov 2013, 04:42
Lol! Thank you Liam.

I was playing with the dictionary parameter until I was blue in the face, thinking it is important somehow. :lol:
Missing quotes - how imbarrasing! :oops: