|
Brady Beginner
Joined: 24 Aug 2001 Posts: 25 Location: USA
|
Posted: Fri Jan 04, 2002 4:36 pm
Auto Spell-Casting Trigger Problems |
I've tried, and I just can't figure this out. This is what I've got so far, two triggers:
1. Trigger to cast spells on people when :
(a) they say the name of the spell
(b) the spell is in my accepted list
(c) and they are in my list of accepted people.
2. Trigger to "brew" a potion and give them the potion when :
(a) when they say the name of a spell
(b) the name of the spell is in my accepted brew list
(c) and are in my list of accepted people.
There will not be a time when the spell will be in BOTH the Spell_Say and the Spell_Brew list.
Both access the same basic trigger :
Brady says, 'heal'
I think I need something like this, but this doesn't work :
#VARIABLE Names {Friend1|Friend2|Friend3} <- my accepted friends list
#VARIABLE Spell_Say {Spell1|Spell2|Spell3} <- my accepted spell say
#VARIABLE Spell_Brew {Spell1|Spell2|Spell3} <- my accepted spell brew list
#TRIGGER {^(%w) says '%d' $}
{#IF (%ismember(%1, @names))} AND {#IF (%ismember(%2,@spell_say))}
{say '%1, you are a looser'} {cast '%2' %1}}
#TRIGGER {^(%w) says '%d' $}
{#IF (%ismember(%1, @names))} AND {#IF (%ismember(%2,@spell_brew))}
{say '%1, you are a looser'} {brew '%2';give %2 %1}}
Any help would be greatly appreciated.
Thanks,
Brady |
|
|
|
Crymson4 Novice
Joined: 20 Nov 2001 Posts: 35 Location: USA
|
Posted: Fri Jan 04, 2002 5:18 pm |
First off, there's a typo in your trigger pattern. You said the say syntax is "Brady says, 'heal'
Then, in your trigger, you have
#TRIGGER {^(%w) says '%d' $}
It should be
#TRIGGER {^(%w) says, '%d' $}
(add the comma)
Also, you may want to delete the 2nd "'" after %d, because some people may say heal. or heal! or whatever. If they add syntax, the trigger won't fire either.
And as I recall, there is an #array command, which is what you are inputting all the names/spells and such in to. Perhaps use #ARRAY instead of #VAR (#VAR only stores one value at a time)
-=Crymson
Someone once said "Don't try to be a great man, just be a man; and let history draw it's own conclusions.". |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Fri Jan 04, 2002 8:16 pm |
Just adding to Crymson4's post, you need parentheses around %d as well:
#TRIGGER {^(%w) says, '(%d)' $}
Otherwise, the trigger won't be able to use it for the %2 part.
Iljhar |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Jan 04, 2002 11:42 pm |
And one more added thing %1 and %2 should be enclosed in quotes when used. This is more important for %2 as some spells will have 2 words, such as detect magic, detect evil, and detect good.
|
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Sat Jan 05, 2002 6:49 am |
Not to take away from that advice, which is good, but since the pattern calls for %w and %d, there's no way to get more than 1 word into each variable. Also, I just realized, the trigger won't work because you're using %d to begin with, unless all your spells are numerical, which it doesn't look like from your example, so, your trigger needs to be changed. If all your spells are 1 word spells, then change the trigger pattern to this:
#TRIGGER {^(%w) says, '(%w)' $}
If some of your spells have 2 words, then change the trigger pattern to this:
#TRIGGER {^(%w) says, '(*)' $}
and use Vijilante's advice and place quotes around %2.
Iljhar |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Jan 05, 2002 4:36 pm |
Your trigger pattern should be pretty much okay at this point, however the command sections need some work. Since you wanted to insult the people who aren't on your friends list, it seemed easiest to nest all the #IFs.
You should probably reread the helpfile on #IF. Operators such as AND are used to combine conditions within the #IF expression, not to combine #IF commands.
#TR {^(%w) says, '(*)'} {#IF %ismember(%1,@Names) {#IF %ismember("%2",@Spell_Say) {cast '%2' %1} {#IF %ismember("%2",@Spell_Brew) {brew '%2';give %2 %1}}} {say '%1, you are a loser'}}
LightBulb
All scripts untested unless otherwise noted |
|
|
|
Brady Beginner
Joined: 24 Aug 2001 Posts: 25 Location: USA
|
Posted: Mon Jan 07, 2002 4:38 pm |
Thanks for the help, I'm going to give it a shot, and then get back to you. I figured I might be able to do it all in ONE trigger, like LightBulb suggested above, I just knew it was beyond me.
Brady |
|
|
|
Brady Beginner
Joined: 24 Aug 2001 Posts: 25 Location: USA
|
Posted: Thu Jan 10, 2002 7:29 pm |
GREAT ! Works like a charm.
I just wanted to thank LightBulb and Iljhar (and all the others who responded) for their time and zMud experience. :)
thanks again!
Brady |
|
|
|
|
|
|
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
|
|