EQ Handling Script

Posted by Magnum on Sun 24 Feb 2002 12:41 AM — 9 posts, 32,860 views.

Canada #0
Well, This is my latest project. I would like to write script that handles EQ gracefully. The script should be able to accomodate multiple EQ sets, and the storage of EQ.

Ages of Despair works on a system where equipment must be stored in secure places, or it will be destroyed at the end of the mud day (reboot).

One method of storage is to rent a 'locker' for 500 coins a day, which can store 10 items (by dropping them on the floor in the locker). I am beyond the need for using a locker.

The other, more preferable method, is to use one or more 'chests' in a house. These are very expensive. 500k to buy a house, and 250k to buy a chest. Once bought, you don't have to pay rental fees. This is the mothod advanced players (including myself) use.

I have actually advanced to the point where i have two seperate rooms in my house for 'everyday' EQ. One room is dedicated to SOLO EQ, and the other is dedicated to PARTY EQ. (There are advantages to wearing different items according to your role).

My initial idea was to create an "EQ_TYPE" variable. This would store the name of the current EQ set being used. The "EQ_TYPE" can be changed via alias, or via trigger. (I plan on making triggers so when I enter my solo room, it automatically sets "EQ_TYPE" to "Solo", and similar for "Party".

The script would keep an array, or series of variables for "Current_EQ". These are the variables that would be used when interactions are made in the MUD, such as wearing or removing the EQ, Poisoning the weapon in your hand, etc. (All via standard aliases). For example:

alias pw
send unwield @Current_EQ_lhand
send smear @Current_EQ_lhand
send wield @Current_EQ_lhand in left hand

When the EQ_TYPE is changed via alias or trigger, the new type is 'loaded' into "Current_EQ".

If you would like to change an item in one of the sets. You would 'load' that set, then use an alias to declare that value. For example:

eqset cloak cloak of rahls
- would set "@Current_EQ_Cloak" to "cloak of rahls"

Whenever an item is declared like this, the modified "Current_EQ" would be 'saved' as the new values for the current "EQ_TYPE".

All of this seems straight-forward enough for me to code. I think i would prefer to actually 'load' and 'save' EQ sets to a file, to save on memory usage. That will be something I need to learn by using advice elsewhere on these boards.

Now, here is where a wrench gets thrown into the works:

It's pretty much a requirement that I also include the item's storage location as part of the Eq_Set. What I end up with, is a record like this:

ItemType ..... ItemName ..... Storage Location
-------- ..... -------- ..... ----------------
head ......... helmet ....... bluechest
feet ......... boots ........ bluechest
lhand ........ dagger ....... redchest
extra 1 ...... poison ....... blackchest
extra 2 ...... poison ....... blackchest

With that information, I can construct GetAll and DropAll aliases that will work no matter which EQ_Set is in use. (Provided the player is in the correct 'room'). It would also make it possible for players to have their solo and party eq in the same chests, though they would probably have to manually change EQ_TYPE via alias.

I would prefer to not "open chest, get item from chest, close chest" for each individual item. It's not very efficient. It would make more sense to "open chest, get this from chest, get that from chest, close chest, open chest2, get this from chest, get that from chest, close chest2". In other words, open one chest, get all from that chest that is required, then close that chest, and repeat on another chest as required.

Of course, that could be done with scripting, but it would require some rather complex coding, so before I get started I am brainstorming to see if, perhaps, there might be a better way to accomplish this grand task.
Canada #1
Regarding the chest issue, I think I will take a simple approach to scripting interactions with them:

The GetAll and DropALL script subroutines will look to see if the next item in the array also uses the same chest. If so, it will do nothing (leaving the chest open). If the following item in the array belongs to a different chest, the script will close the current chest. I suppose I will also have to check the previous item in the array as well. If it uses the same chest, I can assume it's still open (do nothing), otherwise open the chest.

This means that it is still possible that some chests may be opened and closed multiple times during a 'Get/Drop All' operation, but it's a good compromise between inefficiency and complexity on this matter.
USA #2
Maybe this is a stupid question, but is there a reason you can't just leave the chests open all the time? It's not like you need to lock them, it sounds like.
USA #3
Because:

A) you can share your house with up to 5 other people and there is no way to add locked doors to rooms you don't want someone else in.

and B) There is some sort of really strange bug that had been known to eat things over reboot in very rare cases if the chests are left open.

Those reasons good enough. ;)
Canada #4
As stated, if the chests are not closed during reboot, you risk losing all EQ that is sitting in the chests.

A preliminary version of this script is done!

http://www.MagnumsWorld.com/muds

So far you can:


eqt *    (Use to declare the Current EQ Type.)
eqset *  (Use to declare an item in your current EQ Type.)
eqlist   (Use to list the items in your current EQ Type.)
eqg      (Use to get items from their configured locations.)
eqd      (Use to store items in their configured locations.)
eqon     (Use to wear/wield your configured items.)
eqoff    (Use to remove/unwield your configured items.)


The script does NOT check to make sure you are in the correct room when performing get and drop actions. You gotta do that yourself.

Note that 'eqg' will 'keep all' and 'eqd' will 'unkeep all' when done!

Think of 'EQ Type' as the NAME for your equipment set.

