zMUD script to sort vials by fullness

by Lendren

Back to Mechanic's Corner.

Lendren2006-11-10 17:19:26
One problem of refilling vials from kegs is that you tend to end up with full vials higher up in your potionlist than half-full ones, so eventually you end up with all your vials half-full and you run out sooner. This zMUD script sorts your vials by sips so the ones with the fewest sips are highest on the list and thus will be used up first. To use it, go to a private place (so no one will snatch your vials or get spammed) and do "sortvials Healing" (for instance). All your healing vials will be dropped, then picked up emptiest first. This requires you to have the potionlist skill, and to have selfishness turned off, and acquisitio off, and no one else nearby picking up vials.

CODE
#CLASS {SortVials}
#ALIAS sortvials {#if (%1 == done) {#forall (%sort( @SortVialsList)) {get %word( %i, 2)}} {#if (%1 == add) {#additem SortVialsList %concat( %rightback( %concat( "000", %3), 3), " ", %2);drop %2} {#t+ "SortVialsTriggerMore";#t+ %concat( "SortVialsTrigger", %1);SortVialsList = "";#temp {^You nod your head emphatically.$} {#t- "SortVialsTriggerMore";#t- %concat( "SortVialsTrigger", %1);sortvials done};pl;nod}}}
#VAR SortVialsList {}
#TRIGGER "SortVialsTriggerFrost" {^(%d)%sa*vial%sa potion of frost%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerFire" {^(%d)%sa*vial%sa potion of fire%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerVitae" {^(%d)%sa*vial%selixir vitae%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerPhlegmatic" {^(%d)%sa*vial%sa phlegmatic purgat*%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerMelancholic" {^(%d)%sa*vial%sa melancholic purgat*%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerSanguine" {^(%d)%sa*vial%sa sanguine purgat*%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerCholeric" {^(%d)%sa*vial%sa choleric purgat*%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerLiniment" {^(%d)%sa*vial%sliniment%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerHealing" {^(%d)%sa*vial%sa potion of healing%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerQuicksilver" {^(%d)%sa*vial%squicksilver%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerLove" {^(%d)%sa*vial%sa love potion%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerRegeneration" {^(%d)%sa*vial%sa regeneration salve%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerAllheale" {^(%d)%sa*vial%sa potion of allheale%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerBromides" {^(%d)%sa*vial%sa potion of bromides%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerMending" {^(%d)%sa*vial%sa mending salve%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerAntidote" {^(%d)%sa*vial%san antidote potion%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerMana" {^(%d)%sa*vial%sa potion of mana%s(%d)%s} {sortvials add %1 %2} "" {disable}
#TRIGGER "SortVialsTriggerMore" {^Type MORE to continue reading.} {more} "" {disable}
#CLASS 0
Unknown2006-11-11 00:43:42
Thanks for this. I'd prefer it if the admin would just tweak POTIONLIST so that it was sorted in a more logical order, but oh well.
Lendren2006-11-11 02:37:07
If they changed the order POTIONLIST showed in, that would only change how it displayed, but not which vial you'd drink from first if you just "sip healing", so that wouldn't help here.