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
Tolpan
Beginner


Joined: 07 Nov 2000
Posts: 23
Location: Germany

PostPosted: Sun Nov 25, 2001 1:23 pm   

Triggers defining Triggers problem
 
Its quite easy to define a trigger or temp within a trigger.
However I have a problem with the substitution of %1

like:
trigger {^(%x*) tells you: } {
#cap tells
#gag
#trigger {^%x} {
#win debug %1
}
}

when someone tells me, this text will be captured to the "tells" window
and gagged from the mud output, after that a trigger will be defined
(later on that will get a TEMP trigger so it only shoots once and vanishes)
that writes some output to a debug window when a new mudinput occures that
is has no whitespace as first char.

The effect now is, that %1 is evaluated already within the outer trigger,
so the definition of the new trigger looks like

#trigger {^%x} {#win debug Tolpan}

when the tell came from Tolpan. However I want the trigger to look like

#trigger {^%x} {#win debug %1}

How can I escape a %* substitution? I have already tried to define the
inner trigger with ~%1 ~~%1 "%1" %%1 ~%%1~~%%1 %1 but nothing seems
to work. %1 gets evaluated in any combination so the inner trigger
will be always defined as ~Tolpan or ~~Tolpan "Tolpan" aso...

Any hint on this??

}
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Sun Nov 25, 2001 5:04 pm   
 
%1 will only be evaluated from a wilcard between (). So if you want to avoid the first trigger as the target of the %1, then just delete those () in it. Then put them in the second trigger to use that as target for %1.

#TRIGGER {^%x* tells you: } {
#CAPTURE tells
#GAG
#TRIGGER {^(%x)} {
#WIN debug %1}
}

Not certain, but I think this should work...

Acaila
Reply with quote
Tolpan
Beginner


Joined: 07 Nov 2000
Posts: 23
Location: Germany

PostPosted: Sun Nov 25, 2001 7:31 pm   
 
Actually you are right! I missed the brackets in the inner trigger
and without them, all my effords dont make any sense.
However, I stripped some code from my original code to make it easier
to read. The brackets of the outside trigger are needeed, since I use
the %1 within an #if case before the #cap line.

So my complete problem looks more like this:

trigger {^(%x*) tells you: } {
#if (%ismember(%1, @friendlist)) {
#cap tells
#gag
;trouble starts below, where %1 will be substituted by the %1 value
;of the outer trigger
#temp {^(%x*)} {#win debug %1}
}
}
; the trigger kicks on lines like "Foobar tells you: something" and
; if "Foobar" is member on my friendlist, the tell is captured to
; my "tells" optional window and with #gag it's deleted from
; the mud output.
; The temp definition is needed later, to get the first line that
; starts again with a non whitespace in the first position since tells
; can look like:
; Foobar tells you: a lot of text .....
; which wraps around to the next line...
; and maybe even a third line...
; When output starts at the first position however, I can be sure the
; tell is over.

I use the new state triggers to solve this problem, but the termination
state doesnt seem to work correctly so I was trying to print the output
that triggered the termination trigger (actually this is the #temp
statement in the above script)

so thats the full background of this problem...
----

The idea with simply leaving away the brackets in the outer trigger
doesnt work too. Doing that, the inner trigger will be defined as

#trigger {^(%x*)} {#win debug }

so you see the %1 vanishes in any case. I think we need some feature
to escape the substitution. Usually this should be possible with
tilde (~) but it seems that is true only for the trigger pattern and
not in the body of the trigger.

Zugg? Can you proof me wrong here?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Nov 26, 2001 7:44 pm   
 
zMUD will strip one % each time it parses the statement, so you need 2 %'s.

trigger {^(%x*) tells you: } {
#cap tells
#gag
#trigger {^%x} {
#win debug %%1
}
}

This is already mentioned in the helpfile somewhere.

LightBulb
Reply with quote
Tolpan
Beginner


Joined: 07 Nov 2000
Posts: 23
Location: Germany

PostPosted: Mon Nov 26, 2001 9:34 pm   
 
as I stated in the original posting, I have already tried %%1 because I have read similar in the help.

But getting this advice I have tried some more into the problem and
just found out that three % work.
#win debug %%%1 was evaluated to #win debug %1
#win debug %%1 was evaluated to #win debug

Zugg, is that a bug of the 6.22 or is that the new style of > 6.20 ?
Reply with quote
Darker
GURU


Joined: 24 Sep 2000
Posts: 1237
Location: USA

PostPosted: Tue Nov 27, 2001 3:29 pm   
 
This belongs in the Beta Forum, if you're using the Beta version.



zMUD 6 Online Help: All the power you'll ever need.
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