Unknown2008-07-11 05:30:16
Quick and easy ZMUD potionlist script.
Features:
-Only 3 REGEX triggers for efficiency.
-Data stored in DataRecord tables for easy access and integration into your system.
potionlist (alias)
Syntax: potionlist
-Formats vial data in the system into an easily-viewable display as seen below:
-Tracks vials, doses, and decay times.
-Leaves vials not in the system (like those with alchohol) in the normal format so you don't lose any data.
-Automatically will send "more" as necessary.
-"Decaying" under Statistics means how many vials you have that are under the decay threshold set by vialdecay. Default is 7.
vialdecay (alias)
Syntax: vialdecay
EX: vialdecay 2
-Sets the minimum threshold for decaying vial tracking for use in vialdecayfix and potionlist.
- should be in months.
vialdecayfix (alias)
Syntax: vialdecayfix
-Pours all non-empty vials marked as decaying after a potionlist into empty vials not marked as decaying. If you run out of empty vials not marked as decaying, spits back how many non-empty vials marked as decaying you have remaining.
Installation instructions:
Either download potionlist.txt below the code and import it or copy and paste this into your ZMUD:
Features:
-Only 3 REGEX triggers for efficiency.
-Data stored in DataRecord tables for easy access and integration into your system.
potionlist (alias)
Syntax: potionlist
-Formats vial data in the system into an easily-viewable display as seen below:
-Tracks vials, doses, and decay times.
-Leaves vials not in the system (like those with alchohol) in the normal format so you don't lose any data.
-Automatically will send "more" as necessary.
-"Decaying" under Statistics means how many vials you have that are under the decay threshold set by vialdecay. Default is 7.
vialdecay (alias)
Syntax: vialdecay
EX: vialdecay 2
-Sets the minimum threshold for decaying vial tracking for use in vialdecayfix and potionlist.
-
vialdecayfix (alias)
Syntax: vialdecayfix
-Pours all non-empty vials marked as decaying after a potionlist into empty vials not marked as decaying. If you run out of empty vials not marked as decaying, spits back how many non-empty vials marked as decaying you have remaining.
Installation instructions:
Either download potionlist.txt below the code and import it or copy and paste this into your ZMUD:
CODE
#CLASS {EldritchTools|PotionList}
#ALIAS potionlist {clearalldoses;~ potionlist;#var potionlistautomore {1}}
#ALIAS showdoses {#pri {#say " ";displaydose Potions Poisons;displaydose Dash Dash;displaydose allheale aleutian;displaydose antidote anatine;displaydose bromides anerod;displaydose fire botulinum;displaydose frost calcise;displaydose healing chansu;displaydose love charybdon;displaydose mana contortrin;displaydose quicksilver crotamine;displaydose vitae dendroxin;displaydose Clear dulak;displaydose Salves escozul;displaydose Dash hadrudin;displaydose liniment haemotox;displaydose healing ibululu;displaydose mending inyoka;displaydose regeneration mactans;displaydose Clear mantakaya;displaydose Purgatives mellitin;displaydose Dash morphite end;displaydose choleric niricol;displaydose melancholic saxitin;displaydose phlegmatic senso;displaydose sanguine tetrodin;displaydose Clear Clear;displaydose Miscellaneous Statistics;displaydose Dash Dash;displaydose ink empty;displaydose salt decaying;displaydose sulphur total}}
#ALIAS displaydose {#IF (%1 = "Potions" OR %1 = "Salves" OR %1 = "Purgatives" OR %1 = "Miscellaneous" OR %1 = "Dash" OR %1 = "Clear" OR %1 = "Poisons") {#IF (%2 = "end") {#IF (%1 = "Clear") {#say %repeat(" ",32)} {#IF (%1 = "Dash") {#SAY %ansi(3)%repeat("-",32)} {#sayp %ansi(7)%proper(%1);#sayp %repeat(" ",19-%len(%1));#say %ansi(7)"Doses  Vials"}}} {#IF (%1 = "Clear") {#sayp %repeat(" ",36)} {#IF (%1 = "Dash") {#sayp %ansi(3)%repeat("-",32)%repeat(" ",4)} {#sayp %ansi(7)%proper(%1);#sayp %repeat(" ",19-%len(%1));#sayp %ansi(7)"Doses  Vials    "}};displaydose %2 end}} {#sayp %ansi(7)%proper(%1);#sayp %repeat(" ",24-%len(%1)-%len(%db(@potionlistdoses,%1)));#sayp %ansi(7)%db(@potionlistdoses,%1);#sayp %repeat(" ",8-%len(%db(@potionlistvials,%1)));#IF (%2 = "end") {#say %ansi(7)%db(@potionlistvials,%1)} {#sayp %ansi(7)%db(@potionlistvials,%1);#sayp %repeat(" ",4);displaydose %2 end}}}
#ALIAS clearalldoses {#addkey potionlistvials {aleutian|allheale|anatine|anerod|antidote|botulinum|bromides|calcise|chansu|charybdon|choleric|contortrin|crotamine|decaying|dendroxin|dulak|empty|escozul|fire|frost|hadrudin|haemotox|healing|ibululu|ink|inyoka|liniment|love|mactans|mana|mantakaya|melancholic|mellitin|mending|morphite|niricol|phlegmatic|quicksilver|regeneration|salt|sanguine|saxitin|senso|sulphur|tetrodin|total|vitae} {0};#addkey potionlistdoses {aleutian|allheale|anatine|anerod|antidote|botulinum|bromides|calcise|chansu|charybdon|choleric|contortrin|crotamine|dendroxin|dulak|escozul|fire|frost|hadrudin|haemotox|healing|ibululu|ink|inyoka|liniment|love|mactans|mana|mantakaya|melancholic|mellitin|mending|morphite|niricol|phlegmatic|quicksilver|regeneration|salt|sanguine|saxitin|senso|sulphur|tetrodin|vitae} {0};#VAR potionlistdecaying {};#VAR potionlistdecayingindex {1};#VAR potionlistempty {};#VAR potionlistemptyindex {1}}
#ALIAS vialdecay {#VAR potionlistdecaythreshold {%1}}
#ALIAS vialdecayfix {#WHILE ((%eval(@potionlistemptyindex - 1)) AND %eval(@potionlistdecayingindex - 1)) {#ADD potionlistdecayingindex -1;#ADD potionlistemptyindex -1;pour %db(@potionlistdecaying,@potionlistdecayingindex) into %db(@potionlistempty,@potionlistemptyindex)};#IF (@potionlistdecayingindex > @potionlistemptyindex) {#SAY %eval(@potionlistdecayingindex -1) unfixed decaying vials remaining.}}
#VAR potionlistautomore {0}
#VAR potionlistdecaythreshold {7}
#VAR potionlistdecaying {}
#VAR potionlistdecayingindex {1}
#VAR potionlistdoses {}
#VAR potionlistempty {}
#VAR potionlistemptyindex {1}
#VAR potionlistid {0}
#VAR potionlistvials {}
#VAR potionlisttempdoses {0}
#VAR potionlisttempmonths {0}
#VAR potionlisttempvials {0}
#VAR potionlisttype {bromides}
#REGEX {^Total Vials: (?potionlisttempvials:\\d+)$} {#GAG;#ADDKEY potionlistvials {decaying} {%eval(@potionlistdecayingindex - 1)};#ADDKEY potionlistvials {total} {@potionlisttempvials};showdoses;#var potionlistautomore {0}}
#REGEX {^(?potionlistid:\\d+)(?:\\s+)a (?:\\a+ vial|vial)(?:\\s+)(?:|a potion of |a |an |the poison |magical |glowing |elixir )(?potionlisttype:aleutian|allheale|anatine|anerod|antidote|botulinum|bromides|calcise|chansu|charybdon|choleric|contortrin|crotamine|dendroxin|dulak|empty|escozul|fire|frost|hadrudin|haemotox|healing|ibululu|ink|inyoka|liniment|love|mactans|mana|mantakaya|melancholic|mellitin|mending|morphite|niricol|phlegmatic|quicksilver|regeneration|salt|sanguine|saxitin|senso|sulphur|tetrodin|vitae)(?:| potion| purgative| salve)(?:\\s+)(?potionlisttempdoses:\\d+)(?:\\s+)(?potionlisttempmonths:\\d+)$} {#GAG;#IF (@potionlisttype != "empty") {#ADDKEY potionlistdoses {@potionlisttype} {%eval(%db(@potionlistdoses,@potionlisttype)+@potionlisttempdoses)};#IF (@potionlisttempmonths <= @potionlistdecaythreshold) {#ADDKEY potionlistdecaying {@potionlistdecayingindex} {@potionlistid};#ADD potionlistdecayingindex 1}} {#IF (@potionlisttempmonths > @potionlistdecaythreshold) {#ADDKEY potionlistempty {@potionlistemptyindex} {@potionlistid};#ADD potionlistemptyindex 1}};#ADDKEY potionlistvials {@potionlisttype} {%eval(%db(@potionlistvials,@potionlisttype)+1)}}
#REGEX {^Type MORE to continue reading\\. \\(\\d+% shown\\)$} {#IF (@potionlistautomore) {more}}
#CLASS 0
#ALIAS potionlist {clearalldoses;~ potionlist;#var potionlistautomore {1}}
#ALIAS showdoses {#pri {#say " ";displaydose Potions Poisons;displaydose Dash Dash;displaydose allheale aleutian;displaydose antidote anatine;displaydose bromides anerod;displaydose fire botulinum;displaydose frost calcise;displaydose healing chansu;displaydose love charybdon;displaydose mana contortrin;displaydose quicksilver crotamine;displaydose vitae dendroxin;displaydose Clear dulak;displaydose Salves escozul;displaydose Dash hadrudin;displaydose liniment haemotox;displaydose healing ibululu;displaydose mending inyoka;displaydose regeneration mactans;displaydose Clear mantakaya;displaydose Purgatives mellitin;displaydose Dash morphite end;displaydose choleric niricol;displaydose melancholic saxitin;displaydose phlegmatic senso;displaydose sanguine tetrodin;displaydose Clear Clear;displaydose Miscellaneous Statistics;displaydose Dash Dash;displaydose ink empty;displaydose salt decaying;displaydose sulphur total}}
#ALIAS displaydose {#IF (%1 = "Potions" OR %1 = "Salves" OR %1 = "Purgatives" OR %1 = "Miscellaneous" OR %1 = "Dash" OR %1 = "Clear" OR %1 = "Poisons") {#IF (%2 = "end") {#IF (%1 = "Clear") {#say %repeat(" ",32)} {#IF (%1 = "Dash") {#SAY %ansi(3)%repeat("-",32)} {#sayp %ansi(7)%proper(%1);#sayp %repeat(" ",19-%len(%1));#say %ansi(7)"Doses  Vials"}}} {#IF (%1 = "Clear") {#sayp %repeat(" ",36)} {#IF (%1 = "Dash") {#sayp %ansi(3)%repeat("-",32)%repeat(" ",4)} {#sayp %ansi(7)%proper(%1);#sayp %repeat(" ",19-%len(%1));#sayp %ansi(7)"Doses  Vials    "}};displaydose %2 end}} {#sayp %ansi(7)%proper(%1);#sayp %repeat(" ",24-%len(%1)-%len(%db(@potionlistdoses,%1)));#sayp %ansi(7)%db(@potionlistdoses,%1);#sayp %repeat(" ",8-%len(%db(@potionlistvials,%1)));#IF (%2 = "end") {#say %ansi(7)%db(@potionlistvials,%1)} {#sayp %ansi(7)%db(@potionlistvials,%1);#sayp %repeat(" ",4);displaydose %2 end}}}
#ALIAS clearalldoses {#addkey potionlistvials {aleutian|allheale|anatine|anerod|antidote|botulinum|bromides|calcise|chansu|charybdon|choleric|contortrin|crotamine|decaying|dendroxin|dulak|empty|escozul|fire|frost|hadrudin|haemotox|healing|ibululu|ink|inyoka|liniment|love|mactans|mana|mantakaya|melancholic|mellitin|mending|morphite|niricol|phlegmatic|quicksilver|regeneration|salt|sanguine|saxitin|senso|sulphur|tetrodin|total|vitae} {0};#addkey potionlistdoses {aleutian|allheale|anatine|anerod|antidote|botulinum|bromides|calcise|chansu|charybdon|choleric|contortrin|crotamine|dendroxin|dulak|escozul|fire|frost|hadrudin|haemotox|healing|ibululu|ink|inyoka|liniment|love|mactans|mana|mantakaya|melancholic|mellitin|mending|morphite|niricol|phlegmatic|quicksilver|regeneration|salt|sanguine|saxitin|senso|sulphur|tetrodin|vitae} {0};#VAR potionlistdecaying {};#VAR potionlistdecayingindex {1};#VAR potionlistempty {};#VAR potionlistemptyindex {1}}
#ALIAS vialdecay {#VAR potionlistdecaythreshold {%1}}
#ALIAS vialdecayfix {#WHILE ((%eval(@potionlistemptyindex - 1)) AND %eval(@potionlistdecayingindex - 1)) {#ADD potionlistdecayingindex -1;#ADD potionlistemptyindex -1;pour %db(@potionlistdecaying,@potionlistdecayingindex) into %db(@potionlistempty,@potionlistemptyindex)};#IF (@potionlistdecayingindex > @potionlistemptyindex) {#SAY %eval(@potionlistdecayingindex -1) unfixed decaying vials remaining.}}
#VAR potionlistautomore {0}
#VAR potionlistdecaythreshold {7}
#VAR potionlistdecaying {}
#VAR potionlistdecayingindex {1}
#VAR potionlistdoses {}
#VAR potionlistempty {}
#VAR potionlistemptyindex {1}
#VAR potionlistid {0}
#VAR potionlistvials {}
#VAR potionlisttempdoses {0}
#VAR potionlisttempmonths {0}
#VAR potionlisttempvials {0}
#VAR potionlisttype {bromides}
#REGEX {^Total Vials: (?potionlisttempvials:\\d+)$} {#GAG;#ADDKEY potionlistvials {decaying} {%eval(@potionlistdecayingindex - 1)};#ADDKEY potionlistvials {total} {@potionlisttempvials};showdoses;#var potionlistautomore {0}}
#REGEX {^(?potionlistid:\\d+)(?:\\s+)a (?:\\a+ vial|vial)(?:\\s+)(?:|a potion of |a |an |the poison |magical |glowing |elixir )(?potionlisttype:aleutian|allheale|anatine|anerod|antidote|botulinum|bromides|calcise|chansu|charybdon|choleric|contortrin|crotamine|dendroxin|dulak|empty|escozul|fire|frost|hadrudin|haemotox|healing|ibululu|ink|inyoka|liniment|love|mactans|mana|mantakaya|melancholic|mellitin|mending|morphite|niricol|phlegmatic|quicksilver|regeneration|salt|sanguine|saxitin|senso|sulphur|tetrodin|vitae)(?:| potion| purgative| salve)(?:\\s+)(?potionlisttempdoses:\\d+)(?:\\s+)(?potionlisttempmonths:\\d+)$} {#GAG;#IF (@potionlisttype != "empty") {#ADDKEY potionlistdoses {@potionlisttype} {%eval(%db(@potionlistdoses,@potionlisttype)+@potionlisttempdoses)};#IF (@potionlisttempmonths <= @potionlistdecaythreshold) {#ADDKEY potionlistdecaying {@potionlistdecayingindex} {@potionlistid};#ADD potionlistdecayingindex 1}} {#IF (@potionlisttempmonths > @potionlistdecaythreshold) {#ADDKEY potionlistempty {@potionlistemptyindex} {@potionlistid};#ADD potionlistemptyindex 1}};#ADDKEY potionlistvials {@potionlisttype} {%eval(%db(@potionlistvials,@potionlisttype)+1)}}
#REGEX {^Type MORE to continue reading\\. \\(\\d+% shown\\)$} {#IF (@potionlistautomore) {more}}
#CLASS 0