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


Joined: 23 Jun 2006
Posts: 20

PostPosted: Fri Jun 23, 2006 12:11 pm   

quick inventory parsing
 
So I apologize if this question has been hashed and rehashed on these forums, but I couldn't find anything relevant under the search. Feel free to point me to a post that already answers this question.

I need a good way to identify pills/potions/scrolls/etc in my inventory or as I pick them up. What I'd like to see is:

inv
You are carrying:
a red pill (cure light wounds)
a vellum scroll (fireball)

and so on...

I've had some difficulty with the trigger to accomplish this, and I'd particularly like to do it with the list as a database record with keys of item names, and values of item functions.

Any help would be greatly appreciated.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Fri Jun 23, 2006 3:38 pm   
 
We'd be glad to help.

You have shown us a very small snippet of "what you'd like to see", and you have suggested that a trigger is the correct scripting element to accomplish this - presumably to create and add to a db record variable.

We don't know what it is you do see. Without more information, any help will be very general and virtually a reposting of the help file.

Some possible forum posts to help:
http://forums.zuggsoft.com/phpbb/viewtopic.php?p=43718#43718
http://forums.zuggsoft.com/phpbb/viewtopic.php?p=82480#82480
http://forums.zuggsoft.com/phpbb/viewtopic.php?p=79104#79104
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Fri Jun 23, 2006 3:49 pm   
 
Kent,
I'll take a long shot that what he DOES see is:
inv
You are carrying:
a red pill
a vellum scroll

since he said that he wants to see:
inv
You are carrying:
a red pill (cure light wounds)
a vellum scroll (fireball)

I feel the () is the ADDED info that he wants.
_________________
http://www.Aardwolf.com
Reply with quote
zogalogran
Beginner


Joined: 23 Jun 2006
Posts: 20

PostPosted: Fri Jun 23, 2006 3:59 pm   
 
Vitae is correct.

My objective is to have a data set consisting of key value pairs.

Key = item name
Value = item function

Triggers would presumably be used to parse MUD output for the item keys, and then output the value in () at the end of the same line.

Thanks in advance.
Reply with quote
zogalogran
Beginner


Joined: 23 Jun 2006
Posts: 20

PostPosted: Fri Jun 23, 2006 4:01 pm   
 
Oh, and to further addend -

I'm less concerned about parsing the names/functions into a dataset than I am with spitting them back out. The items I'm interested in doing this with I'd have no problem inputting the data manually.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Fri Jun 23, 2006 5:11 pm   
 
Oh, I see.
So just something like:

#VAR magic_items
#ADDKEY magic_items {"a red pill"="cure light wounds"|"a vellum scroll"=fireball}
#TRIGGER {({@magic_items})} {#VAR tempvar {%1};#GAG;#SHOW @tempvar ~(%db( @magic_items, @tempvar)~)}

Is that what you needed?
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Fri Jun 23, 2006 6:29 pm   
 
here is what i use for scrolls. This might help you. Please keep in mind i havent done any converting on this script yet.
so it will work for zmud but i havent tested cmud.

Code:

