Gwylifar2006-09-25 22:34:17
After the addition of Clotheslist someone who didn't have MagicList but wished he did happened to mention this to me, and so I spit this script out for him, and decided to share it here. This wouldn't be possible to do to make an ersatz potionlist though since probing a potion doesn't tell you sips! (Why not?) Sorry about that.
Important Notes:
1. This is kind of slow. Takes about ten seconds to churn through during which all output is gagged. Do it in private where you're not in danger.
2. It's for zMUD and only tested in 7.20b.
3. It requires you to create a list of your enchantments and their numbers. You probably already have that, but probably not in the format this uses: a data-record variable with pairs of the format "Mercy" -> "12345". You probably already have this same data in your system but in a different format. I've included a few aliases to use this format to rub and point, which you could switch to using; or you could maintain everything separately.
4. It's assumed that every enchantment is either worn or in your pack. Anyway, after it runs, every enchantment will be either worn or in your pack, since it'll try to get out and put away each one.
5. It lists charges and months left. Not sure if the built-in version does months (pipelist doesn't but potionlist does, I think).
6. Since it aliases the word "magiclist" if you install this you won't be able to get to the real magiclist without a tilde, but why would you install this if you have the real magiclist?
Here's an example of what the output would look like:
And finally, here's the code. No warranties express or implied, use at your own risk.
To set up your dEnchantments variable, you can edit it manually, change it to Data Record, and enter entries with Mercy in the first column and 12345 in the second. Or you can key in commands like this:
Whatever is added to that variable is what will be listed, so add them all.
P.S.: Nitpicks about the details of my obviously faked output will be met with stony silence. Or perhaps free gifts. You decide. (Guidos need not apply, temporary or otherwise.)
Important Notes:
1. This is kind of slow. Takes about ten seconds to churn through during which all output is gagged. Do it in private where you're not in danger.
2. It's for zMUD and only tested in 7.20b.
3. It requires you to create a list of your enchantments and their numbers. You probably already have that, but probably not in the format this uses: a data-record variable with pairs of the format "Mercy" -> "12345". You probably already have this same data in your system but in a different format. I've included a few aliases to use this format to rub and point, which you could switch to using; or you could maintain everything separately.
4. It's assumed that every enchantment is either worn or in your pack. Anyway, after it runs, every enchantment will be either worn or in your pack, since it'll try to get out and put away each one.
5. It lists charges and months left. Not sure if the built-in version does months (pipelist doesn't but potionlist does, I think).
6. Since it aliases the word "magiclist" if you install this you won't be able to get to the real magiclist without a tilde, but why would you install this if you have the real magiclist?
Here's an example of what the output would look like:
CODE
*******************************************************************************
Id      Item                                      Enchantment  Charges  Months
-------------------------------------------------------------------------------
12345    a mauve wombat wand                      Perfection        20    198
45678    an octagonal potato ring                  Levitate          27    191
2345    a rainbow-colored rainbow-shaped crown    Kingdom          27    209
345678  a wand resembling Guido's right pinky    Geyser            9    214
98765    a sparkling flying badger ring            Gust              10    215
*******************************************************************************
Id      Item                                      Enchantment  Charges  Months
-------------------------------------------------------------------------------
12345    a mauve wombat wand                      Perfection        20    198
45678    an octagonal potato ring                  Levitate          27    191
2345    a rainbow-colored rainbow-shaped crown    Kingdom          27    209
345678  a wand resembling Guido's right pinky    Geyser            9    214
98765    a sparkling flying badger ring            Gust              10    215
*******************************************************************************
And finally, here's the code. No warranties express or implied, use at your own risk.
CODE
#CLASS {Equipment|Enchantments}
#ALIAS enchrub {#send %eval( %concat( "rub ", %db( @dEnchantments, %1), %-2))}
#ALIAS enchpoint {#send %eval( %concat( "point ", %db( @dEnchantments, %1), " ", "%-2"))}
#ALIAS ench {#send %eval( %concat( %2, " ", %db( @dEnchantments, %1), " ", %-3))}
#ALIAS magiclist {#gagon;ResultVar = %concat( "*******************************************************************************", %char( 13), %char( 10), "Id      Item                                      Enchantment  Charges  Months", %char( 13), %char( 10), "-------------------------------------------------------------------------------", %char( 13), %char( 10));#t+ "Equipment|Enchantments|MagicListTriggers";#temp {^I know of no skill called ~"Nothing.~"$} {#t- "Equipment|Enchantments|MagicListTriggers";#gagoff;#show %concat( @ResultVar, "*******************************************************************************");#send ""} "Temp";#loopdb {@dEnchantments} {#send %concat( "get ", %val, " from pack");#send %concat( "ii ", %val);#send %concat( "probe ", %val);#send %concat( "put ", %val, " into pack")};ab nothing}
#VAR dEnchantments {}
#CLASS 0
#CLASS {Equipment|Enchantments|MagicListTriggers}
#TRIGGER {^It has (%d) months of usefulness left.$} {ScratchVar = %1}
#TRIGGER {^It is enchanted with the (%w) spell, holding (%d) charges.$} {ResultVar = %concat( @ResultVar, %left( %concat( @LabelVar, "Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "), 50), " ", %left( %concat( %proper( %1), "Â Â Â Â Â Â Â Â Â Â "), 11), %rightback( %concat( "Â Â Â Â Â Â Â Â ", %2), 9), %rightback( %concat( "Â Â Â Â Â Â Â Â ", @ScratchVar), 8), %char( 13), %char( 10))}
#TRIGGER {^~"%w(%d)~"Â Â Â Â Â Â Â Â Â Â Â Â Â Â (*)} {LabelVar = %concat( %left( %concat( %1, "Â Â Â Â Â Â Â Â "), 9), %2)}
#CLASS 0
#ALIAS enchrub {#send %eval( %concat( "rub ", %db( @dEnchantments, %1), %-2))}
#ALIAS enchpoint {#send %eval( %concat( "point ", %db( @dEnchantments, %1), " ", "%-2"))}
#ALIAS ench {#send %eval( %concat( %2, " ", %db( @dEnchantments, %1), " ", %-3))}
#ALIAS magiclist {#gagon;ResultVar = %concat( "*******************************************************************************", %char( 13), %char( 10), "Id      Item                                      Enchantment  Charges  Months", %char( 13), %char( 10), "-------------------------------------------------------------------------------", %char( 13), %char( 10));#t+ "Equipment|Enchantments|MagicListTriggers";#temp {^I know of no skill called ~"Nothing.~"$} {#t- "Equipment|Enchantments|MagicListTriggers";#gagoff;#show %concat( @ResultVar, "*******************************************************************************");#send ""} "Temp";#loopdb {@dEnchantments} {#send %concat( "get ", %val, " from pack");#send %concat( "ii ", %val);#send %concat( "probe ", %val);#send %concat( "put ", %val, " into pack")};ab nothing}
#VAR dEnchantments {}
#CLASS 0
#CLASS {Equipment|Enchantments|MagicListTriggers}
#TRIGGER {^It has (%d) months of usefulness left.$} {ScratchVar = %1}
#TRIGGER {^It is enchanted with the (%w) spell, holding (%d) charges.$} {ResultVar = %concat( @ResultVar, %left( %concat( @LabelVar, "Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "), 50), " ", %left( %concat( %proper( %1), "Â Â Â Â Â Â Â Â Â Â "), 11), %rightback( %concat( "Â Â Â Â Â Â Â Â ", %2), 9), %rightback( %concat( "Â Â Â Â Â Â Â Â ", @ScratchVar), 8), %char( 13), %char( 10))}
#TRIGGER {^~"%w(%d)~"Â Â Â Â Â Â Â Â Â Â Â Â Â Â (*)} {LabelVar = %concat( %left( %concat( %1, "Â Â Â Â Â Â Â Â "), 9), %2)}
#CLASS 0
To set up your dEnchantments variable, you can edit it manually, change it to Data Record, and enter entries with Mercy in the first column and 12345 in the second. Or you can key in commands like this:
CODE
#ADDKEY dEnchantments Mercy {12345}
Whatever is added to that variable is what will be listed, so add them all.
P.S.: Nitpicks about the details of my obviously faked output will be met with stony silence. Or perhaps free gifts. You decide. (Guidos need not apply, temporary or otherwise.)
Tiran2006-09-25 23:59:08
CODE
*******************************************************************************
Id      Name                          Status    Spell      Charges Months
-------------------------------------------------------------------------------
12345    a sapphire ring of waves      worn      waterwalk  7      24
12345    braided slave collar with onyx worn                0      69
12345    a simple platinum wedding band worn                0      214
12345    an amethyst and sapphire ring  worn      perfection 6      102
12345    an onyx and pearl ring        worn      beauty    6      92
12345    a moonstone and garnet ring    worn      mercy      6      92
12345    a sapphire and diamond ring    worn      kingdom    6      84
12345    a Scroll of Curses            scroll    cursed scr 50      52
12345    a Scroll of Disruption        scroll    disruption 50      52
12345    a Scroll of Healing            scroll    healing sc 50      52
12345    a Scroll of Protection        scroll    protection 49      52
*******************************************************************************
There's a sample output from magiclist, with ID numbers removed. You get months as well as worn/unworn, but nothing that's in your pack. Scrolls are also in there, which is useful to keep track of, due to their tendancy to become balls of flame if read too much. Note that the items with no spell are cursed, which is why they're showing up, but there's really no need to have those in a final version.
So the only thing that would be awsome to have added to yours, or maybe in a seperate command, would be the scrolls.
Gwylifar2006-09-26 13:54:19
If a magic scroll, when probed, has a line saying:
It is enchanted with the Wombat spell, holding 27 charges.
Then it'll already work with them. Just add them to the enchantments list like anything else.
If it doesn't, then I'd have to see what it does have. (Also, if the bit where it says what it's enchanted with is multiple words, that might require a change in my trigger.)
It is enchanted with the Wombat spell, holding 27 charges.
Then it'll already work with them. Just add them to the enchantments list like anything else.
If it doesn't, then I'd have to see what it does have. (Also, if the bit where it says what it's enchanted with is multiple words, that might require a change in my trigger.)
Arix2006-09-26 20:50:20
*zaps Gwylifar with the Wombat spell*
lydin2007-01-03 06:57:11
I was gonna post one of those, but you beat me! Here's mine for kicks. Maybe someone will create a hybrid super enchantment script... that blows up heads.
It actually stores the number of the item and the number of charges in vars which you can play with using other scripts (i check charges before reading a healing script so it doesn't blow up, for example), but has a MUCH less cool display. Mad props on the display.
-You'll have to INFO INV to get the list of shtuff, and then use JLIST to probe them all (spammy!).
-SHOWCH to show the charges of things. Yes, that's the only display!
-Mine also uses the stored item numbers recharges everything from an energy cube with CHARGE.
-It deals with scrolls. The text giving their charges is slightly different.
-And it'll strip you of jewelry for begging using the stored item numbers, if you care.
So, in short, don't use mine unless you care about the numbers of the items and the number of charges they're holding being stored in variables. If you want to track changes dynamically you just need to do something like #TR {You read a healing scroll} {#ADD healingenchant.charges -1}.
Here's my version:
#CLASS {enchants}
#ALIAS charge {#FO @enchants {recharge @%i.number from %1}}
#ALIAS strip {#FO @jlist {remove %i}}
#ALIAS unstrip {#FO @jlist {wear %i}}
#ALIAS jlist {#FO @jewelrylist {probe %i;#wait 300}}
#ALIAS wat {rub @waterwalkenchant.number}
#ALIAS merc {rub @mercyenchant.number}
#ALIAS king {rub @kingdomenchant.number}
#ALIAS showch {#SHOW Enchantments:;#SHOW %format( "&-10s &-7s &-9s", "Spell", "Charges", "Number");#FO @enchants {#SHOW %format( "&-10s &-7.0f &-9s", @%i.spell, @%i.charges, @%i.number)}}
#ALIAS save {#VAR %1 @%1 @%1}
#VAR probenum {0} {0}
#VAR jewelrylist {} {}
#VAR enchants {} {}
#TRIGGER {It is enchanted with the ({protection|cursed|healing}) script spell, holding (%d) charges.} {#VAR %1enchant "" "" {enchants};#ADDKEY %1enchant number @probenum;#ADDKEY %1enchant spell %1;#ADDKEY %1enchant charges %2;save %1enchant;#ADDITEM enchants %1enchant;save enchants;#VAR %1enchant //display}
#ONINPUT {probe (*)} {#VAR probenum %1 0 {enchants}}
#TRIGGER {^It is enchanted with the (%w) spell, holding (%d) charges} {#VAR %1enchant {} {} {enchants};#ADDKEY %1enchant spell %1;#ADDKEY %1enchant charges %2;#ADDKEY %1enchant number @probenum;save %1enchant;#ADDITEM enchants %1enchant;save enchants;#VAR %1enchant}
#TRIGGER {~"({ring|necklace|scroll|bracelet}(%d))} {#ADDITEM jewelrylist %1;save jewelrylist}
#CLASS 0
All hail Gwylifar for her pretty enchantlist emulation! But, maybe the addition of my code will help some script addict do something cool.
It actually stores the number of the item and the number of charges in vars which you can play with using other scripts (i check charges before reading a healing script so it doesn't blow up, for example), but has a MUCH less cool display. Mad props on the display.
-You'll have to INFO INV to get the list of shtuff, and then use JLIST to probe them all (spammy!).
-SHOWCH to show the charges of things. Yes, that's the only display!
-Mine also uses the stored item numbers recharges everything from an energy cube with CHARGE
-It deals with scrolls. The text giving their charges is slightly different.
-And it'll strip you of jewelry for begging using the stored item numbers, if you care.
So, in short, don't use mine unless you care about the numbers of the items and the number of charges they're holding being stored in variables. If you want to track changes dynamically you just need to do something like #TR {You read a healing scroll} {#ADD healingenchant.charges -1}.
Here's my version:
CODE
#CLASS {enchants}
#ALIAS charge {#FO @enchants {recharge @%i.number from %1}}
#ALIAS strip {#FO @jlist {remove %i}}
#ALIAS unstrip {#FO @jlist {wear %i}}
#ALIAS jlist {#FO @jewelrylist {probe %i;#wait 300}}
#ALIAS wat {rub @waterwalkenchant.number}
#ALIAS merc {rub @mercyenchant.number}
#ALIAS king {rub @kingdomenchant.number}
#ALIAS showch {#SHOW Enchantments:;#SHOW %format( "&-10s &-7s &-9s", "Spell", "Charges", "Number");#FO @enchants {#SHOW %format( "&-10s &-7.0f &-9s", @%i.spell, @%i.charges, @%i.number)}}
#ALIAS save {#VAR %1 @%1 @%1}
#VAR probenum {0} {0}
#VAR jewelrylist {} {}
#VAR enchants {} {}
#TRIGGER {It is enchanted with the ({protection|cursed|healing}) script spell, holding (%d) charges.} {#VAR %1enchant "" "" {enchants};#ADDKEY %1enchant number @probenum;#ADDKEY %1enchant spell %1;#ADDKEY %1enchant charges %2;save %1enchant;#ADDITEM enchants %1enchant;save enchants;#VAR %1enchant //display}
#ONINPUT {probe (*)} {#VAR probenum %1 0 {enchants}}
#TRIGGER {^It is enchanted with the (%w) spell, holding (%d) charges} {#VAR %1enchant {} {} {enchants};#ADDKEY %1enchant spell %1;#ADDKEY %1enchant charges %2;#ADDKEY %1enchant number @probenum;save %1enchant;#ADDITEM enchants %1enchant;save enchants;#VAR %1enchant}
#TRIGGER {~"({ring|necklace|scroll|bracelet}(%d))} {#ADDITEM jewelrylist %1;save jewelrylist}
#CLASS 0
All hail Gwylifar for her pretty enchantlist emulation! But, maybe the addition of my code will help some script addict do something cool.