Thread Tools Display Modes
07-23-08, 02:37 PM   #1
bboyser8
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 6
Need help with addon...

So, I've been working on an addon that calls out when to use certain rogue skills in a rotation. This is my first experience with lua nd I don't really know how it works well, so there's probably screwups, etc. It's mostly for myself, and I've got it mostly done... except for two errors.
1)[string "RogueMoveCaller:OnLoad"] line 1:
attempt to call global 'RogueMoveCaller_OnLoad' (a nil value)
2)..\AddOns\RogueMoveCaller\RogueMoveCaller.lua line 104:
'<eof>' expected near 'end'
And the code:
Code:
RogueMoveCaller_enabled = 1;
RogueMoveCaller_frame = 1;
RogueMoveCaller_inCombat = 0;

function RogueMoveCaller_OnInitialize()
	SLASH_ROGUEMOVECALLER1 = "/roguemovecaller";
	SLASH_ROGUEMOVECALLER2 = "/rmc";
	SlashCmdList["ROGUEMOVECALLER"] = RogueMoveCaller_Command;
	DEFAULT_CHAT_FRAME:AddMessage("Hi");
end

function RogueMoveCaller_Command(cmd)
	cmd = string.lower(cmd);
	if (cmd == "enable") then
		RogueMoveCaller_enabled = 1;
		DEFAULT_CHAT_FRAME:AddMessage("RMC Enabled");

	elseif (cmd == "disable") then
		RogueMoveCaller_enabled = 0;
		DEFAULT_CHAT_FRAME:AddMessage("RMC Disabled");

	elseif (cmd == "frame") then
		DEFAULT_CHAT_FRAME:AddMessage("Enter /rmc frame # to choose which frame to display RMC in");
		DEFAULT_CHAT_FRAME:AddMessage("1 = Chat");
		DEFAULT_CHAT_FRAME:AddMessage("2 = Error");
		if IsAddOnLoaded("SCT") then
			DEFAULT_CHAT_FRAME:AddMessage("3 = SCT Message Frame");
		end

	elseif (cmd == "frame 1") then
		RogueMoveCaller_frame = 1;
		DEFAULT_CHAT_FRAME:AddMessage("Using chat frame");

	elseif (cmd == "frame 2") then
		RogueMoveCaller_frame = 2;
		DEFAULT_CHAT_FRAME:AddMessage("Using error frame");

	elseif (cmd == "frame 3" and IsAddOnLoaded("SCT")) then
		RogueMoveCaller_frame = 3;
		DEFAULT_CHAT_FRAME:AddMessage("Using SCT Message frame");

	elseif (cmd == "frame 3" and not IsAddOnLoaded("SCT")) then
		DEFAULT_CHAT_FRAME:AddMessage("SCT not loaded!");

	else
		DEFAULT_CHAT_FRAME:AddMessage("RMC Commands:");
		DEFAULT_CHAT_FRAME:AddMessage("/rmc enable  : Enable RMC");
		DEFAULT_CHAT_FRAME:AddMessage("/rmc disable : Disable RMC");
		DEFAULT_CHAT_FRAME:AddMessage("/rmc frame   : Change the frame RMC displays in");
	end
end

function RogueMoveCaller_OnEvent()
	local name,rank,icon,cost = GetSpellInfo("Sinister Strike");
	SS_Cost = cost;
	local name,rank,icon,cost = GetSpellInfo("Slice and Dice");
	SnD_Cost = cost;
	local name,rank,icon,cost = GetSpellInfo("Rupture");
	Rup_Cost = cost;
	timeForRup = 0;

	if (event == "PLAYER_REGEN_DISABLED") then
		RogueMoveCaller_inCombat = 1;
	elseif (event == "PLAYER_REGEN_ENABLED") then
		RogueMoveCaller_inCombat = 0;
	elseif (event == "UNIT_ENERGY" and RogueMoveCaller_inCombat == 1) then
		if(GetComboPoints() == 5 and UnitMana(player) > SnD_Cost and timeForRup == 0) then
			if(RogueMoveCaller_frame == 1 or (RogueMoveCaller_frame == 3 and not IsAddOnLoaded("SCT"))) then
				DEFAULT_CHAT_FRAME:AddMessage("Slice and Dice!");
			elseif(RogueMoveCaller_frame == 2) then
				UIErrorsFrame:AddMessage("Slice and Dice!");
			elseif(RogueMoveCaller_frame == 3 and IsAddOnLoaded("SCT")) then
				SCT_MSG_FRAME:AddMessage("Slice and Dice!");
			end
			timeForRup = 1;
		elseif(GetComboPoints() == 5 and timeForRup == 1 and UnitMana(player) > Rup_Cost) then
			if(RogueMoveCaller_frame == 1 or (RogueMoveCaller_frame == 3 and not IsAddOnLoaded("SCT"))) then
				DEFAULT_CHAT_FRAME:AddMessage("Rupture!");
			elseif(RogueMoveCaller_frame == 2) then
				UIErrorsFrame:AddMessage("Rupture!");
			elseif(RogueMoveCaller_frame == 3 and IsAddOnLoaded("SCT")) then
				SCT_MSG_FRAME:AddMessage("Rupture!");
			end
			timeForRup = 0;
		elseif(UnitMana(player) > SS_Cost) then
			if(RogueMoveCaller_frame == 1 or (RogueMoveCaller_frame == 3 and not IsAddOnLoaded("SCT"))) then
				DEFAULT_CHAT_FRAME:AddMessage("Sinister Strike!");
			elseif(RogueMoveCaller_frame == 2) then
				UIErrorsFrame:AddMessage("Sinister Strike!");
			elseif(RogueMoveCaller_frame == 3 and IsAddOnLoaded("SCT")) then
				SCT_MSG_FRAME:AddMessage("Sinister Strike!");
			end
		end
	end
end

local frame = CreateFrame("Frame", "RMCFrame");
frame:SetScript("OnEvent", RogueMoveCaller_OnEvent);
frame:RegisterEvent("PLAYER_REGEN_DISABLED");
frame:RegisterEvent("PLAYER_REGEN_ENABLED");
frame:RegisterEvent("UNIT_ENERGY");
I appreciate your help in advance.
  Reply With Quote
07-23-08, 05:26 PM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
1)[string "RogueMoveCaller:OnLoad"] line 1:
attempt to call global 'RogueMoveCaller_OnLoad' (a nil value)
I guess this error is from a handler in your xml code.
Search for "RogueMoveCaller_OnLoad()" in your xml file.
Maybe the correct function is "RogueMoveCaller_OnInitialize()"? Replace this.

2)..\AddOns\RogueMoveCaller\RogueMoveCaller.lua line 104:
'<eof>' expected near 'end'
Can't find anything.
I'm almost sure this is not the code you got this error from. There's no line 104
Please post the current code and a current error message.
  Reply With Quote
07-23-08, 08:24 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
There's also no OnLoad function on line one of the code posted. Please, post the whole code. You can use http://wowuidev.pastey.net/ and link your code here.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Need help with addon...


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