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
SHASCO
Novice


Joined: 29 May 2001
Posts: 48
Location: USA

PostPosted: Fri Mar 29, 2002 10:28 am   

Achaea pocketbelts
 
I play in Achaea. In this mudd they have pocketbelts that hold herbs for curing and what not. I can probe each belt to see how much of what I have but I have multiple belts on.

What I want to do is be able to probe each pocketbelt which I have added to a variable string and add the qty and description to a database for review.

Here is how it looks.

It bears the distinctive mark of Rurin.
A pocketbelt is holding:
54 myrrh
25 hawthorn
129 bayberry
3 ice
4 cohosh
250 hawthorn
5040h, 5040m cexksdb-
It weighs about 1 pounds and 0 ounce(s).
It bears the distinctive mark of Rurin.
A pocketbelt is holding:
208 lobelia
115 slipper
240 elm
45 echinacea
44 powdered sidewinder skin

Each pocketbelt could contain the same or different items. I want to do a probe #forall on all the pocketbelts, capture the qty and description adding all the same products together for a grand total. Then I could type a command and it would say you have this many of each herb as a total insted of breaking it down by pocketbelt.

Is this possible?

Thank you.

Shasco
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Fri Mar 29, 2002 4:13 pm   
 


#VAR allbelts {redbelt|bluebelt|greenbelt}
#AL probeAll {
#VAR allherbs ""
#VAR beltnum 1
probe %item(@allbelts, @beltnum)
}
#TR {A pocketbelt is holding:} {#T+ herbprobe}
#CLASS {herbprobe}
#TR {^(%d) (*)$} {#ADDKEY allherbs "%2" %eval(%db(@allherbs, "%2") + %1)}
#TR {^%dh, %dm *$} {
#T- herbprobe
#ADD beltnum 1
#IF (@beltnum <= %numitems(@allbelts)) {probe %item(@allbelts, @beltnum)} {show_results}}
} "herbprobe" "prompt"
#CLASS 0
#AL show_results {#LOOPDB @allherbs {#SHOW %val %key}}


Rather than use #FORALL, I used a belt counter (@beltnum) to probe each pocketbelt. This is because the alias and subsequent triggers have to pass control to other triggers to collect the data, before moving on to the next belt. (#FORALL will not wait for the data to be captured.)

Troubadour
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Mar 29, 2002 4:19 pm   
 
Yes, it's possible.

I'd suggest you start by creating a variable for each herb. Then make a herbcounting class to hold the script for this. Make a trigger for each herb to add to its variable. These triggers should go in the herbcounting class so they won't be adding to the variables every time you see a herb laying on the ground, at the store, etc., but only when you are checking your pocketbelts.

Now you need an alias to do the actual check. It should start by setting the herb variables to zero and enabling the herbcounting class. Then have it loop through your stringlist of pocketbelts and probe each one. The triggers should catch the numbers and add them to the variables. After the loop, disable the herbcounting class and display the values of the variables. Sample script:
#CLASS herbcounting
#TR {^(%d) myrrh} {#ADD myrrh %1}
#TR {^(%d) hawthorn} {#ADD hawthorn %1}
#CLASS 0
#AL herbcount {#VAR myrrh 0;#VAR hawthorn 0;#T+ herbcounting;#FORALL @pocketbeltlist {probe %i};#T- herbcounting;#SAY {You have @myrrh myrrh};#SAY {You have @hawthorn hawthorn}}

NOTE: Unless Achaea responds very quickly, this will turn off the herbcounting class and display the totals too soon. You'll probably need to place those actions in another trigger and find some way to tell if you've seen all your pocketbelts before firing it. In the meantime, you could just put those commands in a second alias which you can enter manually after you see that the belts have all been checked.

LightBulb
All scripts untested unless otherwise noted
Reply with quote
razo
Newbie


Joined: 11 May 2002
Posts: 2

PostPosted: Tue Apr 09, 2002 7:57 pm   
 
One thing you could do is make a big series of triggers to adjust the herb/comm variables whenever you inb or outb something - e.g.:
#trigger {You put %d hawthorn berrys into a pocketbelt} {#ad hawthorn %d}


then make an alias that, when fired, does like this:
#alias {pocketbeltlist} {#sh Hawthorn: @hawthorn}

(except, obviously, include everything else with it)

