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


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Mon May 15, 2006 7:10 pm   

Vial Sorting
 
Ok, I tried to scrounge the forums for even the slightest hint on where to begin for what I want to do. Here is a snip of the output from Imperian I want to gather my data from

Code:

Vial           Elixir                           Sips        Months Left
-----------------------------------------------------------------------
vial20972      the toxin calotropis             19          151
vial24569      the toxin bromine                44          181
vial26939      the toxin iodine                 48          208
vial28334      the toxin strychnine             35          218
vial31561      an elixir of mana                6           203
vial37431      a salve of mending               19          282
vial47840      an elixir of frost               52          177
vial67066      the toxin strychnine             47          215
vial75427      an elixir of mana                25          188
vial92067      an epidermal salve               43          177
vial99246      a salve of mending               1           229
vial100187     a salve of mending               1           261
vial104282     an elixir of speed               45          206
vial115481     a salve of restoration           37          203
vial121255     the toxin ether                  50          197
vial122282     an elixir of mana                60          203
vial146202     an epidermal salve               58          182
vial172979     the toxin oxalis                 46          126
H:239 M:297 E:1095 W:1439 <eb>


What I want to do is take all that from elixlist and have an output such as:

Code:

Toxins:
Ether: 1
Oxalis: 1
Strychnine: 2
Iodine: 1
Bromine: 1
Calotropis: 1

Exlixers and Salves:
Health:  0
Mana: 3
Epidermal:  2
Mending: 3
Restoration: 1
Speed:  1
Frost:  1
Caloric:  0
Venom: 0
Levitation:  0

Empties: 0


I used to have something that did this before but i can't find it and when I did do the script it was about 2 yrs ago and I haven't really coded much since then.

I'd also like it to add up the sips for each record.
Any and all help would be greatly appreciated.
_________________
When in doubt,
Blow it up.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Mon May 15, 2006 9:56 pm   
 
Try something like this. Not tested written off the top of my head but it should be pretty close

Code:

#CLASS {ZUGGTEST} {enable}
#TRIGGER {^Vial%sElixir%sSips%sMonths Left} {#RESET vialcount}
#CONDITION {-----------------------------------------------------------------------} {#T+ Vialcount} {within|param=1}
#CONDITION {H:%d%sM:%d%sE:%d%sW:%d} {
  #SHOW Toxins:
  #COLOR green,high
  #SHOW {Type %repeat( "-", 11) ~# %repeat( "-", 5) Sips}
  #COLOR green,high
  #LOOPDB @toxins {#SHOW {%key %repeat( "-", 15-%len( %key)) @{toxincount.%key} %repeat( "-", 5) @{toxins.%key}}}
  %crlf
  #SHOW Elixers and Salves:
  #COLOR green,high
  #SHOW {Type %repeat( "-", 11) ~# %repeat( "-", 5) Sips}
  #COLOR green,high
  #LOOPDB @vialtype {#SHOW {%key %repeat( "-", 15-%len( %key)) @{vialcount.%key} %repeat( "-", 5) @{vialtype.%key}}}
#SHOW {Empty Vials: %repeat( "-",15-%len(empty) @{vialcount.empty} %repeat("-",5) @{vialtype.empty}}
  #T- VialCount
  } {within|param=99}
#CLASS 0
#CLASS {ZUGGTEST|vialcount} {disable}
#VARIABLE toxins {calotropis19bromine44iodine48strychnine82ether50oxalis46} {}
#VARIABLE vialtype {mana91mending21frost52epidermal101speed45restoration37} {}
#VARIABLE vialcount {mana3mending3frost1epidermal2speed1restoration1} {}
#VARIABLE toxincount {calotropis1bromine1iodine1strychnine2ether1oxalis1} {}
#VARIABLE spacer {-} {-}
#TRIGGER {^vial*%sthe toxin (%w)%s(%d)%s%d$} {
  #ADD toxins.%1 %2
  #MATH toxincount.%1 @{toxincount.%1}+1
  }
#TRIGGER {^vial*%san elixir of%s(%w)%s(%d)%s%d$} {
  #ADD vialtype.%1 %2
  #MATH vialcount.%1 @{vialcount.%1}+1
  }
#TRIGGER {^vial*%sa salve of (%w)%s(%d)%s%d$} {
  #ADD vialtype.%1 %2
  #MATH vialcount.%1 @{vialcount.%1}+1
  }
