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
Eowyn
Apprentice


Joined: 19 Jan 2001
Posts: 117
Location: Norway

PostPosted: Thu Jul 04, 2002 8:01 pm   

Sending whole lines without capturing them.
 
I'm working on a grouptell alias, but I don't know how to send out more than the first word when I haven't captured the whole line I want to capture beforehand.
This is a simplified version of the alias:

#alias tellall {#EXEC tell friends Grouptell: %1}

If I have a trigger like this:
#trigger {Friend tells you (*)} {say Repeating: %1}
I will repeat whatever my friend says. Is there any way to get more than the first word grouptelled when there's no (*) capturing first?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu Jul 04, 2002 8:06 pm   
 
Aliases require the use of %-1 to grab
all the parameters from the frist to the
last. Simularily %-2 would grab the second
parameter to the last, leaving %1` for the
first parameter.

Triggers you explicitely specifiy with the
brackets the %1 so that works.

Try
#alias tellall {#EXEC tell friends Grouptell: %-1}



Ton Diening
Providing untested answers that tend to be
more complicated than others.
Reply with quote
Eowyn
Apprentice


Joined: 19 Jan 2001
Posts: 117
Location: Norway

PostPosted: Thu Jul 04, 2002 8:22 pm   
 
That works. Thank you! :)

Just out of curiosity. Is it possible to somehow divide the line captured in %-1 into segments?

Example:
Tellall Green apples red tomatoes yellow plums

Is it possible to somehow divide this tell into x segments and put them into variables?
Ex. 3 segments where
segment 1 = Green apples
segment 2 = red tomatoes
segment 3 = yellow plums
Reply with quote
Eowyn
Apprentice


Joined: 19 Jan 2001
Posts: 117
Location: Norway

PostPosted: Thu Jul 04, 2002 8:40 pm   
 
I think %-1 %-3 etc. could be used, but how do I limit the first part to first+second parameter, next part to third+fourth etc.?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Jul 04, 2002 9:10 pm   
 
You can also use %1, %2, etc. So it would be
segment1 = %concat(%1, " ", %2)
segment2 = %concat(%3, " ", %4)
segment3 = %concat(%5, " ", %6)

Also, you can always sends a string to an alias as a single argument by enclosing it in double quotes:
Tellall "Green apples" "red tomatoes" "yellow plums"

segment1 = %1
segment2 = %2
segment3 = %3

Kjata
Reply with quote
Eowyn
Apprentice


Joined: 19 Jan 2001
Posts: 117
Location: Norway

PostPosted: Thu Jul 04, 2002 11:45 pm   
 
Perfect. Thanks :)

One last question and I believe I'm done.
The following trigger don't work because I use two wildcards(?) - both (%w) and (*). How can I make it work..?

#trigger {^(%w) orders you to '(*)'} {#if %ismember( %1, @friends) {#EXEC %-2}}
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jul 05, 2002 1:36 am   
 
As this is a trigger not an alias you can
use %1 for the first bracket'd thing
and %2 for the second bracket'd thing.

#trigger {^(%w) orders you to '(*)'} {#if %ismember( %1, @friends) {#EXEC %2}}

Off the top of my head the ismemeber check
is case sensitive, be wary how the list in
varible friends is setup.


Ton Diening
Providing untested answers that tend to be
more complicated than others.
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