Hello,
This is the first time I write in these forums
.
So, yesterday I began writing my first addon. I feel like I'm doing some slow & steady progress.
However, there are a few things that I cannot understand. Can you help me? Here is my code:
Lua Code:
local EventFrame = CreateFrame("Frame")
Roller=LibStub("AceAddon-3.0"):NewAddon("Roller","AceConsole-3.0")
local AceGUI = LibStub("AceGUI-3.0")
Roller:Print("Version 0.1 succesfully loaded. Type '/roller' to bring up the UI")
Roller:RegisterChatCommand("roller", "RollerClient")
function Roller:RollerClient(input) --Roller Client UI section
print("Roller UI test")
local frame = AceGUI:Create("Frame") --Main Frame Definition
frame:SetTitle("Roller 0.1")
frame:SetStatusText("Type the emote in the box and then press the button...")
frame:SetCallback("OnClose", function(widget) AceGUI:Release(widget) end)
frame:SetWidth(500)
frame:SetHeight(150)
frame:SetLayout("Flow")
local emotebox = AceGUI:Create("EditBox") --Emote Input Box
emotebox:SetLabel("Action:")
emotebox:SetWidth(200)
--editbox:SetCallback("OnEnterPressed", function(widget, event, text) emoteText = text end)
--[[Pseudocode
raid_leader=UnitName("RaidLeader")
local function whisper_roll(int_roll, leader_name)
whisper_roll(roll,raid_leader)
ChatFrame1:Type("../w.."RaidLeader".. .."roll)
end
]]--
frame:AddChild(emotebox)
local roll = AceGUI:Create("Button") --"Roll" Button
roll:SetText("Roll!")
roll:SetWidth(200)
--roll:OnClick(print(emoteText))
frame:AddChild(roll)
--local dice=AceGUI:Create("Icon") --Dice Icon
--dice:SetImage("Img/icon.png")
--dice:SetImageSize(32,32)
--frame:AddChild(dice)
end
Roller:RegisterChatCommand("rollgm","RollerGM")
function Roller:RollerGM(input) --GM Options UI Definition
print("Roller GM Options UI test")
local GMframe = AceGUI:Create("Frame")
GMframe:SetTitle("Roller 0.1")
GMframe:SetHeight(250)
GMframe:SetStatusText("GM Options")
local check1 = AceGUI:Create("CheckBox") --First Checkbox
GMframe:AddChild(check1)
local head1 = AceGUI:Create("Heading") --Heading
--head1:SetText("Header")
GMframe:AddChild(head1)
local drop1 = AceGUI:Create("Dropdown") --First Dropdown Box
--drop1.SetText("Setting")
GMframe:AddChild(drop1)
end
What's wrong? Basically:
1. The Heading doesn't get added to the GMframe.
2. If I try to use the SetText function of the Dropdown, drop1 disappears.
3. The "Icon" object doesn't seem to work... the AceGUI documentation speaks of a generic "icon", I've tried using a 32x32 png image without transparencies AND setting the size manually. All what gets shown is a green box.
These are the errors I've stumbled upon so far... do you know what I've done wrong?
Also, is there any function that will send a whisper to a player?
Thanks in advance!