#TRIGGER {^vial*%s{a|an} (%w) salve%s(%d)%s%d$} {
  #ADD vialtype.%1 %2
  #MATH vialcount.%1 @{vialcount.%1}+1
  }
#TRIGGER {^vial*%sempty%s(%d)%s%d$} {
  #ADD vialtype.empty %2
  #MATH vialcount.empty @{vialcount.empty}+1
  }
#CLASS 0


Last edited by edb6377 on Tue May 16, 2006 2:00 am; edited 2 times in total
Reply with quote
Dagnimaer
Wanderer


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Tue May 16, 2006 12:47 am   
 
Ok, it does everything except give it for empties. I tried to get it to go but wouldn't work. Here is the code for the empties:

Code:
vial60899      empty                            0           220


Everything else works perfectly
_________________
When in doubt,
Blow it up.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Tue May 16, 2006 2:00 am   
 
Try it again i updated the code
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
Dagnimaer
Wanderer


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Tue May 16, 2006 4:36 am   
 
Code:
Elixers and Salves:
Type ----------- # ----- Sips
empty ---------- 2 -----
mana ----------- 2 ----- 81
health --------- 1 ----- 30
mending -------- 3 ----- 20
frost ---------- 1 ----- 52
epidermal ------ 2 ----- 101
speed ---------- 1 ----- 45
restoration ---- 1 ----- 37
caloric -------- 1 ----- 43
venom ---------- 1 ----- 52
immunity ------- 2 ----- 120
H:239 M:307 E:1095 W:1439 <eb>
levitation ----- 1 ----- 50
mass ----------- 2 ----- 115
Empty Vials:
H:239 M:307 E:1095 W:1439 <eb>


Wont display the empties. Also, how would I change it so I can type in an alias to see the salves elixers and then toxins instead of having a giant scroll
_________________
When in doubt,
Blow it up.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Tue May 16, 2006 6:29 am   
 
empty ---------- 2 -----

Looks like it shows them to me. You have two empty vials. If you mean have it show the empty vial numbers then you just have to switch the captured variable around.

And just add the #SHOW commands into the respective alias in order to display different things
Reply with quote
Dagnimaer
Wanderer


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Wed May 17, 2006 2:55 pm   
 
I have tried to work the empty problem out, but when used in game here is the output.

Quote:
venom ---------- 2 ----- 104
immunity ------- 4 ----- 240
levitation ----- 2 ----- 100
mass ----------- 4 ----- 230
Empty Vials:
H:235 M:303 E:1079 W:1417 <eb>


The code used is

Code:
#TRIGGER {^vial*%sempty%s(%d)%s%d$} {
  #ADD vialtype.empty %2
  #MATH vialcount.empty @{vialcount.empty}+1
  }


And again, the example of the trigger is:

Code:
-----------------------------------------------------------------------
vial60899      empty                            0           218
vial31561      empty                            0           202
vial75427      an elixir of mana                15          187


When I check for Empty it gives me no variable etc to record. The code snip to try and have the output shown on screen is:

Code:
#SHOW Empty Vials: {%repeat( "-", 15-%len( empty) @{vialcount.empty} %repeat( "-", 5) @{vialtype.empty})}
_________________
When in doubt,
Blow it up.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Wed May 17, 2006 9:56 pm   
 
Dagnimaer wrote:
Code:
Elixers and Salves:
Type ----------- # ----- Sips
empty ---------- 2 -----  <----------------------------See here its listed.
mana ----------- 2 ----- 81
health --------- 1 ----- 30
mending -------- 3 ----- 20
frost ---------- 1 ----- 52
epidermal ------ 2 ----- 101
speed ---------- 1 ----- 45
restoration ---- 1 ----- 37
caloric -------- 1 ----- 43
venom ---------- 1 ----- 52
immunity ------- 2 ----- 120
H:239 M:307 E:1095 W:1439 <eb>
levitation ----- 1 ----- 50
mass ----------- 2 ----- 115
Empty Vials:
H:239 M:307 E:1095 W:1439 <eb>


Wont display the empties. Also, how would I change it so I can type in an alias to see the salves elixers and then toxins instead of having a giant scroll


Here it did display them so im at a loss for words. Shows that it is displaying the values

In any case ill move things around but remember that you do have to do some of the work too. Dont regurgitate my own code back at me and tell me what it does. We are here to help not write them for you.


