Does anyone know if you can determine whether the GameTooltip is in the process of fading or not ?
I'm interested in getting its Alpha setting, but not if its half way through disappearing...
Mmm, I guess I could, get alpha, and then :Show() it again maybe.... and then set the alpha back.... ???
Saturday, April 21, 2012
How to Copy and Paste one model onto another
Hello, I am new here, and I figured this was the place to ask. But if I wanted to, for example, turn any human model I see in game wearing certain armor and copy and paste it into a lich model, how would I do that?|||Modifying the MPQ files by doing things like replacing models is a violation of the TOS/TOU and will get you perma-banned almost immediately. Don't do it.|||please delete this thread as it is a banned topic.
Slash command is a myth?
Hello All!
Insert standard n00b disclaimer here.
After reading Klishu's sticky tutorial on XML, I was pumped, ready to forge into new ground and make that simple add on not so simple. That's where it all fell apart.
I cannot get the system to recognize a slash command. From all the tutorials and all the examples, one would think this is the easiest next step to do. Yet, I failed. Repeatedly.
If anyone has time to write a little "fix this code here" response, I'd be very grateful.
HelloWorld.toc
Code:
HelloWorld.xml (almost exactly from the Simple.xml)
Code:
HellowWorld.lua
Code:
Once I added the _Onload and _Command functions, I started getting attempted to call global value nil errors. I see that the XML never calls the _OnLoad (If I stick
<Scripts>
<OnLoad>HelloWorld_OnLoad();</OnLoad>
</Scripts>
into any of the frames, I do get the loaded message, but still, no slash commands.)
Any suggestions would be greatly appreciated!!|||Could just be the way I do it but I don't understand this part:
Code:
Shouldn't that just be:
Code:
I do things a little differently. I create an Initialize() function and then just have two lines like this in it:
SLASH_PAWN1 = "/pawn"
SlashCmdList["PAWN"] = PawnCommand
Then, I have a Command(cmd) function defined later on:
function PawnCommand(Command)
Then, at the end of my lua file I set up a tiny invisible frame and wait for the VARIABLES_LOADED event, and then I call PawnInitialize from there, instead of OnLoad for any particular frame or anything like that. This has worked really well for me, and makes it so that the code is the same whether I want a UI or not. Check out one of my mods (Divisor is the simplest) for the code... you'll be interested in [ModName]OnEvent and the little block at the end of the mod's main .lua file. You could either do it like I do with a hidden frame, or since you have an XML file in your mod, you could just add an OnEvent script to your main window and leave out the whole hidden frame process.|||Thanks all! I got it finally... after I noticed the typo in "HellowWorld" I appreciate the help!
Insert standard n00b disclaimer here.
After reading Klishu's sticky tutorial on XML, I was pumped, ready to forge into new ground and make that simple add on not so simple. That's where it all fell apart.
I cannot get the system to recognize a slash command. From all the tutorials and all the examples, one would think this is the easiest next step to do. Yet, I failed. Repeatedly.
If anyone has time to write a little "fix this code here" response, I'd be very grateful.
HelloWorld.toc
Code:
## Interface: 20300
## Title: HelloWorld
## Notes: Not so simple anymore!
## Dependencies:
HelloWorld.xml
HelloWorld.xml (almost exactly from the Simple.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="HellowWorld.lua" />
<Frame name="HelloWorldFrame" visible="true" parent="UIParent">
<!-- set the size of the frame -->
<Size>
<AbsDimension x="200" y="133"/>
</Size>
<!-- set where the frame will be anchored -->
<Anchors>
<Anchor point="CENTER" />
</Anchors>
<!-- define background and borders -->
<Backdrop bgFile="Interface\TutorialFrame\TutorialFrameBackground"
edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<EdgeSize>
<AbsValue val="16"/>
</EdgeSize>
<TileSize>
<AbsValue val="32"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="5" right="5" top="5" bottom="5"/>
</BackgroundInsets>
</Backdrop>
<!-- set the parameters for the text -->
<Layers>
<Layer level="ARTWORK">
<FontString name="HelloWorld_Text" inherits="ChatFontNormal" text="Type in: Hello World">
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="-33" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<!-- buttons and edit box -->
<Frames>
<Button name="HelloWorld_CloseButton" inherits="UIPanelCloseButton">
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-3" y="-3" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>HelloWorld_Close();</OnClick>
</Scripts>
</Button>
<EditBox name="HelloWorld_EditBox" letters="50">
<Layers>
<Layer level="BACKGROUND">
<Texture name="HelloWorld_Background">
<Color r=".2" g=".2" b=".2" a="1"/>
</Texture>
</Layer>
</Layers>
<Size>
<AbsDimension x="190" y="20"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="5" y="-66"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnEnterPressed>HelloWorld_AcceptButton:Click();</OnEnterPressed>
</Scripts>
<FontString inherits="ChatFontNormal"/>
</EditBox>
<Button name="HelloWorld_AcceptButton" inherits="OptionsButtonTemplate" text="GO!">
<Anchors>
<Anchor point="BOTTOM">
<Offset>
<AbsDimension x="0" y="20"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>HelloWorld_ButtonClick();</OnClick>
</Scripts>
</Button>
</Frames>
</Frame>
</Ui>
HellowWorld.lua
Code:
function HelloWorld_OnLoad()
if( DEFAULT_CHAT_FRAME ) then
DEFAULT_CHAT_FRAME:AddMessage("HelloWorld Loaded");
end
local stopVar = 0;
SLASH_HelloWorld1 = "/helloworld";
SLASH_HelloWorld2 = "/hw"; -- A shortcut or alias
SlashCmdList["HelloWorld"] = function(cmd)
HelloWorld_Command(cmd);
end
end
function HelloWorld_Command(cmd)
if (cmd == "1") then
stopVar = 1;
DEFAULT_CHAT_FRAME:AddMessage("HelloWorld Message On");
HelloWorldFrame:Show();
end
if (cmd == "0") then
stopVar = 0;
DEFAULT_CHAT_FRAME:AddMessage("HelloWorld Message Off");
HelloWorldFrame:Hide();
end
end
function HelloWorld_ButtonClick()
DEFAULT_CHAT_FRAME:AddMessage(HelloWorld_EditBox:GetText());
HelloWorld_EditBox:SetText("");
end
function HelloWorld_Close()
HelloWorldFrame:Hide();
end
Once I added the _Onload and _Command functions, I started getting attempted to call global value nil errors. I see that the XML never calls the _OnLoad (If I stick
<Scripts>
<OnLoad>HelloWorld_OnLoad();</OnLoad>
</Scripts>
into any of the frames, I do get the loaded message, but still, no slash commands.)
Any suggestions would be greatly appreciated!!|||Could just be the way I do it but I don't understand this part:
Code:
SlashCmdList["HelloWorld"] = function(cmd)
HelloWorld_Command(cmd);
end
Shouldn't that just be:
Code:
SlashCmdList["HelloWorld"] = HelloWorld_Command(cmd);|||That would just execute HelloWorld_Command and assign its return value nil to that element of SlashCmdList. That line would work without the (cmd) on the end.
I do things a little differently. I create an Initialize() function and then just have two lines like this in it:
SLASH_PAWN1 = "/pawn"
SlashCmdList["PAWN"] = PawnCommand
Then, I have a Command(cmd) function defined later on:
function PawnCommand(Command)
Then, at the end of my lua file I set up a tiny invisible frame and wait for the VARIABLES_LOADED event, and then I call PawnInitialize from there, instead of OnLoad for any particular frame or anything like that. This has worked really well for me, and makes it so that the code is the same whether I want a UI or not. Check out one of my mods (Divisor is the simplest) for the code... you'll be interested in [ModName]OnEvent and the little block at the end of the mod's main .lua file. You could either do it like I do with a hidden frame, or since you have an XML file in your mod, you could just add an OnEvent script to your main window and leave out the whole hidden frame process.|||Thanks all! I got it finally... after I noticed the typo in "HellowWorld" I appreciate the help!
Lua pattern matching
Hi,
i'm having a bit of difficulty getting a pattern to work. I thought what i wanted to do was possible, although now not 100% sure,
I'm trying to create a pattern that will match any string containing one word, for example 'port', unless that occurs in a word from a list of safe-words like 'imPORTant' and 'supPORT'. is it actually possible with pattern matching?
Thanks
stew|||Something like :
Code:
This won't find "Port" with any capital letters, and only finds the word when surrounded by at least one space on either side - so it also wont find "port." (i.e. with a full stop after it)
".*[%s%-][pP][oO][rR][tT][%s%.].*"
...might be more universal...
Not sure off the top of my head, but the first pattern should be reasonable if you are sure it isn't capitalised and is surrounded by spaces.
You should check out the following web site ;)
http://www.lua.org/pil/20.2.html
i'm having a bit of difficulty getting a pattern to work. I thought what i wanted to do was possible, although now not 100% sure,
I'm trying to create a pattern that will match any string containing one word, for example 'port', unless that occurs in a word from a list of safe-words like 'imPORTant' and 'supPORT'. is it actually possible with pattern matching?
Thanks
stew|||Something like :
Code:
local strSrch = "Any port in a storm.";
local strBeg, strEnd, strCap = string.find(strSrch, ".*%s+(port)%s+.*");
This won't find "Port" with any capital letters, and only finds the word when surrounded by at least one space on either side - so it also wont find "port." (i.e. with a full stop after it)
".*[%s%-][pP][oO][rR][tT][%s%.].*"
...might be more universal...
Not sure off the top of my head, but the first pattern should be reasonable if you are sure it isn't capitalised and is surrounded by spaces.
You should check out the following web site ;)
http://www.lua.org/pil/20.2.html
Raid Buffs ...
Are there any mods out there that a Raid Leader can use to assign/keep track of raid buffs. I would love to have a screen like pally power but for all classes that have buffs that I can assign (as raid leader) and that allow me to see what buffs the player has available and what rank they are specced for and also, for them to have the ability to, after I have assigned their classes/grps, simply one click an icon to buff appropriate classes/groups. Also in there, have some way of showing what classes or groups do not have the buff.
Any help would be greatly appriciated. Even is someone pointed me in the right direction to develop (although I have no mod experience). I know that this would be a great raid utility and something that many would use.
Thanks
Any help would be greatly appriciated. Even is someone pointed me in the right direction to develop (although I have no mod experience). I know that this would be a great raid utility and something that many would use.
Thanks
Coding Help
Hi All,
I am pretty new to addon coding. I am a Computer Science Major particularly in the application development side of things I have two questions: 1. Is there a way to have an addon detect if the player has come in/out of stealth?
2. Is there any really good tutorials on WoW addon Development?
Thanks
Rearadmiral (Black Dragonflight, US)|||Do you mean yourself or someone else? If you mean yourself then you might be able to check using UnitBuff(unit, buffIndex)
http://www.wowwiki.com/API_UnitBuff
Code:
Where the name or the icontexture matches what you are looking for. If you mean someone else then I don't think you can unless you are targeting them.|||Thanks Jumpy I am trying to detect when I myself go stealth. Let me explain what I am trying to do. I want to detect when I go stealth as my druid so that I can automatically switch the bar pages, kinda like a rouges bars change but for some reason bliz just didn't do for a druid stealth.
Here is what I have so far:
Code:
My function works. If I am in game and I type "/script CatBar_OnEvent();" it will switch the page accordingly. I need it to run that function when I go stealth or come out of stealth.|||If there is no event to trigger a function then you sometimes have to use OnUpdate in your xml to drive the function.
At the top of your Lua program you need to have
Code:
Then this function is pointed to by your xml.
Code:
In your frame xml, in the Scripts section you have
Code:
CatProwlBar.lua
Code:
CatProwlBar.xml
Code:
Thats what I got and still nothing, the only sign I have that the addon is actually working is the fact that I can call the the functions and the Message "CatProwlBar Loaded" shows up when I load in. I am hopeless|||OnUpdate wont run if the frame is hidden. Change the hidden value of the frame to false.|||You may also try :
CatProwlBar.lua
Quote:
function CatBar_OnLoad()
DEFAULT_CHAT_FRAME:AddMessage("CatProwlBar Loaded");
this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS");
this:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF");
end
function CatBar_OnEvent()
if (event == "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS") and arg1 == "You gain Prowl." then
ChangeActionBarPage(2);
end
if (event == "CHAT_MSG_SPELL_AURA_GONE_SELF") and arg1== "Prowl fades from you." then
ChangeActionBarPage(1);
end
end
CatProwlBar.xml
Quote:
<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="CatProwlBar.lua" />
<Frame name="CatFrame" hidden="true">
<Scripts>
<OnLoad>
CatBar_OnLoad();
</OnLoad>
<OnEvent>
CatBar_OnEvent();
</OnEvent>
<OnUpdate>
</OnUpdate>
</Scripts>
</Frame>
</Ui>|||OMG thanks Dinnerbone and Jumpy. As soon as I clean it up some, it will be on the site. You guys will get most of the credit :P.
Thanks Again|||Bad News, I have uncovered a bug. Whenever I leave stealth by using an attack (ie Pounce) my bar does not switch back. Any Ideas?
I am pretty new to addon coding. I am a Computer Science Major particularly in the application development side of things I have two questions: 1. Is there a way to have an addon detect if the player has come in/out of stealth?
2. Is there any really good tutorials on WoW addon Development?
Thanks
Rearadmiral (Black Dragonflight, US)|||Do you mean yourself or someone else? If you mean yourself then you might be able to check using UnitBuff(unit, buffIndex)
http://www.wowwiki.com/API_UnitBuff
Code:
name, rank, iconTexture, count, duration, timeLeft = UnitBuff(unit, buffIndex)
Where the name or the icontexture matches what you are looking for. If you mean someone else then I don't think you can unless you are targeting them.|||Thanks Jumpy I am trying to detect when I myself go stealth. Let me explain what I am trying to do. I want to detect when I go stealth as my druid so that I can automatically switch the bar pages, kinda like a rouges bars change but for some reason bliz just didn't do for a druid stealth.
Here is what I have so far:
Code:
function CatBar_OnLoad()
DEFAULT_CHAT_FRAME:AddMessage("CatProwlBar Loaded");
end
function CatBar_OnEvent()
if IsStealthed() == 1 then
ChangeActionBarPage(2);
end
if IsStealthed() == nil then
ChangeActionBarPage(1);
end
end
My function works. If I am in game and I type "/script CatBar_OnEvent();" it will switch the page accordingly. I need it to run that function when I go stealth or come out of stealth.|||If there is no event to trigger a function then you sometimes have to use OnUpdate in your xml to drive the function.
At the top of your Lua program you need to have
Code:
local CatBar_LastTime = 0
Then this function is pointed to by your xml.
Code:
function CatBar_Timer(elapsed)
CatBar_LastTime = CatBar_LastTime + elapsed
if CatBar_LastTime >= .5) then -- for half second intervals
CatBar_LastTime = 0
if IsStealthed() == 1 then
ChangeActionBarPage(2);
end
if IsStealthed() == nil then
ChangeActionBarPage(1);
end
end
end
In your frame xml, in the Scripts section you have
Code:
<Scripts>|||You may also be able to use events such as "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS", "CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_BUFFS" and "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS". I'm guessing the first one will work for self buffs thought I haven't personally tested it. Arg1 will return the combat text chat, so if you know what effect to look for, you should be able to trigger a function when the event is fired without necessarily having to resort to a timed OnUpdate check (which should work as well).|||Thanks BTW guys for all of your input but I still cannot get it working, and it may just be me at this point but this is what I got:
<OnUpdate>
CatBar_Timer(arg1)
</OnUpdate>
**** other scripts ***
</Scripts>
CatProwlBar.lua
Code:
local CatBar_LastTime = 0
function CatBar_OnLoad()
DEFAULT_CHAT_FRAME:AddMessage("CatProwlBar Loaded");
end
function CatBar_Timer(elapsed)
CatBar_LastTime = CatBar_LastTime + elapsed
if CatBar_LastTime >= .5 then -- for half second intervals
CatBar_LastTime = 0
if IsStealthed() == 1 then
ChangeActionBarPage(2);
end
if IsStealthed() == nil then
ChangeActionBarPage(1);
end
end
end
CatProwlBar.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="CatProwlBar.lua" />
<Frame name="CatFrame" hidden="true">
<Scripts>
<OnLoad>
CatBar_OnLoad();
</OnLoad>
<OnUpdate>
CatBar_Timer(arg1);
</OnUpdate>
</Scripts>
</Frame>
</Ui>
Thats what I got and still nothing, the only sign I have that the addon is actually working is the fact that I can call the the functions and the Message "CatProwlBar Loaded" shows up when I load in. I am hopeless|||OnUpdate wont run if the frame is hidden. Change the hidden value of the frame to false.|||You may also try :
CatProwlBar.lua
Quote:
function CatBar_OnLoad()
DEFAULT_CHAT_FRAME:AddMessage("CatProwlBar Loaded");
this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS");
this:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF");
end
function CatBar_OnEvent()
if (event == "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS") and arg1 == "You gain Prowl." then
ChangeActionBarPage(2);
end
if (event == "CHAT_MSG_SPELL_AURA_GONE_SELF") and arg1== "Prowl fades from you." then
ChangeActionBarPage(1);
end
end
CatProwlBar.xml
Quote:
<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="CatProwlBar.lua" />
<Frame name="CatFrame" hidden="true">
<Scripts>
<OnLoad>
CatBar_OnLoad();
</OnLoad>
<OnEvent>
CatBar_OnEvent();
</OnEvent>
<OnUpdate>
</OnUpdate>
</Scripts>
</Frame>
</Ui>|||OMG thanks Dinnerbone and Jumpy. As soon as I clean it up some, it will be on the site. You guys will get most of the credit :P.
Thanks Again|||Bad News, I have uncovered a bug. Whenever I leave stealth by using an attack (ie Pounce) my bar does not switch back. Any Ideas?
New to writing mods, need help ...
Hi, I have some programming experience and would like to write mods for WoW. However the commands don't come with much instruction so it's hard to get started.
To get me going I want to write a mod that will make my character cheer when he completes a quest objective. So if say he needs 10/10 items, when he gets the 10th item he cheers. I can make him cheer using the doemote command but I can't find the command to trigger the cheer when he completes an objective. Can anyone point me in the right direction?
Thanks.|||Quote:
Hi, I have some programming experience and would like to write mods for WoW. However the commands don't come with much instruction so it's hard to get started.
To get me going I want to write a mod that will make my character cheer when he completes a quest objective. So if say he needs 10/10 items, when he gets the 10th item he cheers. I can make him cheer using the doemote command but I can't find the command to trigger the cheer when he completes an objective. Can anyone point me in the right direction?
Thanks.
I am going to take a stab at this, but have you tried:
Code:
http://www.wowwiki.com/World_of_Warc...uest_Functions
To get me going I want to write a mod that will make my character cheer when he completes a quest objective. So if say he needs 10/10 items, when he gets the 10th item he cheers. I can make him cheer using the doemote command but I can't find the command to trigger the cheer when he completes an objective. Can anyone point me in the right direction?
Thanks.|||Quote:
Hi, I have some programming experience and would like to write mods for WoW. However the commands don't come with much instruction so it's hard to get started.
To get me going I want to write a mod that will make my character cheer when he completes a quest objective. So if say he needs 10/10 items, when he gets the 10th item he cheers. I can make him cheer using the doemote command but I can't find the command to trigger the cheer when he completes an objective. Can anyone point me in the right direction?
Thanks.
I am going to take a stab at this, but have you tried:
Code:
if(event == "QUEST_ITEM_UPDATE") then|||Also look here
### Add in check here ###
### Add in emote here ###
else
http://www.wowwiki.com/World_of_Warc...uest_Functions
Subscribe to:
Posts (Atom)