talk to Mirudraas - he's got a nicely working one of these already, and he's normally happy to share :)
Reply with quote
Solaras
Wanderer


Joined: 11 Mar 2002
Posts: 93

PostPosted: Thu Apr 11, 2002 4:17 pm   
 
I play on Achaea as well and I think i have what you want I made it for a fellow Sentinel.

#CLASS {Inventory}
#CLASS {Count Herbs}

#KEY F1 {probe pocketbelt64029;probe pocketbelt12677;probe pocketbelt108028}

#STW {%Ansi(High,Red)PocketBelt:;%Ansi(High,White)Sileris: @Sileris;%Ansi(High,White)Lobelia: @Lobelia;%Ansi(High,White)Goldenseal:@Goldenseal;%Ansi(High,White)Elm: @Elm;%Ansi(High,White)Ginseng: @Ginseng;%Ansi(High,White)Myrrh: @Myrrh;%Ansi(High,White)Valerian: @Valerian;%Ansi(High,White)Moss: @Moss;%Ansi(High,White)Hawthorn: @Hawthorn;%Ansi(High,White)Bayberry: @Bayberry;%Ansi(High,White)Bloodroot: @Bloodroot;%Ansi(High,White)Echinacea: @Echinacea;%Ansi(High,White)Pear: @Pear;%Ansi(High,White)Skullcap: @Skullcap;%Ansi(High,White)Kelp: @Kelp;%Ansi(High,White)Bellwort: @Bellwort;%Ansi(High,White)Ash: @Ash;%Ansi(High,White)Cohosh: @Cohosh}

#CLASS {Inventory}
#TRIGGER {^(%d) sileris} {#Add Sileris %1}
#TRIGGER {^(%d) valerian} {#Add Valerian %1}
#TRIGGER {^(%d) goldenseal} {#Add Goldenseal %1}
#TRIGGER {^(%d) elm} {#Add Elm %1}
#TRIGGER {^(%d) ginseng} {#Add Ginseng %1}
#TRIGGER {^(%d) myrrh} {#Add Myrrh %1}
#TRIGGER {^(%d) lobelia} {#Add Lobelia %1}
#TRIGGER {^(%d) moss} {#Add Moss %1}
#TRIGGER {^(%d) bayberry} {#Add Bayberry %1}
#TRIGGER {^(%d) bloodroot} {#Add Bloodroot %1}
#TRIGGER {^(%d) echinacea} {#Add Echinacea %1}
#TRIGGER {^(%d) hawthorn} {#Add Hawthorn %1}
#TRIGGER {^(%d) pear} {#Add Pear %1}
#TRIGGER {^(%d) skullcap} {#Add Skullcap %1}
#TRIGGER {^(%d) kelp} {#Add Kelp %1}
#TRIGGER {^(%d) bellwort} {#Add Bellwort %1}
#TRIGGER {^(%d) ash} {#Add Ash %1}
#TRIGGER {^(%d) cohosh} {#Add Cohosh %1}

#CLASS {Count Herbs}
#ONINPUT {probe pocketbelt64029;probe pocketbelt12677;probe pocketbelt108028} {Sileris = 0;Lobelia = 0;Goldenseal = 0;Elm = 0;Ginseng = 0;Myrrh = 0;Valerian = 0;Moss = 0;Hawthorn = 0;Bayberry = 0;Bloodroot = 0;Echinacea = 0;#T+ Inventory;#WAIT 5000;#T- Inventory}

Its pretty brutish, but it works. The only thing you need to do is alter the pocketbelts to mach your id numbers, add extra belts if you have any, and in the STW setting add any extra herbs to the list that you may have that are not on here.

Then what it does is when you hit the hotkey, it restes your counters to 0, probes all your belts and makes variables for each herb, then displays them all pretty in a status window for you.

If anyone sees a better way to do this please point it out, I am hardly an expert at this :)
Reply with quote
razo
Newbie


Joined: 11 May 2002
Posts: 2

PostPosted: Thu Apr 11, 2002 6:05 pm   
 
I like my way a bit more, as it's more intuitive, if a bit longer. :)

The problem with my way that yours compensates for is if you use something other than zmud (*GASP*), or turn off triggers for whatever reason, and outb or inb something, the change won't be reflected unless you go in and do it yourself.

I still like my way more though :p
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