[v1.7.0+] Swap Equipment Sets

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
Zizzo
Sher'Tul Godslayer
Posts: 2506
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

[v1.7.0+] Swap Equipment Sets

#1 Post by Zizzo »

Most characters carry some kind of swap-in gear, if only headgear of the depths (or an amulet of the fish :mrgreen: ) for getting through Lake Nur. If you're a skeleton-summoning Necromancer, you probably have a pack full of swap-in gear for snapshotting your summoned skeletons. It's easy, though, to forget that you're still wearing your swap-in gear or what you were wearing before you did all this swapping, and if you're swapping in a lot of gear, it can get tedious prety quickly.

Well, that finally annoyed me enough to motivate me to put together a new addon, creatively named Swap Equipment Sets (that's the v1 node page for downloading purposes, since the addon's main page on te4.org, as apparently continues to be case for all recently added addons, is b0rken; here's the Steam page for reference [edit 2025-02-16: The issue has now been resolved.]). Here's how it works:
  • Tag all the equipment you want to swap in together with e.g. SET:SetName (for whatever SetName you want your equipment set to be named). You can have as many different sets as your inventory allows.
  • In the Swap Equipment Sets dialog (bound by default to <Alt-Shift-X>), your tagged sets should be listed, each with a list of what's in each set. Select your desired swap-in set and click "OK" (or select twice, which is quicker if you're selecting by keyboard).
  • And we're off! This will take one turn per item wielded, as usual, so if you're swapping in a lot of stuff at once, make sure you're somewhere safe.
  • When swapping is done, check your inventory; you should find that all your tagged stuff is now worn, and the stuff you were previously wearing is in your inventory, tagged with SET:SwapBack (about which more below). Also, if you've enabled the new game option "Gameplay | Show marker for swapped-in equipment", you should now have a status indicator in your buffs display to remind you that you'ee wearing swap-in equipment.
  • When you're done with your swap-in equipment and want to put your original equipment back on… well, remember above that all the equipment you swapped out is tagged with SET:SwapBack? That means it's all in the special swap-in set SwapBack, and you can swap it all back in by selecting that set from the dialog. The special tag on your original equipment will be cleared automatically when it's re-wielded.
Now, inventory juggling via addon can be hazardous in the best of cases, so while this all seems to work properly in testing, I do encourage you to check behind it and make sure it's doing stuff right.

[And as noted above, I'm filing this in my "experimental" addons category until I'm more confident in its functioning, but once that's sorted out, I don't see any reason why this couldn't go into ZOmnibus or ZOmnibus Lite.]

[Implementation notes:]

Code: Select all

Hooks:
  ToME:load [to load our effects and add our keybinding]
  GameOptions:generateList [to add our game option]
Superload:
  mod.class.Player:
    onWear() [to update our tracker effect]
    onTakeoff() [to update our tracker effect]
  mod.class.Game:
    setupCommands() [to add our action to the keybinding]
Last edited by Zizzo on Sun Feb 16, 2025 8:55 pm, edited 2 times in total.
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2506
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.7.0+] Swap Equipment Sets

#2 Post by Zizzo »

Frequently Asked Questions:

The Swap Equipment Sets dialog is putting my swap-in dagger in the mainhand, but I want it in the offhand.

You can exert some influence over where the Swap Equipment Sets dialog attempts to wield your swap-in equipment by tagging your items with e.g. "SET:SetName=MAINHAND" or "SET:SetName=OFFHAND", which will tell the dialog to attempt to wield your item in, respectively, your mainhand or offhand slots.

[DISCLAIMER: Management takes no responsibility if you attempt to set up an infinite wielding loop using the above mechanism. We do not think that is possible, but the point stands.]

Can the Swap Equipment Sets dialog swap something into my Psionic Focus slot?

Yes, in a manner similar to the previous; if you have the Telekinetic Grasp talent and the corresponding Psionic Focus equipment slot, you can tag your swap-in item with e.g. "SET:SetName=PSIONIC_FOCUS" to tell the Swap Equipment Sets dialog to use Telekinetic Grasp to wield your tagged item in the Psionic Focus slot.

Can I control which ring gets swapped out?

Any worn equipment tagged with a tag that contains the text "SET:noswap" will be disregarded as a potential candidate for swapping out; thus, if you want only a particular ring to be swapped out, you can tag your other worn ring(s) accordingly.

What if my original equipment already has a tag?

The Swap Equipment Sets dialog will attempt to preserve existing tag information when adding its temporary swap-back tag. For instance, if your amulet is tagged "important note", and you replace it with a swapped-in amulet via the dialog, your original amulet should be tagged "SET:SwapBack=NECK|important note", and when you swap it back in, the original "important note" tag should be restored.

(This syntax can also be used to include additional text in an item's tag beyond its set name and optional target slot, although it isn't used by the dialog for any purpose. Thus, for instance, an item in inventory tagged with e.g. "SET:Snapshot|provides +crit" or "SET:Snapshot=FINGER|provides +physdam" will still be recognized as a member of the "Snapshot" swap-in set.)
"Blessed are the yeeks, for they shall inherit Arda..."

Tenkaichi412
Posts: 1
Joined: Wed Jun 11, 2014 2:50 pm

Re: [v1.7.0+] Swap Equipment Sets

#3 Post by Tenkaichi412 »

Blessed be you, Zizzo, the developer of many a useful addons.

I was playing a snapshot necromancer when I got the idea to create something like this to make it easier, but lo and behold you've already made it. (I could've known :lol: )
For anyone attempting the same this addon is a timesaving godsend.

Post Reply