need help to learn and compleet my simple addon
1 Attachment(s)
Hi I'm new in addon and lua .
I started from wowwiki and did "hello world" tutorial then there was nothing to teach me how to use events - checkbox - and ... i managed to design my addon's interface with addon studio but my lua file is still empty . i know few of programing and scripting and just need some push to start my car . just few questions ! 1- how i can make my addon to react to events ? 2- is there a list of events? 3- how i can use checkboxes ? 4- witch one of things i want in my(this) addon are possible? (addon is attached) please don't complete the addon with a twisted solution ! i need to learn this basics . ty |
1.
Code:
Events = CreateFrame("Frame") 3. Code:
Parent = CreateFrame("Frame", "ParentingFrames", WorldFrame) when I open them. Also the timer part in the end is pry alittle messy, I bet there is a better way to do it. Thats just how I had it saved. |
Am I the only one that has grown a hate against that addon studio because it learns beginners the completely wrong things?
|
I couldn't even get the thing to work right. =/
|
Quote:
|
xml
ty for answer
what I'm trying to do is making an addon to auto accept release/resurrect/ress/enter arena/leave arena and party messages (any of them that are possible) with a simple interface and some chechboxes . what i learned so far : i need register events after function and few about creating frames - buttons and ... in lua question 1 : do i have to create frame on lua even when i have some on xml ? my .xml codes Code:
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/"> Question 3 : when i register an event it will react when that event happens and i don't need any other code to call it or something like that . right? Question 4 :am i asking too much questions? i will try to fix my addon tomorrow and will come back with more questions again , ty for support and about addon studio i think its very good for making xml interfaces but i like coding lua in notepad++ (well i still need to learn lua first then i can talk about it) |
1. You do not need to create the frame through lua if you do it in XML. Just a different way to do it. I prefer lua.
2. Personal preference. Don't know if one is more efficient 3. Yes it will automatically happen. You just have to have the code that does someone then the game calls it. 4. I don't think so. |
Quote:
|
Quote:
tooshort [;' |
Quote:
Edit:Mhmm brains? |
dosent work on my xml
i cant make it work on my xml and i don't know why !
i added lines Code:
<OnLoad> self:RegisterEvent("PLAYER_ENTERING_WORLD"); </OnLoad> Code:
<Ui> or maybe <Script file="Frame.lua" /> tag? |
my lua error
this is my lua eror
Note: F_K1A is name of my frame Code:
Message: [string "F_K1A:OnLoad"]:1: attempt to call global 'F_K1A_OnLoad' (a nil value) Code:
function F_K1A_onLoad() Code:
<OnLoad>F_K1A_OnLoad();</OnLoad> |
are you including the lua file in either the xml file or the toc file before the xml file ?
|
Also, are these direct copy-pastes?
F_K1A_OnLoad =/= F_K1A_onLoad |
Quote:
Quote:
Code:
this.RegisterEvent("PLAYER_TARGET_CHANGED"); fixed thanks i will come back with more question and problems :D for start whats the meaning of .. and "!" in print("Hello " .. UnitName("target") .. "!"); does .. means that the next word is a code or function not a string? |
Two periods (..) mean to concatenate (connect) two things together for the string. So, if UnitName("target") = "b3vad" (string), then "Hello"..UnitName("target") will equal "Hello b3vad". The ! is just an !, since it's in quotes (a string), connected to the rest of the string to print out.
Code:
print("Hello " .. UnitName("target") .. "!") |
CORPSE_IN_RANGE auto Resurrect ?
1 Attachment(s)
ty for gr8 answers ^_^
now I'm half way and hard part :D is Resurrect when CORPSE_IN_RANGE protected? cause i cant find any event to use when time is over and Resurrect is available and there is nothing like AcceptResurrect(); for Resurrect from crops (i think) any idea? and same about entering and leaving arena -------------------- beta version is ready and attached |
save checkboxes status
whats your suggestion for saving checkboxes status ?
I'm looking for simplest way possible :D ------------- and any info about things in my perv post? |
soper long (not answered Thread)
well i think repeating my question will get some attention again
1- what do you suggest for saving checkboxes status (i think of making some viable and saving them but maybe someone wanna say some tips about it) 2- (if its possible) anyone knows how to automatic accept arena enter / leave massages ? 3- (if its possible) how to Resurrect from crops ? |
Quote:
lua Code:
2) Try this, since a lot of the battleground API is shared with arena API: lua Code:
If that doesn't work, let me know and I'll see what I can dig up. 3) I'm not sure what you're asking here. Are you looking to automatically accept player rezzes or corpse release? As far as .lua vs .xml, I find lua to be easier to manage and work with. I used to use xml, but the problem came in when I realized that a simple mistake would not let the addon load at all, which is hardly useful when looking to squash bugs. If using lua, the addon will always load and errors will pop telling you where your errors are. |
variables ?
I'm back with more questions :D (and tnx for answers ChaosInc)
------------- 1- to save my settings i need some variables but i cant manage to make variables that addon save and load with Code:
## SavedVariablesPerCharacter: K1OB_var Code:
K1OB_var = { and i cant find any data in wowwwiki about variables and array and best way to change save and load them any tip and or guide can be a big help for me 2- how bout saving/loading a list ? (I'm trying to add a list that player can add items to delete when loot) any idea how i can do it very simple? |
You're doing okay there but perhaps it is how you are using it in your addon.
The TOC is correct. Assuming the code segment is in your code at the top of the lua file then that is correct to, oh wait not quite. The question is how are you accessing it or updating it ? EG. K1OB_var = { ["K1OB_FixMe_V"]= false, ... Other default values or settings } K10B_var["K10B_FixMe_V"] = true; if ( K10B_var["K10B_FixMe_V"] ) then --Lets say you want to add something to a list here, lets use the current list --or if there isn't one yet create one. K10B_var["K10B_FixMe_L"] = K10B_var["K10B_FixMe_L"] or {} --Now we can use it to if we wish, like insert a value to the end of the list tinsert(K10B_var["K10B_FixMe_L"],"somerandomvalue") etc end --If you want to give the user an option to reset the data at any time then --do something like this. You can then add in your chosen default values. function ResetData() K10B_var = {} end Your saved variables data will be restored when the ADDON_LOADED event is triggered for your addon so inside your functions used during game play your data is available by default. Any changes made during play time will be written back during the PLAYER_LOGOUT event. All you need to do is set the values as and when you need. Setting the default values outside of functions will mean you will always have a functional set of data in the case of this being a first use session or the Saved Variable file has been deleted. |
still cant get the whole var loading thing
1 Attachment(s)
i still don't get it . if i have
Code:
K1OB_var = { addon is attached ------------------- and ty Xrystal for answers its really big help |
If you never change the value then yes it will always be false. If you change it before the user shuts down it should update the WTF file for that addon.
Edit: Looked at the code .. Change the toc so that the lua file is above the xml file. The xml file is trying to access functions that don't exist yet. Apart from that I can't see anything wrong. |
the problem
i think the problem is my 3 first line of .lua
Code:
K1OB_var = { i will try to move the create part somewhere else to see if it makes any different Note : i checked my var is saved = True on disk so problem is after load ---------------- i wonder how to create empty var ? |
Hmm, change the ';' in that first block of code to ','. It may be stopping it from setting the table properly but from the sounds of it maybe not.
Now for some true programming testing. 1. Delete the Saved Variables wtf file for that addon. 2. Log in and note what the settings are set to. 3. Change some of the values you want changing and note them. 4. Log Out and look at the Saved Variables file and note the values ( copy the file possibly - which I do sometimes ) 5. Log In and note what the settings are set to. ------- At this point when you log in they should reflect what the wtf file is ------- storing. If not you are not using the values in the right place 6. Change some more values ( different ones ) and note them. 7. Log Out and look at the Saved Variables file and note the values ( copy again if you want so you can compare the files later ) 8. You can then repeat steps 5 to 7 with different settings. If you have the code set up right you should see the changes happening on log and the settings stored on log out. From the sounds of it though the wtf file is being set but the true value is not being set on the check box. That could be due to this line: K1OB_FixMe:SetChecked(); Try changing that to K1OB_FixMe:SetChecked(true); And see if that resolves your problem. A nil value is generally counted as false so possibly could be ignoring your setting. |
still not working
i tested every line of code every thing works perfect accept
Code:
K1OB_var = { i wonder how do you save your addon's settings? can you give me a very simple example code ? |
Okay, found a simple example of mine.
In TOC I have nUI_ABGDData located in SavedVariables line Code:
## SavedVariables: nUI_ABGDData Code:
local addonName,addonData = ... Code:
--[[ Initialise Saved Variable Table with Default Values ]]-- Code:
--[[ Make changes based on SavedVariables settings ]]-- Code:
|
thatnk you for great answer
well i finally managed to solve the problem with making several variables and saving them but i needed to learn the standard way too will use it next time ty.
lets not waste a post and ask another question : i registered Code:
this:RegisterEvent("TRADE_ACCEPT_UPDATE"); Code:
if (event == "TRADE_ACCEPT_UPDATE") then Code:
function K1OB_Trade() |
All times are GMT -6. The time now is 12:53 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI