|
Uther Beginner
Joined: 30 Jan 2001 Posts: 13 Location: USA
|
Posted: Tue Nov 20, 2001 9:34 pm
6.16 frriendlist question |
Hi,
I am trying to make a list of people to cast spells on. Here is what I am doing, for some reason all this works just fine on 5.55 an 4.62 but not on 6.16. I did this with an if statement on the earlier version which didn't work on 6.16, so I am trying to work out the problem with an ismember statement. In any event it doesn't work.
I use the following aliases to set people to the friends variable and it works on all versions.
#AL (like){%additem %1}
#AL (hate){%delitem %1}
like I said, these work
now i want to cast spells on people ont he friends list and mutter oaths on those not on the list.
#IF %ismember(%1,@friends){say I will avail you of my magic}{say Begone foul demon!}
on the earlier version I used
#IF (%1=@friends){blah}{blah} same as above.
Is there something between the versions that I am missing? This code is pretty much exactly like the example in the help file.
Thanks in advance for any help
Uther |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Tue Nov 20, 2001 11:34 pm |
Did you try putting spaces between the if-else statements?
#if (%ismember(%1, @friends)) {say I will avail you of my magic} {say Begone foul demon!}
Also, does the person who you're trying to cast the spell on have more than 1 word-names? i.e. Billy Bob instead of Bob. If so, then you might have to put brackets or quotes around %1:
#if (%ismember({%1}, @friends)) {say I will avail you of my magic} {say Begone foul demon!}
#if (%ismember("%1", @friends)) {say I will avail you of my magic} {say Begone foul demon!}
Other than that, I don't see anything wrong with your syntax. Try that and get back to us. :)
Iljhar |
|
|
|
Uther Beginner
Joined: 30 Jan 2001 Posts: 13 Location: USA
|
Posted: Wed Nov 21, 2001 12:16 am |
Thanks for the help, here is/was the situation:
First of all i had to add a second set of parentheses as in your example to include the ismember and the ("%1",@friends) so
#if (%ismember("%1", @friends)) also, i had to move the 'true' case to the second position:
#if (%ismember("%1", @friends)) {say Begone foul demon!} {say I will avail you of my magic} It seems to work just fine now, Im not sure why the true statement has to be second though. If the character name -is- on the list it executes the second set of brackets first. Weird huh! Anyways thanks a lot for the timely help.
I wanted to note a strange occurence earlier in the week too. I wanted to make a simple loop to do something mundane and tedious. I tried:
#loop 1,20{open %i.door}
to get this to work with 6.16 however require another set of brackets:
#loop 1,20{open %{i}.door}
it has a semblance of similarity to the above situation. I tried the loop with "" around the i and it doesnt work as above, in this case, the brackets are needed.
Uther |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Wed Nov 21, 2001 8:42 am |
Well, in the case with the loop, if you do %i.whatever, zMUD thinks you're trying to access a db record, so to get around that, as you found out, you have to put curly braces around the first part. As to the %ismember thing, no idea why it's doing the if-else statements backwards. By all accounts it should not do this, but if it's working, I guess it's all good, heh.
Iljhar |
|
|
|
|
|
|
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
|
|