Thank you for the help guys.
Draft #1 is complete. I wrote it based on the following messages:
This iron ___ is in nearly perfect condition.
This iron ___ is in very good condition.
This iron ___ is starting to look a little worn.
This iron ___ is in serious need of repair.
This iron ___ is going to fall apart any day now.
This iron ___ is no longer functional.
The last (and most important) message is somewhat unconfirmed -- so if that's wrong, the macro won't be able to automagically unequip near-broken armor.
The macro detecting your armor's durability is currently dependent on how often you call the "examinearmor" function. I have mine bound to F11, and I run it once in a while. I could change the macro to call that function whenever you equip/unequip armor, but it would be a little spammy.
Feedback and criticism welcome. I'm still learning the syntax, so a few spots are ...ugly.
ironArmorToggler - I have mine bound to F10. Equips iron armor. If all three iron armor pieces are already equipped, it unequips all three. If you don't have all three, that part won't work right.
Code: Select all
ironArmorToggler
{
if @my.torso_item >= "iron breastplate"
if @my.head_item >= "iron helmet"
if @my.left_item >= "iron shield"
"/unequip ironbreastplate\r"
"/unequip ironhelmet\r"
"/unequip ironshield\r"
else
call equipIronArmor
end if
else
call equipIronArmor
end if
else
call equipIronArmor
end if
}
equipIronArmor - just a helper function. No need to bind it to a key or command, but necessary for everything to work.
Code: Select all
equipIronArmor
{
if @my.torso_item >= "iron breastplate"
else
"/equip ironbreastplate\r"
if @env.textLog.word[8].letter[1] == 0
"/unequip ironbreastplate\r"
message "* Iron Breastplate unequipped due to durability."
else if @env.textLog.word[8].letter[1] == 1
message "* Iron Breastplate durability is low."
end if
end if
if @my.head_item >= "iron helmet"
else
"/equip ironhelmet\r"
if @env.textLog.word[8].letter[1] == 0
"/unequip ironhelmet\r"
message "* Iron Helmet unequipped due to durability."
else if @env.textLog.word[8].letter[1] == 1
message "* Iron Helmet durability is low."
end if
end if
if @my.left_item >= "iron shield"
else
"/equip ironshield\r"
if @env.textLog.word[8].letter[1] == 0
"/unequip ironshield\r"
message "* Iron Shield unequipped due to durability."
else if @env.textLog.word[8].letter[1] == 1
message "* Iron Shield durability is low."
end if
end if
}
examinearmor - I have mine bound to F11. If you don't do this once in a while, the armor equipping macro will still work, but it won't warn you when you armor is close to breaking.
Code: Select all
setglobal armorCondition ""
examinearmor
{
message "* Armor Examiner:"
"/selectitem 'iron b'\r"
if @my.selected_item >= "iron breastplate"
pause 1
"/examine\r"
set armorCondition @env.textLog
call armorLabeler
end if
"/selectitem\r"
"/selectitem 'iron h'\r"
if @my.selected_item >= "iron helmet"
pause 1
"/examine\r"
set armorCondition @env.textLog
call armorLabeler
end if
"/selectitem\r"
"/selectitem 'iron s'\r"
if @my.selected_item >= "iron shield"
pause 1
"/examine\r"
set armorCondition @env.textLog
call armorLabeler
end if
"/selectitem\r"
}
armorLabeler - Another helper function.
Code: Select all
armorLabeler
{
if armorCondition.word[8] >= "perfect"
"/name 5 (perfect)\r"
else if armorCondition.word[8] >= "good"
"/name 4 (good)\r"
else if armorCondition.word[8] >= "look"
"/name 3 (fair)\r"
else if armorCondition.word[8] >= "need"
"/name 2 (worn)\r"
else if armorCondition.word[8] >= "fall"
"/name 1 (bad)\r"
else if armorCondition.word[8] >= "functional"
"/name 0 (breaking)\r"
end if
}