Is there any guide about creating addon?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
kutalmismete
Posts: 25
Joined: Thu May 26, 2016 6:26 am

Is there any guide about creating addon?

#1 Post by kutalmismete » Tue Nov 08, 2016 2:30 pm

I just tried to write a basic addon but it doesn't work.
FightInfo.lua

Code: Select all

local FightInfo = {
	name = "FightInfo",
	version = "1.0",
	author = "blabla",
};
SLASH_FightInfo1 = "/fi";
SlashCmdList["FightInfo"] = function(editBox, msg)
	if string.lower(msg) == "attack" then 
		DEFAULT_CHAT_FRAME:AddMessage(getPlayerAttack())
	elseif string.lower(msg) == "damage" then
		DEFAULT_CHAT_FRAME:AddMessage(getPlayerDamage())
	else
		DEFAULT_CHAT_FRAME:AddMessage("Not a viable command")
	end
end
function FightInfo.Print()
	DEFAULT_CHAT_FRAME:AddMessage("FightInfo Loaded.")
end
frame:RegisterEvent("VARIABLES_LOADED");
frame:RegisterEvent("PLAYER_ENTER_COMBAT");
frame:RegisterEvent("PLAYER_LEAVE_COMBAT");
frame:RegisterEvent("PLAYER_BUFF_CHANGED");
DEFAULT_CHAT_FRAME:AddMessage("Loaded FightInfo v1.0");

Damage = getPlayerDamage()
DefDamage = getPlayerDamage()
Attack = getPlayerAttack()
DefAttack = getPlayerAttack()
function getPlayerDamage()
   a, b = GetPlayerAbility("MELEE_MAIN_DAMAGE");
   return a + b;
end
function getPlayerAttack()
   c, d = GetPlayerAbility("MELEE_ATTACK");
   return c + d;
end
function isTargetBoss()
	if UnitSex("target") < 2 then
		return true;
	end
	return false;
end
function FightInfo:OnEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
	if(event == "VARIABLES_LOADED") then
		self:VARIABLES_LOADED()
	end
	if(event == "PLAYER_ENTER_COMBAT") then
		if isTargetBoss() then
			DEFAULT_CHAT_FRAME:AddMessage("Boss Battle initialized...");
			printOut = true;
		end
	end
	if(event == "PLAYER_BUFF_CHANGED") then
		if getPlayerDamage() > Damage then
			Damage = getPlayerDamage()
		end
		if getPlayerAttack() > Attack then
			Attack = getPlayerAttack()
		end
	end
	if(event == "PLAYER_LEAVE_COMBAT") and printOut then
		printOut = false;
		DEFAULT_CHAT_FRAME:AddMessage("My max attack was "..Attack);
		DEFAULT_CHAT_FRAME:AddMessage("My max damage was "..Damage);
	end
end
function FightInfo:VARIABLES_LOADED()
	self.Print()
end
FightInfo.xml

Code: Select all

<Ui xmlns="http://www.runewaker.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.runewaker.com/UI.xsd">
    <Frame name="FightInfo_Frame">
        <Scripts>
            <OnEvent>
                FightInfo:OnEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
            </OnEvent>
        </Scripts>
    </Frame>
</Ui>
Whats the problem ? Its broking all addon's ui.
edit: its for printing maximum reached physical damage and physical attack power after boss fight.

kutalmismete
Posts: 25
Joined: Thu May 26, 2016 6:26 am

Re: Is there any guide about creating addon?

#2 Post by kutalmismete » Tue Nov 15, 2016 3:02 pm

still need help

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 29 guests