Munsia2006-01-09 04:49:08
I'm looking for a code since I have obviously no idea that will tell me in a list how many potions I have of each and possibly able to set a desired amount so like.. if I have 10 out of say 20 health I'll get
Mana: 20/20
Health: 10/20
Love: 1/3
etc etc etc
Mana: 20/20
Health: 10/20
Love: 1/3
etc etc etc
Shryke2006-01-09 05:42:29
well first you could set up how many potions of each you should have when all are full, then have triggers that go
#trigger {you have the following potions in your inventory (or whatever the original message is)} {healths=0;manas=0;etc.}
#trigger {a potion of health} {#math healths (@healths+1)}
etc.
(not sure I have all the syntaxes right, haven't done any math codes in a while)
then do buttons that show @healths/@maxhealths
or #alias potions {#show @healths/@maxhealths @manas/@maxmanas}
#trigger {you have the following potions in your inventory (or whatever the original message is)} {healths=0;manas=0;etc.}
#trigger {a potion of health} {#math healths (@healths+1)}
etc.
(not sure I have all the syntaxes right, haven't done any math codes in a while)
then do buttons that show @healths/@maxhealths
or #alias potions {#show @healths/@maxhealths @manas/@maxmanas}
Munsia2006-01-09 06:00:38
Shryke2006-01-09 07:04:50
hmm, was it that bad.. lets see..
ok:
define a variable for each potion you have... these variables are how many of each potion you want. so maxmanas=10 maxhealths=20 maxloves=3
then have a trigger that resets the variables that track how many of each potion you actually have (this prevents you from just constantly adding each time you use potionlist) that would look like this:
#trigger {you have the following potions in your inventory (or whatever the original message is)}
then a trigger for each type of potion when you do potionlist that would look like this
#trigger {a potion of love} {#math loves (@loves+1)}
^^^This trigger adds one potion to your loves tracker for each line that has "a potion of love"
then you set up something to display this information... could be an alias like "potions" which would look like this in code
#alias potions {#say LOVES=@loves/@maxloves----HEALTHS=@healths/@maxhealths---etc.}
ok:
define a variable for each potion you have... these variables are how many of each potion you want. so maxmanas=10 maxhealths=20 maxloves=3
then have a trigger that resets the variables that track how many of each potion you actually have (this prevents you from just constantly adding each time you use potionlist) that would look like this:
#trigger {you have the following potions in your inventory (or whatever the original message is)}
then a trigger for each type of potion when you do potionlist that would look like this
#trigger {a potion of love} {#math loves (@loves+1)}
^^^This trigger adds one potion to your loves tracker for each line that has "a potion of love"
then you set up something to display this information... could be an alias like "potions" which would look like this in code
#alias potions {#say LOVES=@loves/@maxloves----HEALTHS=@healths/@maxhealths---etc.}
Munsia2006-01-09 15:14:39
Unknown2006-01-09 16:11:46
Well, I had a go... see if this works
--Updated below
If you want to add more types of vials, just add them to the PotionList variable, then add an appropriate trigger that is almost identical to the other ones in the PotionCounter folder.
I'm just having a stab, don't hurt me if it doesn't work.
CODE
--Updated below
If you want to add more types of vials, just add them to the PotionList variable, then add an appropriate trigger that is almost identical to the other ones in the PotionCounter folder.
I'm just having a stab, don't hurt me if it doesn't work.
Munsia2006-01-09 16:42:32
It works.. it's nice I just dont know how to change the numbers.
==========================================
Health 15/ (897 sips)
Mana 8/8 (455 sips)
Bromides 2/2 (100 sips)
Mending 1/1 (26 sips)
Frost 2/2 (61 sips)
Fire 3/3 (180 sips)
Antidote 1/1 (17 sips)
Vitae 0/0 (0 sips)
==========================================
is what I'm getting
I have no idea how to edit the thing but adding in
Allheale
Sanguine
Choleric
Melancholic.
Would be nice.. and someone pointing out where in the code is to edit the number on the right.. so it isnt mana 8/8 but like 8/20. I'm also loving the sips.
Edit: Oh Phlegmatic and quicksilver as well
==========================================
Health 15/ (897 sips)
Mana 8/8 (455 sips)
Bromides 2/2 (100 sips)
Mending 1/1 (26 sips)
Frost 2/2 (61 sips)
Fire 3/3 (180 sips)
Antidote 1/1 (17 sips)
Vitae 0/0 (0 sips)
==========================================
is what I'm getting
I have no idea how to edit the thing but adding in
Allheale
Sanguine
Choleric
Melancholic.
Would be nice.. and someone pointing out where in the code is to edit the number on the right.. so it isnt mana 8/8 but like 8/20. I'm also loving the sips.
Edit: Oh Phlegmatic and quicksilver as well
Unknown2006-01-10 07:32:16
Ok, can any zmud wizard see where the error with this code is? For some reason, some potion counts get reset back to zero when it is output, but I don't know why...
#CLASS {Utility|PotionCounter} {disable}
#TRIGGER {^%da* viala potion of (%w)(%d)(%d)} {#if (%3 < 10) {#color bold,red};#if (%1 == "healing") {#addkey PotionCount health {%eval( @PotionCount.health + 1)};#addkey PotionSipCount health {%eval( @PotionSipCount.health + %2)}};#if (%1 == "mana") {#addkey PotionCount mana {%eval( @PotionCount.mana + 1)};#addkey PotionSipCount mana {%eval( @PotionSipCount.mana + %2)}};#if (%1 == "bromides") {#addkey PotionCount bromides {%eval( @PotionCount.bromides + 1)};#addkey PotionSipCount bromides {%eval( @PotionSipCount.bromides + %2)}};#if (%1 == "fire") {#addkey PotionCount fire {%eval( @PotionCount.fire + 1)};#addkey PotionSipCount fire {%eval( @PotionSipCount.fire + %2)}};#if (%1 == "frost") {#addkey PotionCount frost {%eval( @PotionCount.frost + 1)};#addkey PotionSipCount frost {%eval( @PotionSipCount.frost + %2)}};#if (%1 == "allheale") {#addkey PotionCount allheale {%eval( @PotionCount.allheale + 1)};#addkey PotionSipCount allheale {%eval( @PotionSipCount.allheale + %2)}}}
#TRIGGER {^Total Vials~: (%d)} {#t- PotionCounter;#addkey PotionMaxCount empty %1;potions}
#TRIGGER {Type MORE} {#send {more}}
#TRIGGER {^%da* vialelixir vitae(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount vitae {%eval( @PotionCount.vitae + 1)};#addkey PotionSipCount vitae {%eval( @PotionSipCount.vitae + %1)}}
#TRIGGER {^%da* vialan antidote potion(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount antidote {%eval( @PotionCount.antidote + 1)};#addkey PotionSipCount antidote {%eval( @PotionSipCount.antidote + %1)}}
#TRIGGER {^%da* viala phlegmatic purgati(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount phlegmatic {%eval( @PotionCount.phlegmatic + 1)};#addkey PotionSipCount phlegmatic {%eval( @PotionSipCount.phlegmatic + %1)}}
#TRIGGER {^%da* viala melancholic purgat(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount melancholic {%eval( @PotionCount.melancholic + 1)};#addkey PotionSipCount melancholic {%eval( @PotionSipCount.melancholic + %1)}}
#TRIGGER {^%da* vialquicksilver(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount quicksilver {%eval( @PotionCount.quicksilver + 1)};#addkey PotionSipCount quicksilver {%eval( @PotionSipCount.quicksilver + %1)}}
#TRIGGER {^%da* viala sanguine purgative(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount sanguine {%eval( @PotionCount.sanguine + 1)};#addkey PotionSipCount sanguine {%eval( @PotionSipCount.sanguine + %1)}}
#TRIGGER {^%da* viala love potion(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount love {%eval( @PotionCount.love + 1)};#addkey PotionSipCount love {%eval( @PotionSipCount.love + %1)}}
#TRIGGER {^%da* viala (%w) salve(%d)(%d)} {#if (%3 < 10) {#color bold,red};#if (%1 == "regeneration") {#addkey PotionCount regeneration {%eval( @PotionCount.regeneration + 1)};#addkey PotionSipCount regeneration {%eval( @PotionSipCount.regeneration + %2)}};#if (%1 == "mending") {#addkey PotionCount mending {%eval( @PotionCount.mending + 1)};#addkey PotionSipCount mending {%eval( @PotionSipCount.mending + %2)}}}
#TRIGGER {^%da* vialliniment(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount liniment {%eval( @PotionCount.liniment + 1)};#addkey PotionSipCount liniment {%eval( @PotionSipCount.liniment + %1)}}
#TRIGGER {^%da* vialempty(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount empty {%eval( @PotionCount.empty + 1)}}
#CLASS 0
#ALIAS potions {#say " ";#say {%ansi( blue, bold)==========================================};#forall @PotionList {#say %ansi( cyan, bold)%i %repeat( "~ ", %eval( 17-%len( %i)-%len( @PotionCount.%i)))@PotionCount.%i/@PotionMaxCount.%i (@PotionSipCount.%i sips)};#say %ansi( black, bold)Empties ~ ~ ~ ~ ~ ~ ~ ~ @PotionCount.empty/@PotionMaxCount.empty total;#say {%ansi( blue, bold)==========================================}} "Utility"
#VAR PotionCount {allheale1antidote1bromides14Choleric0fire1Frost0Health0Liniment0Love0Mana0melancholic3mending1phlegmatic4quicksilver2Regeneration0Sanguine0vitae1empty14} {_nodef} "Utility"
#VAR PotionList {Allheale|Antidote|Bromides|Choleric|Fire|Frost|Health|Liniment|Love|Mana|Melancholic|Mending|Phlegmatic|Quicksilver|Regeneration|Sanguine|Vitae} {_nodef} "Utility"
#VAR PotionMaxCount {health20mana20antidote20Love20Regeneration20Frost20Sanguine20bromides20phlegmatic20mending20fire20vitae20allheale20Choleric20melancholic20Liniment20quicksilver20empty83} {_nodef} "Utility"
#VAR PotionSipCount {allheale59antidote59bromides840Choleric0fire1Frost0Health0Liniment0Love0Mana0melancholic146mending3phlegmatic228quicksilver93Regeneration0Sanguine0vitae1} {_nodef} "Utility"
#TRIGGER {^IdVialPotionSipsMonths} {#var PotionCount "";#var PotionSipCount "";#forall @PotionList {#addkey PotionCount %i 0;#addkey PotionSipCount %i 0};#addkey PotionCount empty 0;#t+ PotionCounter} "Utility"
CODE
#CLASS {Utility|PotionCounter} {disable}
#TRIGGER {^%da* viala potion of (%w)(%d)(%d)} {#if (%3 < 10) {#color bold,red};#if (%1 == "healing") {#addkey PotionCount health {%eval( @PotionCount.health + 1)};#addkey PotionSipCount health {%eval( @PotionSipCount.health + %2)}};#if (%1 == "mana") {#addkey PotionCount mana {%eval( @PotionCount.mana + 1)};#addkey PotionSipCount mana {%eval( @PotionSipCount.mana + %2)}};#if (%1 == "bromides") {#addkey PotionCount bromides {%eval( @PotionCount.bromides + 1)};#addkey PotionSipCount bromides {%eval( @PotionSipCount.bromides + %2)}};#if (%1 == "fire") {#addkey PotionCount fire {%eval( @PotionCount.fire + 1)};#addkey PotionSipCount fire {%eval( @PotionSipCount.fire + %2)}};#if (%1 == "frost") {#addkey PotionCount frost {%eval( @PotionCount.frost + 1)};#addkey PotionSipCount frost {%eval( @PotionSipCount.frost + %2)}};#if (%1 == "allheale") {#addkey PotionCount allheale {%eval( @PotionCount.allheale + 1)};#addkey PotionSipCount allheale {%eval( @PotionSipCount.allheale + %2)}}}
#TRIGGER {^Total Vials~: (%d)} {#t- PotionCounter;#addkey PotionMaxCount empty %1;potions}
#TRIGGER {Type MORE} {#send {more}}
#TRIGGER {^%da* vialelixir vitae(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount vitae {%eval( @PotionCount.vitae + 1)};#addkey PotionSipCount vitae {%eval( @PotionSipCount.vitae + %1)}}
#TRIGGER {^%da* vialan antidote potion(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount antidote {%eval( @PotionCount.antidote + 1)};#addkey PotionSipCount antidote {%eval( @PotionSipCount.antidote + %1)}}
#TRIGGER {^%da* viala phlegmatic purgati(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount phlegmatic {%eval( @PotionCount.phlegmatic + 1)};#addkey PotionSipCount phlegmatic {%eval( @PotionSipCount.phlegmatic + %1)}}
#TRIGGER {^%da* viala melancholic purgat(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount melancholic {%eval( @PotionCount.melancholic + 1)};#addkey PotionSipCount melancholic {%eval( @PotionSipCount.melancholic + %1)}}
#TRIGGER {^%da* vialquicksilver(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount quicksilver {%eval( @PotionCount.quicksilver + 1)};#addkey PotionSipCount quicksilver {%eval( @PotionSipCount.quicksilver + %1)}}
#TRIGGER {^%da* viala sanguine purgative(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount sanguine {%eval( @PotionCount.sanguine + 1)};#addkey PotionSipCount sanguine {%eval( @PotionSipCount.sanguine + %1)}}
#TRIGGER {^%da* viala love potion(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount love {%eval( @PotionCount.love + 1)};#addkey PotionSipCount love {%eval( @PotionSipCount.love + %1)}}
#TRIGGER {^%da* viala (%w) salve(%d)(%d)} {#if (%3 < 10) {#color bold,red};#if (%1 == "regeneration") {#addkey PotionCount regeneration {%eval( @PotionCount.regeneration + 1)};#addkey PotionSipCount regeneration {%eval( @PotionSipCount.regeneration + %2)}};#if (%1 == "mending") {#addkey PotionCount mending {%eval( @PotionCount.mending + 1)};#addkey PotionSipCount mending {%eval( @PotionSipCount.mending + %2)}}}
#TRIGGER {^%da* vialliniment(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount liniment {%eval( @PotionCount.liniment + 1)};#addkey PotionSipCount liniment {%eval( @PotionSipCount.liniment + %1)}}
#TRIGGER {^%da* vialempty(%d)(%d)} {#if (%2 < 10) {#color bold,red};#addkey PotionCount empty {%eval( @PotionCount.empty + 1)}}
#CLASS 0
#ALIAS potions {#say " ";#say {%ansi( blue, bold)==========================================};#forall @PotionList {#say %ansi( cyan, bold)%i %repeat( "~ ", %eval( 17-%len( %i)-%len( @PotionCount.%i)))@PotionCount.%i/@PotionMaxCount.%i (@PotionSipCount.%i sips)};#say %ansi( black, bold)Empties ~ ~ ~ ~ ~ ~ ~ ~ @PotionCount.empty/@PotionMaxCount.empty total;#say {%ansi( blue, bold)==========================================}} "Utility"
#VAR PotionCount {allheale1antidote1bromides14Choleric0fire1Frost0Health0Liniment0Love0Mana0melancholic3mending1phlegmatic4quicksilver2Regeneration0Sanguine0vitae1empty14} {_nodef} "Utility"
#VAR PotionList {Allheale|Antidote|Bromides|Choleric|Fire|Frost|Health|Liniment|Love|Mana|Melancholic|Mending|Phlegmatic|Quicksilver|Regeneration|Sanguine|Vitae} {_nodef} "Utility"
#VAR PotionMaxCount {health20mana20antidote20Love20Regeneration20Frost20Sanguine20bromides20phlegmatic20mending20fire20vitae20allheale20Choleric20melancholic20Liniment20quicksilver20empty83} {_nodef} "Utility"
#VAR PotionSipCount {allheale59antidote59bromides840Choleric0fire1Frost0Health0Liniment0Love0Mana0melancholic146mending3phlegmatic228quicksilver93Regeneration0Sanguine0vitae1} {_nodef} "Utility"
#TRIGGER {^IdVialPotionSipsMonths} {#var PotionCount "";#var PotionSipCount "";#forall @PotionList {#addkey PotionCount %i 0;#addkey PotionSipCount %i 0};#addkey PotionCount empty 0;#t+ PotionCounter} "Utility"