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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
gmueller
Apprentice


Joined: 06 Apr 2004
Posts: 173

PostPosted: Tue Jun 19, 2007 1:47 am   

<> [] question
 
ok I know how I would have done this, but I dunno anymore...

if someone could help I'd be appreciative.

I'm trying to make a trigger that creates triggers. basically I'm lazy. I want to go into a spar and have the system create triggers for all the text on the screen. More than that though, I need to figure out how to force an expansion in CMUD, since the language has no <> [] operators.

I created these thru the editor so I dunno what options they have formally but here goes:
Code:
#VAR prompt_num {0} {0}
#VAR line_number {0} {0}


priority is manually set to 0, and trigger on prompt:

Code:
#REGEX {^H:(\d+) M:(\d+) E:(\d+) W:(\d+) B:(\d+)% \[(c)?(s)?(p)?(d)?(b)?(a)?(f)?(@)? ?(-|e)(-|b)]$} {prompt_number = @prompt_number + 1;#IF (@prompt_number > 100) {prompt_number = 0}}


Code:
#TRIGGER {*} {
#IF (@line_number <= @prompt_number) {
  #TRIGGER {%line} {} "unassigned"
  line_number = @prompt_number + 1
}
}

this will create a new trigger but the pattern will be %line

how do I get it to expand %line?

I've tried (%line) as per the cmud documentation. that didn't work.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Tue Jun 19, 2007 2:58 am   
 
Try using expand.
something like:
Code:
#TRIGGER {*} {
#IF (@line_number <= @prompt_number) {
  #exec %expand("#TRIGGER {%line} {} 'unassigned'",1)
  line_number = @prompt_number + 1
}
}
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Jun 19, 2007 10:11 am   
 
Take a look at this help file. The prescribed way of doing something like this is to assign %line to a local variable and then use the local variable instead. You need to be very careful when using #trig like this though - if you're not including an ID, you need to surround both arguments with braces {}.

#trig $line $cmd

will make a trigger with the ID $line and the pattern $cmd.

#trig {$line} {$cmd}

is probably what you want.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
gmueller
Apprentice


Joined: 06 Apr 2004
Posts: 173

PostPosted: Tue Jun 19, 2007 7:38 pm   
 
thanks so much, I had read this before but could have sworn it said that all you need to do is enclose it in a () and it'll expand...
:)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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