Last edited by edb6377 on Wed May 17, 2006 10:15 pm; edited 1 time in total
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Wed May 17, 2006 10:14 pm   
 
Just in case you're not seeing it forget about the bottom of the list where you have the header. The empties were the first thing shown at the top of the list.
_________________
Taz :)
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Wed May 17, 2006 10:16 pm   
 
This will fix your problem I also added a vials command so it will only parse the list as it comes in and you type vials to see what you have at a given time. This means if you use them you will need to write an addon to this that subtracts from your current inventory

Code:
#CLASS {ZUGGTEST} {enable}
#ALIAS vials {
  #T+ vialcount
  #SHOW Toxins:
  #COLOR green,high
  #SHOW {Type %repeat( "-", 11) ~# %repeat( "-", 5) Sips}
  #COLOR green,high
  #LOOPDB @toxins {#SHOW {%key %repeat( "-", 15-%len( %key)) @{toxincount.%key} %repeat( "-", 5) @{toxins.%key}}}
  %crlf
  #SHOW Elixers and Salves:
  #COLOR green,high
  #SHOW {Type %repeat( "-", 11) ~# %repeat( "-", 5) Sips}
  #COLOR green,high
  #LOOPDB @vialtype {#IF %key=="empty" {#NOOP} {#SHOW {%key %repeat( "-", 15-%len( %key)) @{vialcount.%key} %repeat( "-", 5) @{vialtype.%key}}}}
  #SHOW {Empty Vials: %repeat( "-", 15-%len( "empty vials:")) @{vialcount.empty}}
  #T- vialcount
  }
#TRIGGER {^Vial%sElixir%sSips%sMonths Left} {#RESET vialcount}
#CONDITION {-----------------------------------------------------------------------} {#T+ Vialcount} {within|param=1}
#CONDITION {H:%d%sM:%d%sE:%d%sW:%d} {#T- VialCount} {within|param=50}
#CLASS 0
#CLASS {ZUGGTEST|vialcount} {disable}
#VARIABLE toxins {calotropis19bromine44iodine48strychnine82ether50oxalis46} {}
#VARIABLE vialtype {mana91mending21frost52epidermal101speed45restoration37empty} {}
#VARIABLE vialcount {mana3mending3frost1epidermal2speed1restoration1empty2} {}
#VARIABLE toxincount {calotropis1bromine1iodine1strychnine2ether1oxalis1} {}
#TRIGGER {^vial*%sthe toxin (%w)%s(%d)%s%d$} {
  #ADD toxins.%1 %2
  #MATH toxincount.%1 @{toxincount.%1}+1
  }
#TRIGGER {^vial*%san elixir of%s(%w)%s(%d)%s%d$} {
  #ADD vialtype.%1 %2
  #MATH vialcount.%1 @{vialcount.%1}+1
  }
#TRIGGER {^vial*%sa salve of (%w)%s(%d)%s%d$} {
  #ADD vialtype.%1 %2
  #MATH vialcount.%1 @{vialcount.%1}+1
  }
#TRIGGER {^vial*%s{a|an} (%w) salve%s(%d)%s%d$} {
  #ADD vialtype.%1 %2
  #MATH vialcount.%1 @{vialcount.%1}+1
  }
#TRIGGER {^vial*%sempty%s(%d)%s%d$} {
  #ADD vialtype.empty %2
  #MATH vialcount.empty @{vialcount.empty}+1
  }
#CLASS 0


And what it looks like now

Code:


Toxins:
Type ----------- # ----- Sips
calotropis ----- 1 ----- 19
bromine -------- 1 ----- 44
iodine --------- 1 ----- 48
strychnine ----- 2 ----- 82
ether ---------- 1 ----- 50
oxalis --------- 1 ----- 46


Elixers and Salves:
Type ----------- # ----- Sips
mana ----------- 3 ----- 91
mending -------- 3 ----- 21
frost ---------- 1 ----- 52
epidermal ------ 2 ----- 101
speed ---------- 1 ----- 45
restoration ---- 1 ----- 37
Empty Vials: --- 2
Reply with quote
Dagnimaer
Wanderer


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Thu May 18, 2006 1:20 am   
 
Ok, thanks. Got it all set now to work how I wanted it to.
_________________
When in doubt,
Blow it up.
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