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
tejing
Wanderer


Joined: 21 Dec 2001
Posts: 59
Location: USA

PostPosted: Tue Mar 04, 2003 2:57 am   

inventory tree
 
I want to hold what's in my inventory in zmud so that i can use it in scripts. but i want to get everything in my inventory (ie. things in a backpack in my inventory or things in a pouch which is in a backpack which is in my inventory) and I want to know that path in the different containers I should take.

Here's some sample MUD output:

HP:126 EP:140> inventory
Gold: 215 Encumbrance: unencumbered
You are carrying the following on your person:
A Dol Amroth pack (closed) (worn).
A sapphire staff (emitting light) (wielded).
Rank insignia.
A large, empty dragonclaw pipe.
A message stone.
A spellbook.
HP:126 EP:140> open pack
You open a Dol Amroth pack.
HP:127 EP:140> look in pack
You don't see anything inside.
HP:127 EP:140> close pack
You close a Dol Amroth pack.
HP:127 EP:140>
**********************************************
inventory
Gold: 215 Encumbrance: unencumbered
You are carrying the following on your person:
A Dol Amroth pack (open) (worn).
A sapphire staff (wielded).
Rank insignia.
A large, empty dragonclaw pipe.
A message stone.
A spellbook.
HP:140 EP:140> look in pack
Pack contains:
A torch (burned out)

HP:140 EP:140>
***************************************************
HP:140 EP:140> inventory
Gold: 191 Encumbrance: unencumbered
You are carrying the following on your person:
A Dol Amroth pack (open) (worn).
A sapphire staff (wielded).
Rank insignia.
A large, empty dragonclaw pipe.
A message stone.
A spellbook.
HP:140 EP:140> look in pack
Pack contains:
A backpack
A torch (burned out)

HP:140 EP:140> look in pack on pack
You don't see anything inside.
HP:140 EP:140>
*****************************************
HP:140 EP:140> inventory
Gold: 191 Encumbrance: unencumbered
You are carrying the following on your person:
A Dol Amroth pack (closed) (worn).
A sapphire staff (wielded).
Rank insignia.
A large, empty dragonclaw pipe.
A message stone.
A spellbook.
HP:140 EP:140> open pack
You open a Dol Amroth pack.
HP:140 EP:140> look in pack
Pack contains:
A backpack

HP:140 EP:140> look in pack in pack
Pack contains:
A torch (burned out)

HP:140 EP:140> close pack
You close a Dol Amroth pack.
HP:140 EP:140>

Ok so it was a lot of mud output, buti think it got the point across. i need to store this info so that other scripts can use it. I thought i could sort of do a stringlist type of thing but i'm stuck beyond that.

Tejing
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Tue Mar 04, 2003 5:16 pm   
 
#TRIGGER InvTrig {You are carrying the following on your person:} {#VAR Inv "";#TEMP {^HP~:%d} {#STATE InvTrig 0}}
#COND {} {#ADDITEM Inv %line} {LoopLines|Param=99}

should do the trick for just your inventory. if you want to capture things in containers, use the same commands, but change the name of the trigger (InvTrig) and change the pattern to, maybe, "%w contains" but beware this might capture information if you look into something you aren't carrying.

--------

moon.icebound.net:9000
Reply with quote
tejing
Wanderer


Joined: 21 Dec 2001
Posts: 59
Location: USA

PostPosted: Wed Mar 05, 2003 4:23 am   
 
well, the problem is that I don't know what container' I'll be carrying, and I don't want to make stringlists just sitting around ofr ll the different containers I ever use. I want to use a single setting (if possible) to hold all the items in anything in my inventory, even the ones in containers, but also preserve the info on what container they're in.

I'm thinking maybe I can make a string which for my final example would contain:

"A Dol Amroth pack (closed) (worn).{A backpack{A torch (burned out)}},A sapphire staff (wielded).,Rank insignia.,A large, empty dragonclaw pipe.,A message stone.,A spellbook."

but i'm still not sure how to setup that string

Tejing
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Wed Mar 05, 2003 4:22 pm   
 
quote:

HP:140 EP:140> look in pack
Pack contains:
A backpack

HP:140 EP:140> look in pack in pack
Pack contains:
A torch (burned out)



since there is nothing in these lines which would seperate a pack in your inventory from a pack on the ground, you have to somehow, through your actions, distinguish them. you write an alias that you use to look into items in your inventory, and this alias would turn the triggers on and off.

#alias lookin {
#t+ contcapture
look in %1
#wait
#t- contcapture
}
#class contcapture
#tr {(%w) contains:} {#var cont "";#addkey cont name %1}
#tr {(*)} {#additem cont.contents %1}
#tr {^HP~:%d} {#t- contcapture; #additem mycontainers @cont}
#class 0

This should give you a string list of database variables, each with keys "name" the name of the container, and "contents" a string list of its contents.

--------

moon.icebound.net:9000
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Thu Mar 06, 2003 1:25 pm   
 
You could also do temp trig (my favorite)

#TRIGGER {^(*)>inventory} {#temp {(*) (%W) {~(open|closed~)} ~(worn~).} {#temp {you open (*) (%W).} {#temp {^(*).} {#addi invhold "%1"}look in %2}}}

the @invhold should catch all the stuff inside what ever can be opened or closed in you inventory.
Have not tested this but good luck.
It is just an idea.

Most likely yours will have to beable to catch multipul lines and relate them all to a single item your have (worn)to do this you might have to get creative!! {:)}

good luck !!

megamog75
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