View Single Post
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