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
Chump101
Newbie


Joined: 07 Feb 2006
Posts: 2

PostPosted: Tue Feb 07, 2006 3:44 am   

Capturing multiple lines to list after trig
 
Greetings,

Really I have been searching on this forum for over an hour and I have not been able to locate an answer for this one. I have found some code for sending mutilple lines to a single var but not really what I'm looking for so here's the deal:

Upon entering a room I have a trig which fires to collect the possible exits. now with this same trig I would like to capture the next 5 lines of text and store part of each line into it's own var. So the example is:

In the deep blue sea (n,ne,e,se,s,sw,w,nw).
A long slithering eel
A huge shark
A guppy looking for it's mate
A blowfish swimming in circles
A starfish just sitting here


I have the trig for "In the deep blue sea ~(%dir~) and other code which chooses a direction for later use, but what I need is the remaining code which parse each line for it's subject and store these values in individual vars to be used as targets.

I was using %line but that is limited to the last three lines.

Any ideas?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Feb 07, 2006 4:36 am   
 
You will not be able to directly capture subsequent lines with a trigger. ZMud's entire world ends at the current line, so what you need to do is have that trigger enable another trigger that matches the lines you want:

#noop do not copy the #variable line, as the field/value boundaries do not match up with the = and | used to represent them
#noop use the Settings Editor or the #ADDKEY command as demonstrated in the AddCritters alias to build it manually

#variable vSeaCritters {eel=long slithering eel|shark=huge shark|guppy=guppy looking for it's mate|blowfish=blowfish swimming in circles|starfish=starfish just sitting here}

#trigger {In the deep blue sea...} {...#T+ tSeaCritters}
#condition {prompt line or blank line} {#T- tSeaCritters}

#trigger "tSeaCritters" {%qA ([%x%s])%q} {#loopdb vSeaCritters {#if (%val = "%1") {Target = %additem(%key,@Target)}}}

#alias AddCritters {#if (!%null(%1) and !%null(%2 and !%null(%3))) {#addkey v%1Critters %2 "%-3"} {#say %concat(%ansi(red,bold), "ERROR:", %ansi(default), " Critter data not properly formed", %cr, %ansi(yellow), "ADDCRITTERS ~[type~] ~[keyword~] ~[description ~(can be multiple words~)~]"}}

I made the alias more generic so that you don't have to change it to work with other areas in the MUD.
_________________
EDIT: I didn't like my old signature
Reply with quote
Chump101
Newbie


Joined: 07 Feb 2006
Posts: 2

PostPosted: Tue Feb 07, 2006 7:03 pm   
 
Thanks for your assistance Matt, but I am stumped as to what your script is doing and I cannot for the life of me get it to work. Could you or anyone else walk me through (step by small step) as to how this script works.

I setup a class the trigs and alias as you have specified but to no avail.

I am just not understanding how it works.
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