|
Sir1l Wanderer
Joined: 01 Oct 2005 Posts: 54
|
Posted: Mon Jun 18, 2007 6:05 pm
Finding Variables |
What I am making is a bot that kills things, but I have a little problem...
I was wondering if there was a way to see if a value is already in a variable? Like this
#VAR mobs {pirate|man|thing}, so here's this variable and now I have a trigger that triggers off a mob's description and its keyword is pirate, what i want it to do is check if it is the variable already and if it is, I wanted it to list how many there were, add 2.pirate to it and also want it to check if 2.pirate is in it, it will ad 3.pirate...and so on. I was thinking of using %countlist, but if there's already another way to do it without this, it would make it much easier. |
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Mon Jun 18, 2007 7:05 pm |
Code: |
#var pref {}
#while %ismember( %if( @pref, %eval( "@{pref}.%1"), "%1"), @mobs) {#add pref 1}
#additem mobs %if( @pref, %eval( "@{pref}.%1"), "%1") |
This would work in a trigger or alias assuming %1 has the name you're looking to add to your list of mobs. |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
|
|
|
|
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
|
|