Barbaroyj Newbie
Joined: 20 Oct 2006 Posts: 1
|
Posted: Fri Oct 20, 2006 10:06 pm
String list manipulation difficulties |
Working on a ambushing script for a mud I play. The portion that acquires the targets active in the room to a string list is as follows:
#CLASS {ambush|targetlist}
#ALIAS checklist {#If (%ismember( @potentialenemy, @enemylist)) {#say "Enemy not added"} {#additem enemylist @potentialenemy)}}
#VAR enemylist {enormous crackling eliktir||irritated crackling eliktir|normal emerald gurok|aggressive greater sandathi|angry greater sandathi}
#VAR LTargetList {emerald gurok|greater sandathi|crackling eliktir}
#VAR potentialenemy {normal emerald gurok}
#VAR currentenemy {}
#VAR deadenemy {contentious emerald gurok}
#TRIGGER {{a|an} (%x) ({@LTargetList})} {
#var potentialenemy {%1 %2}
#if (%1 != "dead") {#additem enemylist @potentialenemy )} {#say "Ignored dead enemy"}
}
#TRIGGER {%w {kill|kills} {a|an} ({@enemylist})} {
#color red
#var deadenemy {%1}
#delitem enemylist @deadenemy
}
#CLASS 0
The difficulty that I am facing comes during the trigger %w {kill|kills} {a|an} ({@enemylist}). The trigger fires, the correct value is assigned to deadenemy, but the delitem function does not remove the enemy stored in deadenemy from the string list enemylist.
Further, I'm looking for general advice on prioratizing enemies in terms of their damage weaknesses. I would like to be able to check the string list for an enemy whose last two strings are for instance, "greater sandathi", "emerald gurok", or "crackling eliktir" in that order of desirability, and attack them if present. However, the system always presents them in a system of (random adjective) greater sandathi, (random adjective) emerald gurok, etc. Thoughts on how to pull the targets out and attack in the desired priority?
Thank you,
-J |
|