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" |
Lua Code:
addon.name cannot be declared. it's addon you should declare as a table and then subtable name. like Lua Code:
After a table for 1 variable, is not really good. just use Lua Code:
Lua Code:
A little convention created by zos is to capitalize function names and lowercase first letter of variable names. Also, please avoid usage of perenthesis if they're not useful. In Lua they are only needed for operator priority changes. Lua Code:
Lua Code:
so I would write your code : Lua Code:
|
the problem he has is in general: he will withdraw the whole money from the bank. i think that's not he's idea. so you need to withdraw a difference from your bag to the value that you want to keep.
MONEY_YOU_WANT_TO_KEEP_IN_YOUR_BAG = 15000 CURRENT_MONEY_IN_YOUR_BAG = 3000 WITHDRAW_VALUE = MONEY_YOU_WANT_TO_KEEP_IN_YOUR_BAG - CURRENT_MONEY_IN_YOUR_BAG |
That was and idea. To withdraw all gold.
Thanks Ayantir for all suggestions. Unfortunately addon still doesn't work. It looks like function does not fire or event is not registered. |
What is the error? Looking at the error can be helpful, because it tells you what type of thing is happening, and it can also point you to the location where it is happening.
Is there no error at all? It's possible your functions aren't running. Peppering d() throughout your addon can help you determine what is not running. |
What Ayantir has stripped in his code was the addon loaded event lines at the bottom.
Did you put them into your addon again so it is "starting" at all? Lua Code:
|
There is no error displayed, addon just doesn't work.
I've noticed that missing line and added it myself. No luck so far. Strange. |
Try to put error("hello world") into the first line of your lua file. If that doesn't show ingame, you have a problem with your basic addon structure, otherwise try to put it into the loaded event next and see what happens, etc.
If that doesn't help either, you should upload your addon somewhere and link it here, so we can see the whole thing and won't have to guess at the problem. |
All times are GMT -6. The time now is 09:07 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI