|
Threndil Newbie
Joined: 09 Jan 2006 Posts: 9 Location: Guatemala
|
Posted: Wed Oct 22, 2008 2:58 am
Mutiple value variables - Zmud 5.55 |
Good people,
I wrote down a trigger yesterday, but I seem to be having an issue with the variable when it has a multiple value...
%if(@tehname=@Guildmember,give %abs(@tehgold/4) coin @tehname)
The variable that's giving an issue is @Guildmember. I used #ADDITEM on it but it doesn't want to recognize that there's a list.
I get the impression it's detecting all as one name:
#ADDITEM Guildmember Bob
#ADDITEM Guildmember Peter
Variable: Bob|Peter
But when the Variable is only Bob, the trigger works fine...
I suppose my real question, other than perhaps a better way of writing the trigger, is: Is it that it's not possible for the variables to have multiple values? (I'm getting the impression they can't).
Help of any kind will be well appreciated, thank you.
Threndil. |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Wed Oct 22, 2008 3:25 am |
First of all, you really should look into upgrading to 7.21.
Second of all, everything is working fine, you're just using the wrong syntax.
%if(%ismember(@tehname, @Guildmember),give %abs(@tehgold/4) coin @tehname)
should work for you. Of course, if that's the only line in your alias/trigger, then you should change it to:
#IF %ismember(@tehname, @Guildmember) {give %abs(@tehgold/4) coin @tehname}
I believe I have the ismember correct. If not, switch the two variables around.
Charneus |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Oct 22, 2008 3:33 am |
I just hope he isn't using 5.55 because its the easiest to pirate and then asking for help ;)
Though to be honest I used the DAMN! proxy trick to have 5.55 for several months before I could afford to buy it (I had a brand new baby is my only excuse lol!!) But in the end I did buy it because it is an excellent program and Zugg deserves our money.
That said, Charn is right, upgrade to 7.21, and use one of the 2 methods he gave you to have your trigger work correctly.
Also remember that if you want a specific item, but to not know the place in the list, you can use this:
%item(@List, %ismember(@ItemToFind,@List))
Or, for your example...
%item(@Guildmember, %ismember(@tehname, @Guildmember))
Although in truth, you already know it in these examples... There was a point to this... but I no longer remember what it was. LOL.
Ahhh, yes, I've got it now. For corresponding lists. See, %ismember() returns 0 for false, and the position in the list for true...
So, say we have
Var Members: Henry|George|Peter|Susan
Var Rank: Journeyman|Novice|Master|Novice
Var Name: George
Then #SHOW Rank: %item(@Rank, %ismember(@Name, @Members))
Gives us "Rank: Novice"
While Henry would be Journeyman, Peter would be Master, and Susan would also be Novice.
This comes in handy to remember. Just thought I'd throw it out there since you're using lists.
Enjoy. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Threndil Newbie
Joined: 09 Jan 2006 Posts: 9 Location: Guatemala
|
Posted: Wed Oct 22, 2008 3:44 am |
Ahh, there we go. That fixed it.
I've grown quite fond of 5.55. Although, I _did_ try 7.# once, I just wasn't able to get accustomed to some of the code. Plus I can't bring myself to re-write the insane amount of triggers I have :P
Thanks for the help, I didn't know about %ismember
Threndil. |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Wed Oct 22, 2008 3:54 am |
In truth, you wouldn't have to really rewrite your triggers. In fact, 7.21 is less buggy than 5.55 and has way more features that could essentially help your triggers.
That being said, you can also look into CMUD. :P
And you're quite welcome.
Charneus |
|
|
|
|
|
|
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
|
|