Weapon Switcher

Scripts and support for your favorite MUD client.
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Weapon Switcher

Postby Jorus » Sun Nov 18, 2001 6:02 am

This alias will switch weapons between up to four "modes", and can be adapted for more variations, of course (such as floating versions of all modes, etc).

Let me know if there are any changes any of you would like made.

Just create the following variables:
@1hweap (primary hand 1h weapon)
@shield (duh)
@bow (duh)
@2hweap (2handed weapon)
@offhandweap (secondary hand 1h weapon)

Usage is as follows: "weapmode <mode>" where the modes are contained in the variable "weapomodes"

#var weapmodes {bash|2h|dual|bow}

#ALIAS weapmode {#case %ismember(%1,@weapmodes) {#case %ismember(@weapmode, @weapmodes) {#null} {gb @shield;gb @1hweap;rem @2hweap;wear @shield;wield @1hweap;pb @2hweap} {gb @shield;rem @offhandweap;wear @shield;pb @offhandweap} {gb @shield;gb @1hweap;rem @bow;wield @1hweap;wear @shield;pb @bow} {#sa bug};#var weapmode bash} {#case %ismember(@weapmode, @weapmodes) {gb @2hweap;rem @shield;rem @1hweap;wield @2hweap;pb @shield;pb @1hweap} {#null} {gb @2hweap;rem @1hweap;rem @offhandweap;wield @2hweap;pb @1hweap;pb @offhandweap} {gb @2hweap;rem @bow;wield @2hweap;pb @bow} {#sa bug};#var weapmode 2h} {#case %ismember(@weapmode, @weapmodes) {gb @offhandweap;rem @shield;wield @2hweap;pb @shield} {gb @1hweap;gb @offhandweap;rem @2hweap;wield @1hweap;wield @offhandweap;pb @2hweap} {#null} {gb @1hweap;gb @offhandweap;rem @bow;wield @1hweap;wield @offhandweap;pb @bow} {#sa bug};#var weapmode dual} {#case %ismember(@weapmode, @weapmodes) {gb @bow;rem @1hweap;rem @shield;wield @bow;pb @1hweap;pb @offhandweap;pb @1hweap} {gb @bow;rem @2hweap;wield bow;pb @2hweap} {gb @bow;rem @1hweap;rem @offhandweap;wield @bow;pb @1hweap;pb @offhandweap;pb @1hweap} {#null} {#sa bug};#var weapmode bow} {#var weapmodes;#sa not a mode}}
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Mon Nov 19, 2001 12:54 am

Two thing I forgot to include, to make that alias work is the following:

#al gb {get %-1 @bag}
#al pb {put %-1 @bag}

#var bag {yourbag}

Regards,
Jorus
Snurgt
Sojourner
Posts: 301
Joined: Sat Sep 15, 2001 5:01 am
Contact:

Postby Snurgt » Thu Nov 22, 2001 5:38 pm

Hey Jorus how would you change that so instead of bow and dual, you have 1h float and 2h float for instance?
Gromsharulaz
Sojourner
Posts: 54
Joined: Mon Jan 29, 2001 6:01 am

Postby Gromsharulaz » Fri Nov 23, 2001 2:57 am

Since we clerics and the silly mage types don't need insane configurations of weapons here's the weapon switching alias that's been on Grom for years. It works for any weapon you want to wield and know a unique keyword for.

#alias {wld} {rem @weapon;
get %1 @bag;
wield %1;
put @weapon @bag;
#var weapon %1} {weapons}

Usage:
wld hammer
wld mist
wld dagger
etc.

Also since the variable @weapon always contains your current weapon's keyword your fumble trigger only needs to do a get @weapon;wield @weapon

To complete the set here's the other two I rarely but still sometimes use to switch between wearing a shield and holding something:

#alias {hld} {rem @held;
get %1 @bag;
hold %1;
put @held @bag;
#var held %1} {weapons}

#alias {shld} {rem @held;
get %1 @bag;
wear %1;
put @held @bag;
#var held %1} {weapons}

Usage:
hld egg
shld alligator
etc.

The one thing I never bothered to do was code it to hold two items - if you want to switch to holding an egg instead of wielding a dagger you have to do that manually or use that spanky alias of Jorus's up there. Sorry but I'm lazy and like wielding my mace :P

Oh and stating the obvious, you need to create the variables bag, held and weapon and set them to your current stuff.

Gromsharulaz, Fat & Lazy Derro of the Underdark
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Sat Nov 24, 2001 3:40 am

Snurgt,

I'll post a version that is a _little_ bit simpler to configure and understand, using aliases, etc.

Regards,
Jorus
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Sat Nov 24, 2001 3:47 am

Err, rather, I'll post a version that has a few more options.

Regards,
Sam
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Sun Nov 25, 2001 9:43 pm

Here's a new version with the added ability to provide "floating" weapon control for all modes (or just alternate weapons).

Usage:

To get information about current "state":
weapmode
(or give invalid input, such as "weapmode abc")

To change modes:
weapmode <mode>

