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


Joined: 29 Jul 2002
Posts: 105

PostPosted: Tue Sep 28, 2004 7:47 pm   

Making Triggers from an Alias
 
I need to make an alias that creates a trigger. For the most part I have this succede, but I am having one major flaw. The trigger can't use the %1->%99 in the return. Let me show you.
***These are just examples of the problem, and do not show the whole alias/trigger, just the problem I am having with it.
#alias triggermaker {#trigger {(%w) gives you (%n) coins.} {#var niceguy {%1};#var goldamount {%2}}
This works fairly well except it makes the trigger as...

#trigger {(%w) gives you (%n) coins.} {#var niceguy {};#var goldamount {}}

So it just resets the variables when the trigger fires.
I tried using ~'s, {}'s, and ""'s but none seem to work in any combination that I could come up with. Any suggestions, comments, or ideas?

Thanks in advance
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Sep 28, 2004 7:58 pm   
 
Try:

#alias triggermaker {#trigger {(%w) gives you (%n) coins.} {#var niceguy {%%1};#var goldamount {%%2}}}
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Tue Sep 28, 2004 8:28 pm   
 
I still ended up with blank parts when the trigger has been made.
#var niceguy {}
#var goldamount {}
BUT on the good side it no longer gives me the %1 and %2 as though it were entered into the alias
Aka if
Triggermaker hi bye
They no longer come out as
#var niceguy {hi}
#var goldamount {bye}
It works as the alias/trigger you set up.. but.. my version does not.
which makes me wonder about my overall alias... (it's all inside a double nested if statement) I'll look into it.. thank you. I may have to post the whole thing if it comes down to it.
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Tue Sep 28, 2004 8:42 pm   
 
Yeah... I got rid of the if's... and it worked.. kinda annoying not having the iffs.. but I guess I can deal
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Sep 29, 2004 1:23 am   
 
You can simply add more percents until it works. Basically 1 is stripped for each set of braces that is worked on by the script. So in TonDiening's answer:
#alias triggermaker {#trigger {(%w) gives you (%n) coins.} {#var niceguy {{%%1};#var goldamount {{%%%2}}}
The red ones are the only ones the script expanded to work the rest were processed literally as part of the #TRIGGER command. Only one point of delayed expansion.
#alias triggermaker {#IF (@badguy="Vijilante") {#trigger {(%w) gives you (%n) coins.} {#var niceguy {%%%1};#var goldamount {%%%2}}}}
Now we have 2 sets that get expanded during script processing so have to make it 2 points of delayed expansion. This can be very confusing when you use the pattern matching operator =~ in the #IF expression. If you still have trouble please just post the whole alias.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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