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


Joined: 30 Dec 2001
Posts: 4
Location: USA

PostPosted: Mon Dec 31, 2001 4:25 am   

Text Parsing/Recognition
 
Greets everybody,

I was wondering if it is possible to parse a single line of text from the mud and extract a value and put it into a variable for me.

The text is below:
Name: [A Glowing Ball, engraved with A Silver Raven and two swords above its Head.]
Area: [ 148] Shadow Guild Area
Vnum: [24300]
Type: [light]
Level: [ 1]
Wear flags: [take hold]
Extra flags: [glow dark evil]
Guild: [darkwarder]
Material: [soft metal] <-----
Condition: [ 100]
Weight: [ 8]
Cost: [ 400]
Short desc: A Glowing Ball, engraved with a Silver Raven and two swords above its head
Long desc:
This glowing ball is engraved with a Silver Raven and Two Swords above its head.
Number Modifier Affects
------ -------- -------
[ 0] 5 damroll
[v2] Light: [2]
--------------------------

I need to parse the line with the arrow next to it out so that I can take the text inside the []s out and put it into a variable. Ultimately I would like to have Material [*] and match that text and then have material=%1 and store that so I can edit and have the material placed back as it was.

Thanks in advance


-NeoWulf
Reply with quote
Toetag
Magician


Joined: 10 Oct 2000
Posts: 356
Location: USA

PostPosted: Mon Dec 31, 2001 4:40 am   
 
make a trigger:
Material: [*]

Command:
#VAR material %1


Unless I'm missing something in your post.


Killing a fly on a friends forhead may not be overkill, use a hatchet to make sure the job is done.
Reply with quote
NeoWulf01
Newbie


Joined: 30 Dec 2001
Posts: 4
Location: USA

PostPosted: Mon Dec 31, 2001 5:44 am   
 
Ok, I just tried that and ZMud triggers don't recognize the brackets []s. I've tried using the wildcards * and ? but those are only for alphanumerics.

-NeoWulf
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Dec 31, 2001 7:30 am   
 
quote:

Ok, I just tried that and ZMud triggers don't recognize the brackets []s. I've tried using the wildcards * and ? but those are only for alphanumerics.

-NeoWulf



#trigger {Material: ~[(*)~]} {#noop do your stuff here}

Notice the tildes (~) preceding the brackets, they tell zmud to treat them as normal text characters and not as the special-function symbols ZMud uses.


li'l shmoe of Dragon's Gate MUD
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Dec 31, 2001 2:09 pm   
 
#TR {^Material: ~[(*)~]} {material = %1}

LightBulb
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jan 01, 2002 6:44 pm   
 
Since you might have more than one word for Material, as in your example, better put quotes or braces around %1 in the variable command.

#TR {^Material: ~[(*)~]} {material = "%1"}

LightBulb
Reply with quote
NeoWulf01
Newbie


Joined: 30 Dec 2001
Posts: 4
Location: USA

PostPosted: Tue Jan 01, 2002 8:22 pm   
 
Thank you all very much! The trigger is working like a charm.

-NeoWulf
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