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


Joined: 22 Jan 2003
Posts: 11
Location: United Kingdom

PostPosted: Thu Apr 24, 2003 9:07 am   

Colour Trigger - Easy one
 
Hello

I'm trying to put info from text files into a mud-command database using the zmud editor. The only way to differentiate this info from everything else in the text file is the colour of the text.

(Blank line)
First line of text (white on black) - command name
(Always only one line of white on black)
next line (green on black) - description
next line (green on black) - description
(there can be many lines of green on black)
Last lines (col - yellow on black) - links
(there can be 1, 2 or 3 lines of yellow on black)
(blank line.)


Can someone write me a trigger that will put this in a database under the fields Commands, Description and Links (the database is set up)

Many thanks

Turnip
Reply with quote
Turnip
Beginner


Joined: 22 Jan 2003
Posts: 11
Location: United Kingdom

PostPosted: Thu Apr 24, 2003 7:28 pm   
 
hi again,

So far i have this

#TRIGGER "Captrig" {(*)} {#var data %null;#var description %null;#addkey data command {%1};#addkey data syntax {%1};#addkey data short name {%1};#temp {^$} {#new all @data;#sh @data;#state captrig 0}} "" {color|line=15}
#COND "Captrig" {(*)} {#additem description {%1}} {looplines|param=99|color|line=2}
#COND "Captrig" {see also:(*)} {#addkey data definition @description;#addkey data links {%1}} {looplines|param=99|color|line=14}

What am I doing wrong?

Thanks in advance

Turnip
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 25, 2003 12:09 am   
 
#TRIGGER "Captrig" {(*)} {#var data %null;#var description %null;#addkey data command {%1};#addkey data syntax {%1};#addkey data short name {%1};#temp {^$} {#new all @data;#sh @data;#state captrig 0}} "" {color|line=15}
State 0: Line 1
This will set up a temporary trigger to reset the trigger to this state (state 0) when the next blank line is received.

#COND "Captrig" {(*)} {#additem description {%1}} {looplines|param=99|color|line=2}
State 1: Lines 2-100
This will check the trigger pattern against the next 99 lines and then move to the next trigger state (state 2). It will not move on to the next state until all 99 lines have been received. Most of these 99 lines will match the trigger and will therefore be added to the variable. If a blank line arrives, the #TEMP trigger will reset the trigger to the original state early.

#COND "Captrig" {see also:(*)} {#addkey data definition @description;#addkey data links {%1}} {looplines|param=99|color|line=14}
State 2: Lines 101-199
This one will check the next 99 lines after the previous state (state 1) is finished, if the trigger hasn't been reset by the #TEMP trigger. After all 99 lines are received, the trigger will be reset to state 0 regardless of whether any matched the pattern in this state. If a blank line is received, the #TEMP trigger will override and reset the trigger early.

I don't think most of your descriptions will take exactly 99 lines. In most cases, you'll probably get the "see also" text long before state 2 is active.

Recommendations: Replace state 2 with a #TRIGGER of its own. Move the #TEMP trigger from State 0 to the new trigger.

LightBulb
Advanced Member
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