Thread Tools Display Modes
06-05-05, 09:02 PM   #1
Shadowdancer
A Murloc Raider
Join Date: Jan 2005
Posts: 5
Script for toggling sheath/unsheath weapons

The WoW forums weren't very helpful on this subject, so maybe you folks here can provide some insight . I really like the way my hunter looks when he's running around with the bow in hand and quiver on his back. Currently, the only way I can get him to do this is by double-tapping the key I have bound for sheathing your weapons, but it goes away every time I talk to someone or loot a body. Is there some way I can write a macro or script that will have my character automatically keep his bow unsheathed, after talking with an NPC or looting a monster? And if there can be such a thing written, how do I keep it in effect after I log in and out of the game? Thanks a lot for any future responses!
  Reply With Quote
06-05-05, 09:47 PM   #2
nota
A Deviate Faerie Dragon
 
nota's Avatar
AddOn Author - Click to view addons
Join Date: May 2005
Posts: 12
Press 'z' on your keyboard?
  Reply With Quote
06-05-05, 10:46 PM   #3
Cairenn
Credendo Vides
 
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 7,134
Originally Posted by nota
Press 'z' on your keyboard?
I think that is what Shadowdancer meant by this:

Originally Posted by Shadowdancer
Currently, the only way I can get him to do this is by double-tapping the key I have bound for sheathing your weapons
  Reply With Quote
06-06-05, 05:17 AM   #4
Shadowdancer
A Murloc Raider
Join Date: Jan 2005
Posts: 5
Right, I am pressing 'Z', but the problem is it gets resheathed every time I loot a mob or talk to an NPC, and that's what I want to change. It should be a relativly easy script, as it's only duplicating a key being pressed after a certain event, but I have no idea how to program, so here I am
  Reply With Quote
06-06-05, 08:05 AM   #5
Beladona
A Molten Giant
 
Beladona's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 539
do the following:

make a new folder in your AddOns and call it sheathmod or something like that. Then create the following files within that directory:

sheathmod.toc
Code:
## Interface: 1300
## Title: Sheath / Unsheath Auto-Toggle
## Notes: When weapons are sheathed during certain game events, this automatically unsheaths them again. Unsheath thy naked weapon! (Romeo & Juliet)
sheathmod.xml
sheathmod.xml
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">	
	<Script file="sheathmod.lua"/>
	<Frame parent="UIParent"><Scripts><OnLoad>sheathmod.onLoad();</OnLoad><OnEvent>sheathmod.onEvent();</OnEvent></Scripts></Frame>
</Ui>
sheathmod.lua
Code:
sheathmod = {};
------------------------------------------------------
sheathmod.onLoad = function()
	this:RegisterEvent("GOSSIP_CLOSED");
end;
sheathmod.onEvent = function()
	DoEmote("FLEX"); -- cheesy, but it puts your weapons away, so we start fresh with no weapons...
	ToggleSheath();
	ToggleSheath(); -- doing this twice, to switch from standard melee to ranged weapon
end;
Basically what happens is, when you talk to someone, the game automatically performs the /talk emote. Every animated emote makes your weapons go away. As for your weapons going away during other events, you may have to experiment and look for other events that might be firing when certain things happen. I will leave that up to you to discover, and will help in this thread if you need it. Just add this:RegisterEvent("EVENT_NAME"); along with the other one in the lua script, and it should work. Try to do events that are fired when something is CLOSED, like when the loot window is closed, or the talk window is closed (already included)

You can find a somewhat comprehensive list of game events at http://www.wowwiki.com/Events

I did NOT test this myself, so I will leave that up to you to do on your own. I also didn't give the frame a name in the xml file, because it really doesn't need one (since it is basically invisible anyway, and doesn't appear anwhere, so should not need to be called, and as Blizzard tells us, no name = less memory used since it doesn't use a scripting reference)

Last edited by Beladona : 06-06-05 at 08:07 AM.
  Reply With Quote
06-06-05, 04:39 PM   #6
Shadowdancer
A Murloc Raider
Join Date: Jan 2005
Posts: 5
I copied and pasted all the code into seperate notepad files and saved every thing as you said, other than I deleted the notes in the lua file. Unfortunatly, it doesn't seem to work as it is, though I honestly appreciate that you've taken the time to help me out. Any ideas?
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Script for toggling sheath/unsheath weapons

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off