Thread Tools Display Modes
Prev Previous Post   Next Post Next
08/04/17, 02:57 AM   #1
clawe
Join Date: Jul 2015
Posts: 5
First AddOn problems

Hello. I'm writing my first AddOn for my personal use.
The idea is pretty simple. I want to automatically withdraw all gold from bank.

Inspired by few other banking addons I've wrote some code.
At first it worked but after some changes I cant get it to work.
I was so stupid that forgot to backup working version.

If you could help me it would be great...

Code:
local addon.name = "BankAllGoldWithdraw"
local GoldIcon = "|t70%:70%:EsoUI/Art/currency/currency_gold.dds|t"

local function withdrawGold()

	local currMoney = GetBankedCurrencyAmount(CURT_MONEY)
	
	local textGold = ("|cFFFFFF" .. currMoney .. "|r" .. GoldIcon)
	
	local wd = "Withdraw: "
		
	if (currMoney > 0) then
		WithdrawCurrencyFromBank(CURT_MONEY, currMoney)
		d(wd .. textGold)
	end
	
end

local function onAddonLoaded(event, addOnName)

	if addOnName == addon.name then
		EVENT_MANAGER:RegisterForEvent(addon.name, EVENT_OPEN_BANK, withdrawGold)
		EVENT_MANAGER:UnregisterForEvent(addon.name, EVENT_ADD_ON_LOADED)
	end
	
end

EVENT_MANAGER:RegisterForEvent(addon.name, EVENT_ADD_ON_LOADED, onAddonLoaded)
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » First AddOn problems


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