#CLASS {MMSystem|Displays|Scrolls}
#VAR ScrollEchoColor {high, yellow}
#VAR Scrolls {an enchanted crimson-colored|a leopard skin|an icy silver|an unpleasant pink|a soggy, yellow-green|an enchanted emerald|a glossy lime|a frozen cherry colored|a damp white|an amber scroll made of cowhide|an off-white|a dirty ebony|a soggy blue|a teal rawhide|a silk magenta|a mauve colored cowhide|a cobalt blue|a ripped olive|a lustrous jade green|a llama hide|an indigo papyrus|a thick lambskin|an ebony cotton|an ebony colored icy|a copper-colored|a soiled red|a soggy cobalt|an indigo|a glazed crystal|a luminescent mother-of-pearl|a glowing powder blue|a midnight-blue|a shimmering|a mauve|a faded green|a yellow cotton|a gold-leafed papyrus|a blue colored sable|a jet black cowhide|a glazed pink|a powder blue buckskin|an ivory|a verdant colored papyrus|a smelly metallic|a shimmering saffron|a transluscent amber|a silvery rawhide|an unpleasant-smelling silver|a beige|a glazed charcoal|a glossy yellow-green|a soiled blue|a transluscent|an icy azure|a moldy green|a tattered transparent|a dirty white|a shining fuchsia|an ecru spell scroll|a shimmering sapphire|a dragon hide|a brilliant sky-colored|a frosted translucent|a moth-eaten|a milky-white glowing|a weathered|a rose-colored cotton|a bronze-colored|a platinum-colored|a mystical ivory|an opalescent|a thin lambskin|a navy blue|a bewitching cerulean|a mandarin orange|a bewitching purple|a luminescent silver|a lime-green|a translucent azure|a wrinkled gold|a swamp green|a brilliant amethyst|a crimson|a smeared green|a torn sandy|a shimmering crystalline|a burnt-sienna|a rattleskin|a sterling silver|an immaculate violet|a transluscent mother-of-pearl|a charcoal lambskin|a greasy aqua|a shining quartz|a moldy yellow|an enchanted vellum|a lightning blue|a smoky transparent|an antique ivory|a didactic|an enchanted onionskin|a gaudy granite|a charred cobalt|a wrinkled-gold|a brown scroll smelling of dung|a mildewed magenta|a musty black|a tainted teal|a glowing sorcerous|a faded antique|a dirty brown|an antique copper|an enchanted platinum|a smudged sticky|a thick parchment|a textured indigo|a tightly-wound|an inky blue|an ivory-yellow papyrus|a glazed coal-black|a translucent amber|a chilled transluscent|a spotted melanic|a waxen kalamkari|a dark maroon|a waxen hodden|a pink cordovan|a glowing crystalline|a glowing mother-of-pearl|a kente|a niveous lambskin|a sorcerous glowing}
#VAR Spells {abjure|antimagic sphere|acid blast|animate dead|bless|awaken|armor|blink|call lightning|calm|cure light|light|chain lightning|change sex|charm|cause serious|chill touch|circle of fire|color spray|combat blink|control wheather|control winds|counterspell|create food|identify|fireball|create spring|create water|cure blindness|cure critical|cure disease|cause light|cure poison|cure serious|curse|death grip|detect alignment|detect illusion|detect invisibility|detect magic|dispel area|dispel magic|energy drain|enervation|enhanced strength|erase|faerie fire|farsight|find familiar|flame wind|frost|cause critical|gate travel|glamour|great shout|hands of wind|harm|haste|fountain|heal|icebolt|ice storm|ice whip|imprint aura|improved invisibility|infravision|invisibility|kill|levitation|lightning bolt|magic bomb|magic carpet|magic dart|magic lock|magic map|magic unlock|momentary darkness|nexus|pass door|paralyze|plague|plane travel|poison|poison gas|protection from evil|protection from good|recharge item|reflective fireball|refresh|remove curse|resurrect|reveal|room shield|sanctuary|sense-life|shield|shocking grasp|sleep|slow|spark|spell shield|stone skin|summon|summon creature|summon mount|summon elemental|swarm|teleport|thunderstorm|thunder clap|tremor|underwater breathing|warp|web|wizard eye|word of recall|weaken|silence|blindness|flame wind|erase|iceball|evil eye|shadow armor|malediction|shadow golem|insanity|reanimate|sanctify|jinx|augment aura|thunderstorm}
#TRIGGER {({@Scrolls}){ scroll | }~(new~)$} {#SUB {%1 scroll ~(%ansi( %eval( @ScrollEchoColor))%item( @Spells, %ismember( "%1", @Scrolls))%ansi( def)~)}} "" {notrig}
#TRIGGER {(*)~) ({@Scrolls}) scroll (*) ~[(*)~]} {#SUB {""%1%ansi(bold,blue)~)%ansi(bold,green) %2 scroll %ansi(green)%3 %ansi(bold,blue)~[%ansi(green)%4%ansi(bold,blue)~]%ansi(green)~(%ansi( %eval( @ScrollEchoColor))%item( @Spells, %ismember( %lower(%2), @Scrolls))%ansi( def)~)}}
#CLASS 0
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
zogalogran
Beginner


Joined: 23 Jun 2006
Posts: 20

PostPosted: Fri Jun 23, 2006 6:59 pm   
 
Very sweet - thanks to Kent and edb6377. I'm sure I can find a solution somewhere between these two answers and the help files.
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