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


Joined: 10 Jul 2005
Posts: 28

PostPosted: Sat Jul 23, 2005 6:09 pm   

Multiline capture triggering problem
 
Alright, I've been trying to capture things and throw them into a database record. Everything is fine, except for one chunk of it. I've got this:

Appearance:
<appearance of item I need to capture into &Item.Appearance>
Dropped:
<appearance of dropped item I need to capture into &Item.Dropped>
Examined:
<BLAH BLAH BLAH
BLAH
BLAH
Appearance of item when examined. Usually 4+ lines Captured into &Item.Examined
BLAH>
Comments:
<Captured into &Item.Comments. After comments it terminates with a newline.>

So, basically, I've got the trigger word Appearance: then I need to capture up to the word Dropped:. The trigger word Dropped: then capture to trigger word Examined. Trigger word Examined: captured to the trigger word Comments: and then trigger word Comments: captured until newline.

I can't figure out how you'd capture until a trigger word, then use that same trigger word to start the next capture, and so on. I'm really confused about this one, and would love some help. I suck with complicated triggers.

Thanks
Reply with quote
Metho
Beginner


Joined: 10 Jul 2005
Posts: 28

PostPosted: Sun Jul 24, 2005 1:56 am   
 
Ok, maybe I should ask, is this even possible? I've been trying to get it and I seem to just be bashing myself into walls all over.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Jul 24, 2005 2:36 am   
 
Sure its possible, Try posting some ACTUAL mud output between some [ code ] tags [ /code ] and if someone gets a chance they will help you, but noone likes working with error prone <BLAH> format.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Metho
Beginner


Joined: 10 Jul 2005
Posts: 28

PostPosted: Sun Jul 24, 2005 4:36 am   
 
Heh, well, all the spacing was right and such, thought it'd be enough, but I see your point. Here's some actual output.
Code:
Appearance:
a sensual queen-sized bed
Dropped:
A luxurious queen-sized bed towers here.
Examined:
The frame of the bed has been carved from deepest ebony wood, carefully
varnished to bring out the wood grain. It has four sturdy posts carved
into smooth newels, and an arching canopy covered in lush velvet. The
mattress is overstuffed with feathers to make it a full two feet thick,
billowing like a dense cloud. Piled high with plush pillows and covered
in radiant silken sheets, this bed has obviously been created for more
than simply sleeping.
Comments:


Some items have comments, some don't. This one doesn't, but either way, it always ends in a new line.

Thanks
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jul 24, 2005 5:37 pm   
 
Is the Examined output wrapped by the mud or is ZMud handling it? If the mud is wrapping it, can you change the wrap column so that ZMud does the wrapping instead? If so, your solution is a very easy multi-state trigger:

#trigger {Appearance:} {}
#cond {(*)} {Item.Appearance = "%1"}
#cond {Dropped:} {}
#cond {(*)} {Item.Dropped = "%1"}
#cond {Examined:} {}
#cond {(*)} {Item.Examined = "%1"}
#cond {Comments:} {}
#cond {(*)} {Item.Comments = "%1" //this one might not work, unsure off the top of my head if * matches 0 characters}

If Examined is wrapped by the mud and you can't change it, more work is involved:

#trigger {Appearance:} {}
#cond {(*)} {Item.Appearance = "%1"}
#cond {Dropped:} {}
#cond {(*)} {Item.Dropped = "%1"}
#cond {Examined:} {#T+ tExaminedOutput`Item.Examined = ""}

#trigger "tExaminedOutPut" {(*)} {#if ("%1" != "Comments:") {Item.Examined = %concat(@Item.Examined,"%1")} {#T- tExaminedOutput}}

#trigger {Comments:} {}
#cond {(*)} {Item.Comments = "%1"}
_________________
EDIT: I didn't like my old signature
Reply with quote
Metho
Beginner


Joined: 10 Jul 2005
Posts: 28

PostPosted: Sun Jul 24, 2005 7:08 pm   
 
Hey, thanks for the reply. The appearance and dropped work, but I the examined isn't working. The mud controls the length, and I couldn't change that, so I tried your second suggestion, this is the entire code I put into the mud:
Code:

#TRIGGER {You carefully study an artisan design.} {#T+ identify}
#CLASS {identify}
#TRIGGER {Item: &Item.ItemT} {}
#TRIGGER {Type: &Item.Type} {}
#TRIGGER {Org: &Item.Org} {}
#TRIGGER {Outlay: &Item.Comms$} {}
#TRIGGER {Space: &Item.Space} {}
#TRIGGER {Furniture Type: &Item.Furtype} {}
#TRIGGER {Outdoors: &Item.Outdoors} {}
#TRIGGER {Container: &Item.Container} {}
#TRIGGER {Can Have Lock: &Item.Lock} {}
#trigger {Appearance:} {}
#cond {(*)} {Item.Appearance = "%1"}
#cond {Dropped:} {}
#cond {(*)} {Item.Dropped = "%1"}
#cond {Examined:} {#T+ tExaminedOutput`Item.Examined = ""}
#trigger "tExaminedOutPut" {(*)} {#if ("%1" != "Comments:") {Item.Examined = %concat(@Item.Examined,"%1")} {#T- tExaminedOutput}}
#trigger {Comments:} {}
#cond {(*)} {Item.Comments = "%1"}
#TRIGGER {$} {
#T- identify
#DBLOAD crafts
#NEW All @Item
#DBSAVE crafts
#DBCLOSE crafts
#ECHO {Craft added to Database.}
}
#CLASS 0