The script does NOT currently handle extra items, just those that your wield\wear\hold. (That's coming next).

There are no extra routines yet, for stuff like 'poison weapon', 'parry', etc...
Amended on Sun 17 Mar 2002 11:05 PM by Magnum
Canada #5
Actually, I just realized, I may not need to create subroutines for 'poison weapon' and stuff like that, they could be done directly with an alias, as long as "expand variables" is checked.

The various EQ items are stored as MushClient variables. All start with "EQ_". The storage location for each item is stored in Mushclient variables that all start with "EQstr_".

To create the aliases listed in the previous message above, type:

/EQ_Install

..at the command line (once the script is installed). One of the first things you will want to do is use the "eqt" alias to name your [first] set of EQ.

Next, use "eqset" to tell mushclient what item you use for each location. The locations you don't use should be set to "none". For the storage location, enter "-none" if the item is not storable, "-locker" if you want the item to be dropped when you use the "eqd" alias (or picked up from the floor when you use the "eqg" alias). For chest names, enter the chest name preceded by a "-", as the second argument (with "eqset" alias).

If you type "eqset bogus", you will be informed the arguments are not correct, and be told how to format them.

The other aliases should be straight-forward. As stated, manually go to the appropriate storage room before using "eqg" and "eqd".

Use "eqon" to equip all your items (that you are carrying), and "eqoff" to unequip them.

I'll start work on adding the ability to configure extra items soon. (Items you don't equip, but want to be picked up/dropped from storage locations anyway).

There are a few things needed in your main script file, be sure to grab them from "AOD_Main.vbs" in the zip file at my site, and MAKE SURE you edit the main code so that "ScriptPath" points to the directory with "AOD_EQ.vbs" in it. The EQ script also uses this path as the location for storing files. (One file is created for each EQ_Type you establish).

Let me know if you find any bugs. The script is reasonably fool-proof, but not completely. Editing the EQ files directly may cause problems, especially if you alter the number of lines. As of this moment, I haven't actually tested using the script in a locker, though it should work.
Canada #6
I've decided I won't put miscelaneous aliases in the \EQ_Install. ...Instead, I'll document some that I use here, and leave you to create what you want:

Alias: parry
Checked boxes: Enabled, Expand Variables
Send:
  unwield @EQ_lweap
  parry on
  wield @EQ_lweap in left hand

Alias: pw
Checked boxes: Enabled, Expand Variables
Send:
  unwield @EQ_lweap
  smear poison on @EQ_lweap
  wield @EQ_lweap in left hand

Alias: fixl
Checked boxes: Enabled, Expand Variables
Send:
  buy 2 @EQ_lweap
  reveal item @EQ_lweap
  wield @EQ_lweap in left hand

Alias: fixr
Checked boxes: Enabled, Expand Variables
Send:
  buy 2 @EQ_rweap
  reveal item @EQ_rweap
  wield @EQ_rweap in right hand

Alias: fixa *
Checked boxes: Enabled
Send:
  buy 1 %1
  reveal item %1
  wear %1
Amended on Wed 03 Apr 2002 04:36 AM by Magnum
Canada #7
I've uploaded a new version to my site.

http://www.MagnumsWorld.com/muds

This newer version includes a "eqhelp" alias, and provides detailed help for all of the other aliases.

For example, you can use "eqhelp eqset" to get help for the "eqset" alias. Use "eqhelp" by itself for general help, and a list of the aliases.

I'm still planning on implementing code to handle miscellaneous items that aren't worn/wielded/held... I just haven't gotten around to it yet.
Canada #8
Whew! I'm all done!

I've written the code to handle 'extra' items that you don't hold, wield or wear. (The ones you just carry around).

Two new aliases have been added for the task: eqxa and eqxr.

Here's a copy and paste from 'eqhelp':

The following aliases are available for manipulating your EQ:
 
eqt:    Declare the name of the equipment set you would like to use.
eqset:  Declare an individual item & chest in the current equipment set.
eqxa:   Add an extra! item & chest in the current equipment set.
eqxr:   Remove an extra! item & chest from the current equipment set.
eqlist: List all items in the current set of equipment.
eqg:    Get all items from their configured locations.
eqd:    Drop/Put all items in their configured locations.
eqon:   Hold/Wear/Wield all items in your current equipment set.
eqoff:  Remove/Unhold/Unwield all items in your current equipment set.
 
Use 'eqhelp <Alias>' for detailed help for an alias.
 
! Extra items are those that are not held/wielded/worn.
 
Each set of EQ is stored in a text file, in the same directory as this script file.
The only way to delete a set of EQ is to delete the file manually. Sorry.
 
If this is your first time using the script, you will want to name your
first set of EQ, using the 'eqt' alias, before doing anything else.

As my help file says, there is no way to delete a whole set of EQ. (No way to delete the file). Frankly, I don't feel like coding such an alias. For me, it's not a problem to browse to the directory and delete it manually. If there are a lot of requests, maybe I'll make it so you can delete via alias from MushClient.

I would like to consider this script complete now. If you find bugs, or have SMALL requests, I'll look into them.

Perhaps soon, I'll build a webpage for this scriptfile, so you can learn about it easily without implementing it. ...I know, reading about how to use it here may be confusing, since this thread EVOLVED.

Once again, my script can be found here:
http://www.MagnumsWorld.com/muds

Best of luck to you in your adventures!

(Nick, you may want to move this thread to "Tips & Tricks".

Done. Amended to turn on 'forum codes'. - Nick