Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Shattuc
Beginner


Joined: 30 May 2007
Posts: 13

PostPosted: 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?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Shattuc
Beginner


Joined: 30 May 2007
Posts: 13

PostPosted: 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.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Shattuc
Beginner


Joined: 30 May 2007
Posts: 13

PostPosted: Thu May 31, 2007 4:23 pm   
 
ok, so how can I use it in the trigger?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Shattuc
Beginner


Joined: 30 May 2007
Posts: 13

PostPosted: Thu May 31, 2007 4:35 pm   
 
AWESOME, Thanks for all your help, eventually I'll grasp all this...
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net