View Single Post
05-10-12, 02:33 AM   #1
Doronamo
A Defias Bandit
Join Date: May 2012
Posts: 2
Newbie @ Lua, Simple Script Won't Work?

First off I'd like to say that I am about as noob as you can get for LUA, but I'm trying to learn

For my first addon, what I'm basically wanting to do is:

I send a message in my custom channel (najincom) containing "checkcurrency" and everyone in that channel that has this addon will respond with a chat message in that same channel.

So here's what I've got. (the whole TRP2_GetCountOfAll() is a function in TRP2)



Code:
local index = GetChannelName("najincom");
local najinsniff = CreateFrame("Frame");


function najinsniff_OnEvent()
     if (event=="CHAT_MSG_CHANNEL") and (arg1=="checkcurrency") and (arg9=="najincom") then 
          SendChatMessage("<Najin> I currently have " .. TRP2_GetCountOfAll("ITE050715543766345") .. " currency." [, "CHANNEL" [, nil [, index]]]);
     end
end

najinsniff:RegisterEvent("CHAT_MSG_CHANNEL");

Nothing seems to work, what am I missing here? It might also be important to note that my addon is called NajinCurrency, and the only two files in there are NajinCurrency.lua and NajinCurrency.toc. I'm writing all my code in .lua, obviously.
  Reply With Quote