Thread Tools Display Modes
10-24-05, 02:08 PM   #1
Izen
A Murloc Raider
 
Izen's Avatar
Join Date: Oct 2005
Posts: 6
New at UI Creation plz hlp

I am new at Ui Creation and i have read some tutorials so i am by my xml file all is completed but now i am on the <Script> section i know i have to use the .lua file now and i looked in some other addons how to make but whenever i see the onload() function there is a variable "arg1" "arg2" etc and now i don't know what to do what is arg? and then i thought i want to make the rest first so i want to beginn the .lua file but i don't know what to do
so i noticed i know how to make a correct .xml file (i have the frames and a textbutton)
but i don't know how to fill the text button in it i want to make a percent of the attack damage(the normal damage = 100% and the normal damage + attribute improvement + buffs = ???%) i thougt i read the damage out and found the command for it then i want to save it in another variable and then i want to update the ui everytime it changes so it compares the variable with the normal damage and the variable with the damage an give a percentage information about it.
how i sayd i have the xml file but not the lua file plz give me a template what i have to write in the lua file and plz give me a discription of what is arg

sry for my english
  Reply With Quote
10-24-05, 02:59 PM   #2
noraj
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 102
most onUpdate() functions dont take any arg's ...arguments(values passed) I didnt realize Onload even passed variables...prolly just the implicit "this" variable

I wouldnt worry about passing any values to the OnLoad

just
function MyMod_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
this:RegisterEvent("PLAYER_ENTERING_WORLD")
end

function MyMod_OnEvent(eventname)
if ( eventname == "PLAYER_ENTERING_WORLD") then
DEFAULT_CHAT_FRAME:AddMessage("Welcome to World of Warcraft")
else if (eventname == "VARIABLES_LOADED") then
DEFAULT_CHAT_FRAME:AddMessage("The Variables for MyMod Have now been loaded")
end
end

if your just trying to wrap your brain around programming for wow, this is the best tutorial i have seen

http://wow.mmhell.com/articles/inter...rst_addon.html

maybe say what your trying to do...you might be making it way more complicated than it is

If you need more precise help post here
  Reply With Quote
10-25-05, 07:56 AM   #3
Izen
A Murloc Raider
 
Izen's Avatar
Join Date: Oct 2005
Posts: 6
Thank you with the tutorial i had make the Addon but it won't work so i write down my addon here i hope you understand it and can help me how to make it better easyer and more functionaly and probably it should work^^

IzenDamage.xml

<Ui>
<Script file="IzenDamage.lua"/>
<Frame name="Damage_Frame" toplevel="true" enableMouse="true" movable="true" parent="UIParent">
<Size>
<AbsDimension x="96" y="24"/>
</Size>
<Anchors>
<Anchor point="TOP">
</Anchor>
</Anchors>
<Backdrop name="Damage_FrameBackdrop" bgFile="Interface\TutorialFrame\TutorialFrameBackground" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<EdgeSize>
<AbsValue val="16"/>
</EdgeSize>
<BackgroundInsets>
<AbsInset left="5" right="5" top="5" bottom="5"/>
</BackgroundInsets>
</Backdrop>
<Layers>
<Layer level="BACKGROUND">
<FontString name="DamageText" inherits="GameFontNormal">
<Size>
<AbsDimension x="128" y="12"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="-10"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
Damage_OnLoad();
</OnLoad>
<OnUpdate>
Damage_OnUpdate(arg1);
</OnUpdate>
<OnDragStart>
Damage_OnDragStart();
</OnDragStart>
<OnDragStop>
Damage_OnDragStop();
</OnDragStop>
<OnMouseUp>
Damage_OnDragStop();
</OnMouseUp>
</Scripts>
</Frame>
</Ui>



IzenDamage.lua

DAMAGE_UPDATE_RATE = 0.1;

mainBase, mainMod, offBase, offMod = UnitAttackBothHands("player");
mainDmg = mainBase + mainMod;
offDmg = offBase + offMod;


function Damage_OnLoad()
this:RegisterForDrag("LeftButton");
Damage_Frame.TimeSinceLastUpdate = 0;
end

function Damage_OnUpdate(arg1)
Damage_Frame.TimeSinceLastUpdate = Damage_Frame.TimeSinceLastUpdate + arg1;
if( Damage_Frame.TimeSinceLastUpdate >DAMAGE_UPDATE_RATE )then
local mainBase, mainMod, offBase, offMod = UnitAttackBothHands("player");
local mDmg = mainBase + mainMod;
local newDmg = mDmg/mainDmg+100;
local DamageString = format(TEXT, newDmg);
DamageText:SetText(DamageString);
IzenDamage_Frame.TimeSinceLastUpdate = 0;
end
end


function Damage_OnDragStart()
Damage_Frame:StartMoving()
end

functin Damage_OnDragStop()
Damage_Frame:StopMovingOrSizing()
end



this should read out the normal damage base and compare it with the damage who changed from buffs etc. and it should show it in the frame as a percentage number


sry for my english
  Reply With Quote
10-27-05, 02:01 PM   #4
noraj
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 102
Have you validated the XML?
(try downloading this http://www.curse-gaming.com/mod.php?addid=1320
and then open your XML file in that)

what is it doing when you try and load it...Is it showing up on the addons list at character select?

Is it giving error messages?

Is it doing absolutly nothing?
  Reply With Quote
10-28-05, 06:01 AM   #5
Izen
A Murloc Raider
 
Izen's Avatar
Join Date: Oct 2005
Posts: 6
when i go into the game say said something with OnLoad and nil value and OnUpdate and nil value. but i don't know why and i think there is a easyer way to make something like that
  Reply With Quote
10-30-05, 06:50 AM   #6
Izen
A Murloc Raider
 
Izen's Avatar
Join Date: Oct 2005
Posts: 6
now i have changed something and it works but the only thing that not work correctly is that it shows numbers like 69.9635346757 and i wont see the float number i try to change it with (%.1f) but it won't work can someone help me plz
  Reply With Quote
11-01-05, 06:44 PM   #7
noraj
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 102
floor(mynumbertofloat * 10)/10 would result in one decimal place *100/100 for 2 decimal places and so on is what i use


it might be floor((mynumber *10)/10) or some variant ..im having a brain fart right now
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » New at UI Creation plz hlp


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