|
Shattuc Beginner
Joined: 30 May 2007 Posts: 13
|
Posted: Thu May 31, 2007 3:30 pm
yet another trigger question |
I'm trying to shorten my typing as much as possible.
in the game, I type Kill mob, the game echos, You prepare to attack the mob.
I did this,
#trig You prepare to attack the (%w) {#var target %1} (doesn't work if I enter it this way in the command line, have to enter it in the trigger screen)
then during combat all I have to do is type 'stab @target with weapon' and the game echoes ' you prepare to stab mob with sword'
works fine.
where I'm having trouble if the mob has prefixes, ie small mob, dirty brown mob
I type ' kill mob' the game echos 'you prepare to attack the dirty brown mob.'
using the above trigger when I try to stab @target it returns 'cannot find dirty.'
I tried #trig You prepare to attack the (%1 %2 %3) {#var target (%1 %2 %3)} which kinda works, I get 'cannot find (dirty brown mob)'
if I do '#var target %1 %2 %3' it does not set the variable target
what am I missing? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu May 31, 2007 3:38 pm |
Why not just use an alias?
#alias kill {~kill %1;#var target %1}
In answer to your question, though, try using the (*) wildcard in future. The simple answer is that there's no easy way to do it, since your script will never be able to tell which word is the mob's noun.
And the reason your #trig commands didn't work from the command line was because the pattern needs to be in braces too, like this:
#trig {You prepare to attack the (%w)} {#var target %1} |
|
|
|
Shattuc Beginner
Joined: 30 May 2007 Posts: 13
|
Posted: Thu May 31, 2007 3:45 pm |
yes, I think I can use the alias.
and as for which word is the noun it doesn't matter as long as it is flexible to accept just %1 out of %1 %2 %3 or all %1 %2 %3 to set the trigger variable.
and if I set my alias #alias kill {~kill %1 %2 %3;#var target %1 %2 %3} will this work? I think I will run into the same problem. sometimes there are multiple mobs with the same noun, and with my level I definately don't want to attack the wrong one.
tested it, same problem I was having with the trigger, it will only store the first word, not the whole pattern. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu May 31, 2007 4:02 pm |
You'll probably find it easier to use %-1, which represents everything you typed after the alias.
#alias kill {~kill %-1;#var target {%-1}}
The braces around it in the #var command group all the words into the same parameter. The parameters for the #var command go - #var name value defaultvalue class - so if you just do #var target %1 %2 %3 (or just #var target %-1 if %-1 contains three words), zMUD thinks you're trying to set the defaultvalue and the class too. |
|
|
|
Shattuc Beginner
Joined: 30 May 2007 Posts: 13
|
Posted: Thu May 31, 2007 4:23 pm |
ok, so how can I use it in the trigger?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu May 31, 2007 4:31 pm |
The * wildcard matches any number of any character, so to use your previous example:
#trig {You prepare to attack the (*).} {#var target {%1}}
should match the full name. |
|
|
|
Shattuc Beginner
Joined: 30 May 2007 Posts: 13
|
Posted: Thu May 31, 2007 4:35 pm |
AWESOME, Thanks for all your help, eventually I'll grasp all this...
|
|
|
|
|
|