Druid Potion Plugin

Posted by Shadowfyr on Sat 10 Aug 2002 11:40 PM — 8 posts, 30,381 views.

USA #0
There is now a plugin for Ages of Despair posted at Magnum's website:
http://www.magnumsworld.com/muds

This is version 1.00. While I think I have fixed all problems it had, there may be a few hiding in it. It works by watching while you forage and learning the herbs. The later, when you create a potion, it also adds that to its lists. By typing 'potions:' it will give you a list of all known potions it has learned and how many you can make with the herbs you are carrying. Right now, if you have given it information about a potion, but it does not yet know of the herbs used in it, the plugin will not recognize them in you inventory.

While this problem was intentional (it shouldn't know something you don't) it is also the most likely source for any existing bugs. For this reason I plan to change this, so that version 2.00 will have the herbs hard coded into the plugin. However, the current version is functional. ;)

If you anyone plans to adapt this to another mud.. Good luck. It won't be easy and will void your warrenty. ;) lol
USA #1
Hmm.. Did I mention how I use a hard coded version of this and used my Phantom program to test it... Sigh...

I am running a 'real' test on version 2 today and should have it posted soon. I hard codes some things that where making the code too complex and testing difficult. It also fixes the output from different subs, so that all of them should now use the plugins color settings and you can now set the error color (which you couldn't before).

One feature that is not likely to happen is that in my completely hard coded version, the script can keep track of potions that share common components and list the number that can be made, if you made the same number of each one. There is no easy way to do this, so unless I put out a version 3.0, it won't be available in the plugin.

Looks like a missed a few things in version 1.0. :p

Known bugs -

1. Half a dozen debug tags didn't get removed.
3. In the Calc_Potions sub the groupings should be
   4 or 5
   1 or 3 or 5
   2 or 3 or 5  <- this last one is wrong and may glitch even if fixed. :p

Which brings up another interesting problem... Seems the 'Not' operator in vbscript won't work at all. Something like:

fnd = TRUE
fnd2 = TRUE
test = not fnd and fnd2
world.note test

will produce -2, when it should be FALSE. It also produces -2 if both conditions are TRUE. :p

To fix it you can use:

fnd = TRUE
test = (abs(fnd) xor 1) and fnd2
world.note test

This has essencially the same effect as 'Not' was supposed to have, however it likely wouldn't work if fnd is anything other than 0, 1 or -1.

If anyone can figure out why 'Not' won't work, please tell me.
Amended on Sun 11 Aug 2002 06:53 PM by Shadowfyr
Australia Forum Administrator #2
Quote:

fnd = TRUE
fnd2 = TRUE
test = not fnd and fnd2
world.note test

will produce -2, when it should be FALSE. It also produces -2 if both conditions are TRUE. :p


First, both conditions *are* true, second I cannot reproduce that.

This script in the immediate window prints "0":

dim fnd, fnd2, test
fnd = TRUE
fnd2 = TRUE
test = not fnd and fnd2
world.note test


Your problem - whatever it is exactly - might be operator precedence. Do you mean:

test = not (fnd and fnd2)

or

test = (not fnd) and fnd2
USA #3
test = (not fnd) and fnd2

It just does not work. It seems to be treating not as a variable instead. Or maybe because the values where integer instead of simply TRUE and FALSE. Sigh.. I just couldn't seem to find any way to get it to work.

Biggest problem with vbscript is since everything is type Variant, vbscript commands need to constantly guess whether you are looking at a value, true/false, string, etc. and half the time it gets it wrong. In the case of not my problem was that the value being checked was from an InStr command. I had to change that to set a variable to 0 or 1. So (if fnd) when fnd = 6 will be TRUE, but (not fnd) bugs and returns -2. Worse.. my fix of using (fnd xor 1) would return 6. :p

It is a major pain in the rear.
Australia Forum Administrator #4
test = (not CBool (fnd)) and CBool (fnd2)
USA #5
Oh... Duh. Of course it would be something obvious like that. lol

Of course now I don't need it... But thanks. ;)
Canada #6
Could you use the functions "World.Base64Encode" and "World.Base64Decode" to hide certain data within the plugin? (The data that would provide illegal info sharing according to mud law).

It might be easier to use such functions rather than build a complex, self learning script.
Australia Forum Administrator #7
You could use them but it would only be a rudimentary form of data hiding. Anyone could use the built-in notepad to get the data back.