Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Barbaroyj
Newbie


Joined: 20 Oct 2006
Posts: 1

PostPosted: 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
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Oct 20, 2006 10:29 pm   
 
Is @deadenemy more than one word sometimes? You may need to surround it with curly braces so that #DELITEM knows to treat it as one argument rather than seeing only the first word and ignoring the rest.
_________________
EDIT: I didn't like my old signature
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net