I looked in the variable item after I ran it, everything exists besides Examined. The other stuff in the code is just for other variables that come before Appearance, dropped, and examined, but those are ok, I think. It's just the examined portion. Any ideas?

Thanks again
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jul 24, 2005 10:37 pm   
 
Looks like I forgot to change a ` (the separator character I use) to a ; (the default separator character).
_________________
EDIT: I didn't like my old signature
Reply with quote
Metho
Beginner


Joined: 10 Jul 2005
Posts: 28

PostPosted: Mon Jul 25, 2005 12:44 am   
 
Yep, that was the little guy that did it. It takes the first line of the examined, but ends after that now. I pulled up the entire script for class identify as zmud has it, does everything here look right for grabbing more than one line of examined?
Code:

#CLASS {identify}
#TRIGGER "tExaminedOutPut" {(*)} {
  #if ("%1" != "Comments:") {Item.Examined = %concat( @Item.Examined, "%1")}
  #T- tExaminedOutput
  } "" {disable}
#TRIGGER {Item: &Item.ItemT} {}
#TRIGGER {Type: &Item.Type} {}
#TRIGGER {Org: &Item.Org} {}
#TRIGGER {Outlay: &Item.Comms$} {}
#TRIGGER {Space: &Item.Space} {}
#TRIGGER {Furniture Type: &Item.Furtype} {}
#TRIGGER {Outdoors: &Item.Outdoors} {}
#TRIGGER {Container: &Item.Container} {}
#TRIGGER {Can Have Lock: &Item.Lock} {}
#TRIGGER {Appearance:} {}
#COND {(*)} {Item.Appearance = "%1"}
#COND {Dropped:} {}
#COND {(*)} {Item.Dropped = "%1"}
#COND {Examined:} {
  #T+ tExaminedOutput
  Item.Examined = ""
  }
#TRIGGER {Comments:} {}
#COND {(*)} {Item.Comments = "%1"}
#TRIGGER {$} {
  #T- identify
  #DBLOAD crafts
  #NEW All @Item
  #DBSAVE crafts
  #DBCLOSE crafts
  #ECHO {Craft added to Database.}
  }
#CLASS 0
Reply with quote
Metho
Beginner


Joined: 10 Jul 2005
Posts: 28

PostPosted: Mon Jul 25, 2005 1:02 am   
 
One more thing. I turned show triggers on, maybe this'll help:
Code:

Appearance:
[Appearance:-> ]
a rickety wooden stool
[(*)-> Item.Appearance = "a rickety wooden stool"]
Dropped:
[Dropped:-> ]
A rickety wooden stool stands here, awaiting a weary traveller.
[(*)-> Item.Dropped = "A rickety wooden stool stands here, awaiting a weary traveller."]
Examined:
[Examined:-> #T+ tExaminedOutput;Item.Examined = ""]
Lacking polish or lustre, this aged wooden stool is pieced together from four
[(*)-> #if ("Lacking polish or lustre, this aged wooden stool is pieced together from four " != "Comments:") {Item.Examined = %concat( @Item.Examined, "Lacking polish or lustre, this aged wooden stool is pieced together from four ")}
#T- tExaminedOutput]
gold hued legs; upon which a top of darker grained wood has been hammered.
Knotted in many places, the quality of wood used in this construction is
seemingly of very poor quality. The seat is split in several places, ensuring
whoever is sitting atop will find little to no comfort.

[$-> #T- identify;#DBLOAD crafts;#NEW All @Item;#DBSAVE crafts;#DBCLOSE crafts;#ECHO {Craft added to Database.}]
Craft added to Database.
Comments:

So all the triggers seem to be firing, but the if check on comments isn't working like it should. Hmm...
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Jul 25, 2005 1:49 am   
 
Change this
#TRIGGER "tExaminedOutPut" {(*)} {
#if ("%1" != "Comments:") {Item.Examined = %concat( @Item.Examined, "%1")}
#T- tExaminedOutput
} "" {disable}

to This

#TRIGGER "tExaminedOutPut" {(*)} {
#if ("%1" != "Comments:") {Item.Examined = %concat( @Item.Examined, "%1")} {#T- tExaminedOutput}
} "" {disable}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Jul 25, 2005 1:49 am   
 
Damn Dbl Post
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Metho
Beginner


Joined: 10 Jul 2005
Posts: 28

PostPosted: Mon Jul 25, 2005 1:59 am   
 
Sweet jeebus it works! Thank you soooo much Matt and Nexela! I would've never figured that one out.
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