|
Eowyn Apprentice
Joined: 19 Jan 2001 Posts: 117 Location: Norway
|
Posted: 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? |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: 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. |
|
|
|
Eowyn Apprentice
Joined: 19 Jan 2001 Posts: 117 Location: Norway
|
Posted: 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 |
|
|
|
Eowyn Apprentice
Joined: 19 Jan 2001 Posts: 117 Location: Norway
|
Posted: 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.?
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: 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 |
|
|
|
Eowyn Apprentice
Joined: 19 Jan 2001 Posts: 117 Location: Norway
|
Posted: 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}} |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: 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. |
|
|
|
|
|