To enter floating weapons mode (when it is off):
weapmode float
(your overall "mode" will be preserved, eg, if you were bashing before, you'll be able to bash after)

To leave floating weapons mode (when it is on):
weapmode float
OR
weapmode <mode>
Using an option other than float will first switch you out of floating mode, then switch you to the new mode. Rather spammy, but simpler, the assumption being that changing between functions while on water is somewhat rare. I can change that behaviour if you like, but it'll take a bit.

Enjoy (script is below)!

Jorus

#var weapmodes {bash|2h|dual|bow|float}

#var 2hweap {}
#var 1hweap {}
#var offhandweap {}
#var shield {}
#var 2hfloatweap {}
#var 1hfloatweap {}
#var offhandfloatweap {}

#al switchweap {#if (!%null(%1) & !%null(%2) & (%1 <> %2)) {gb %2;rem %1;#if (%3 = "shield") {wear %2} {wield %2};pb %1}}

#ALIAS weapmode {#if ((@FloatWeapsOn) & (%1 <> float)) {weapmode float};#case %ismember(%1,@weapmodes) {#case %ismember(@weapmode, @weapmodes) {#null} {gb @shield;gb @1hweap;rem @2hweap;wear @shield;wield @1hweap;pb @2hweap} {switchweap @offhandweap @shield shield} {gb @shield;gb @1hweap;rem @bow;wield @1hweap;wear @shield;pb @bow} {#sa bug};#var weapmode bash} {#case %ismember(@weapmode, @weapmodes) {gb @2hweap;rem @shield;rem @1hweap;wield @2hweap;pb @shield;pb @1hweap} {#null} {gb @2hweap;rem @1hweap;rem @offhandweap;wield @2hweap;pb @1hweap;pb @offhandweap} {switchweap @bow @2hweap} {#sa bug};#var weapmode 2h} {#case %ismember(@weapmode, @weapmodes) {switchweap @shield @offhandweap} {gb @1hweap;gb @offhandweap;rem @2hweap;wield @1hweap;wield @offhandweap;pb @2hweap} {#null} {gb @1hweap;gb @offhandweap;rem @bow;wield @1hweap;wield @offhandweap;pb @bow} {#sa bug};#var weapmode dual} {#case %ismember(@weapmode, @weapmodes) {gb @bow;rem @1hweap;rem @shield;wield @bow;pb @1hweap;pb @offhandweap;pb @1hweap} {switchweap @2hweap @bow} {gb @bow;rem @1hweap;rem @offhandweap;wield @bow;pb @1hweap;pb @offhandweap;pb @1hweap} {#null} {#sa bug};#var weapmode bow} {#if @FloatWeapsOn {#case %ismember(@weapmode, @weapmodes) {switchweap @1hfloatweap @1hweap} {switchweap @2hfloatweap @2hweap} {switchweap @1hfloatweap @1hweap;switchweap @offhandfloatweap @offhandweap} {switchweap @floatbow @bow} {#null};#var FloatWeapsOn 0} {#case %ismember(@weapmode, @weapmodes) {switchweap @1hweap @1hfloatweap} {switchweap @2hweap @2hfloatweap} {switchweap @1hweap @1hfloatweap;switchweap @offhandweap @offhandfloatweap} {switchweap @bow @floatbow} {#null};#var FloatWeapsOn 1}} {#sa not a mode, valid modes are %replace(@weapmodes,"|",", ");#sa current mode: @weapmode;#sa Floating: %if(@floatweapson, On, Off)}}

Edited to add the "state" reporting option.

[This message has been edited by Jorus (edited 11-25-2001).]
Snurgt
Sojourner
Posts: 301
Joined: Sat Sep 15, 2001 5:01 am
Contact:

Postby Snurgt » Wed Nov 28, 2001 2:22 am

Thanks alot Jorus!
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Thu Nov 29, 2001 5:46 am

Hi Snurgt,

Sure thing!

A comment about the variables: If you don't have a water weapon for any slot (eg, bow as an example, I don't think you fumble those much :P) you can just leave the variable as "null", though you should make sure it's defined, or you can define the variable as the same word as your non-water weapon, and the alias won't even take your original bow off.

A comment on keywords, too:

Make sure you pick a keyword that is unique to the contents of your "@bag" variable. For example, "iron" is a very bad keyword to pick, as you can't wield rations! I'll leave finding a functional combination to you though.

Regards,
Jorus
Zen
Sojourner
Posts: 411
Joined: Fri Aug 31, 2001 5:01 am
Location: Michigan

Postby Zen » Sun Jun 30, 2002 9:07 pm

Hey, I just installed your weapons switcher and it seems to have the following error: If you are in any weapon mode but 2handed and try to switch to dual it tries to wear your second weapon. It also does this when switching to floating weapons.

Also, could you also make it so that the weaponswitcher has a no weapon mode we could switch too whenever hitting a shielded mob?

Thanks.

-Lorgan

------------------
The Lord of the Iron Wastes holds his hammer high in the air, shouting a torment... 'Weak fools!'
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Mon Jul 01, 2002 10:05 am

Zen,

Replace the "switchweaps" alias with the following:

#if (!%null( %1) & !%null( %2) & (%1 <> %2)) {
gb %2
rem %1
#if (!%null( %3)) {wear %2} {wield %2}
pb %1
}

There's no need to compare the body of %3 to "shield" since it is only ever present to indicate that a shield is the desired new item (this type of testing seems fairly error-prone in zmud anyways). It's much more useful as a simple flag.

Regards,
Jorus

Return to “MUD Client Help”

Who is online

Users browsing this forum: No registered users and 18 guests