• 0

    posted a message on Problem with Saved Variable
    Thanks, Now I understand that, but what would I use it for? Doesn't that just tell me how big it is?

    Also, I have been working with it a while now, and since adding the above code I have some problems. Mostly that any saved variable I try to reference ends whatever function i am running. So, my question is, is there anything else I have to do to get these saved variables to work other than adding it to the .toc file and also having

    Binder_Profiles = {
        ProfilesCreated = 0;
        Profiles = {};
    }


    in my code.

    I am sure there is something I am missing here, sorry again for being a total noob

    Thank you for any help

    -Tensai
    Posted in: Need Help?
  • 0

    posted a message on Problem with Saved Variable
    Okay, I think I have it set up alright, but if you could check that would be great.

    And explain (or point me to a website) what exactly #Binder_Profiles.Profiles does? And what kind of code I would put there

    Here is the new code

    
    Binder_Profiles = {
        ProfilesCreated=0;
        Profiles = {}
    }
    
    
    function Create_OnClick()
    
    	local NewProfileNum = Binder_Profiles.ProfilesCreated +1; 
    	Binder_Profiles.Profiles[NewProfileNum] = { BindPos = {} }
    
    	--possible to keep
    	out_frame("Binder Profile Created: " .. Name_InputBox:GetText()) 
    	
    	--Saves the name to the correct profile number
    	Binder_Profiles.Profiles[NewProfileNum].Name = Name_InputBox:GetText() 
    	
    	--If something is written in the Description box when saved, this shows in the chat screen
    	if (Description_InputBox:GetText() ~= "") then
    		out_frame("You entered " .. Description_InputBox:GetText().. " as the description for the Profile")
    	end
    	
    	--Saves the description to the correct profile number
    	Binder_Profiles.Profiles[NewProfileNum].Description = Description_InputBox:GetText()
    	
    	--Creates the Bind Table and saves all the binds to it
    	Create_Binds()
    	
    	--Updates the number of profiles created
    	Binder_Profiles.ProfilesCreated = Binder_Profiles.ProfilesCreated + 1
    	
            --Can I do something like this to call the information?
    
    	out_frame(Binder_Profiles.Profiles[1].BindPos[3].TheAction)
    	
    	if (Binder_Profiles.Profiles[1].BindPos[3].BindingOne ~= nil) then
    	out_frame(Binder_Profiles.Profiles[1].BindPos[3].BindingOne)
    	end
    	if (Binder_Profiles.Profiles[1].BindPos[3].BindingOne == nil) then
    	end
    	
    	if (Binder_Profiles.Profiles[1].BindPos[3].BindingTwo ~= nil) then
    	out_frame(Binder_Profiles.Profiles[1].BindPos[3].BindingTwo)
    	end
    	if (Binder_Profiles.Profiles[1].BindPos[3].BindingTwo == nil) then
    	end
    	
    end
    
    function Create_Binds()
    	local TheAction, BindingOne, BindingTwo;
    	local TotalBinds = GetNumBindings();
    	local NewProfileNum = Binder_Profiles.ProfilesCreated +1;
    	
    	for i = 1, TotalBinds do
    		TheAction, BindingOne, BindingTwo = GetBinding(i)
    		
    		Binder_Profiles.Profiles[NewProfileNum].BindPos[i] = {}
    		Binder_Profiles.Profiles[NewProfileNum].BindPos[i].TheAction = TheAction
    		Binder_Profiles.Profiles[NewProfileNum].BindPos[i].BindingOne = BindingOne
    		Binder_Profiles.Profiles[NewProfileNum].BindPos[i].BindingTwo = BindingTwo
    		
    	end
    end
    


    Thanks again, especially for quick reply
    Posted in: Need Help?
  • 0

    posted a message on Problem with Saved Variable
    Okay, I think I have it correct, after reading about how tables work a bit. The only thing I am still confused on is how to make WoW recognize that they are saved variables when I have mulitiple tables.

    Also please check this code to make sure it makes sense.

    The only question I have after that is how would I access most of the information?

    If I have a second profile that is made, how can I access all the information stored there instead of in profile one? sorry if that is a noob question...

    Here is the newest code

    Binder_Profiles = {
    	ProfilesCreated=0;
    	ProfileNum = {
    		Name = nil;
    		Description = nil;
    		BindPos = {
    			TheAction = nil;
    			BindingOne = nil;
    			BindingTwo = nil;
    		}
    	}
    }
    
    function Create_OnClick()
    
    	out_frame("Binder Profile Created: " .. Name_InputBox:GetText())
    	Create_Name()
    	
    	if (Description_InputBox:GetText() ~= "") then
    		out_frame("You entered " .. Description_InputBox:GetText().. " as the description for the Profile")
    	end
    	Create_Description()
    	
    	Create_Binds()
    	
    	Binder_Profiles.ProfilesCreate = Binder_Profiles.ProfilesCreated + 1
    end
    
    function Create_Name()
    	Binder_Profiles.ProfileNum[NewProfileNum].Name = Name_InputBox:GetText()
    end
    
    function Create_Description()
    	Binder_Profiles.ProfileNum[NewProfileNum].Description = Description_InputBox:GetText()
    end
    
    function Create_Binds()
    	local TheAction, BindingOne, BindingTwo;
    	local TotalBinds = GetNumBindings();
    	local NewProfileNum = Binder_Profiles.ProfilesCreated +1;
    	
    	for i = 1, TotalBinds do
    		TheAction, BindingOne, BindingTwo = GetBinding(i)
    		
    		Binder_Profiles.ProfileNum[NewProfileNum].BindPos[i] = {}
    		Binder_Profiles.ProfileNum[NewProfileNum].BindPos[i].TheAction = TheAction
    		Binder_Profiles.ProfileNum[NewProfileNum].BindPos[i].BindingOne = BindingOne
    		Binder_Profiles.ProfileNum[NewProfileNum].BindPos[i].BindingTwo = BindingTwo
    		
    		
    		if (BindingOne ~= nil) then
    			out_frame(BindingOne.." is the First Bind")
    		end
    		if (BindingOne == nil) then
    		end
    	end
    end
    


    I feel like with how I have it all set up within the loop that I am missing some kind of saved variable, or are they all there?

    Thank you again for any help

    -Tensai
    Posted in: Need Help?
  • 0

    posted a message on Problem with Saved Variable
    So I will have to use tables to save my variables?

    A Table can reference another table right?

    So I can still have it set up like that?

    BinderSettings.ProfileNum.Name

    Where it has multiple "." in it?

    Thanks again

    Will read up on it
    Posted in: Need Help?
  • 0

    posted a message on Problem with Saved Variable
    Hello everyone, I am the author of the new addon Binder and am trying to make it more functional for people to use by allowing them to create their own profiles with in it. The addon allows for people to set profiles of keybinds to allow easy switching between specs, or if a friend plays on your account as well.

    I have it coded to the point that it can go through and scan all the keybinds, and in turn I could then set all the key binds to that info, but first I need to save all the keybinds to SavedVariables. The problem being that the I don't know exactly how I should set up the savedvariables to do this... Do I need to use a table or something? I would love suggestions.

    Here is all the relevant code:

    Binder_Profiles = {
    	ProfileNum = {
    		Name = nil;
    		Description = nil;
    		BindPos = {
    			TheAction = nil;
    			BindingOne = nil;
    			BindingTwo = nil;
    		}
    	}
    }
    
    function Loop_OnClick(arg1)
    
    	local TheAction, BindingOne, BindingTwo
    	local TotalBinds = GetNumBindings();
    	
    	for i = 1,TotalBinds do
    		
    		TheAction, BindingOne, BindingTwo = GetBinding(i)
    		
    		--Binder_Profiles.ProfileNum.BindPos = i
    		--Binder_Profiles.ProfileNum.BindPos.TheAction = TheAction
    		--Binder_Profiles.ProfileNum.BindPos.BindingOne = BindingOne
    		--Binder_Profiles.ProfileNum.BindPos.BindingTwo = BindingTwo
    		
    			--The Action
    		out_frame(TheAction.." is the Action")
    		
    			--Binding One
    		if (BindingOne ~= nil) then
    			out_frame(BindingOne.." is the First Bind")
    		end
    		if (BindingOne == nil) then
    			out_frame("   Its nil noob...")
    		end
    			
    			--Binding Two
    		if (BindingTwo ~= nil) then
    			out_frame(BindingTwo)
    		end
    		if (BindingTwo == nil) then
    			out_frame("   Number Two is nil too.....")
    		end
    		
    	end
    		
    	Create_OnClick()
    		
    	out("Second Part Works")
    	--out(Binder_Profiles.ProfileNum.BindPos.TheAction..Binder_Profiles.ProfileNum.BindPos.BindingOne..Binder_Profiles.ProfileNum.BindPos.BindingTwo)
    end
    
    --The Almighty Button that WILL create your new profile
    function Create_OnClick()
    
    	if (Name_InputBox:GetText()) then
    		out_frame("You entered" .. Name_InputBox:GetText().. " as the Name of the Profile")
    	end
    	
    	if (Description_InputBox:GetText()) then
    		out_frame("You entered" .. Description_InputBox:GetText().. " as the Description for the Profile")
    	end
    end
    
    function Create_Name()
    	Binder_Profiles.ProfileNum.Name = Namamamame
    end
    
    function Create_Description()
    	Binder_Profiles.ProfileNum.Description = Descriptioioinoint
    end
    
    function Create_Binds()
    	local i, TheAction, BindingOne, BindingTwo;
    	local TotalBinds = GetNumBindings();
    	
    	for i = 1, TotalBinds do
    		TheAction, BindingOne, BindingTwo = GetBinding(i)
    		Binder_Profiles.ProfileNum.BindPos = i
    		Binder_Profiles.ProfileNum.BindPos.TheAction = TheAction
    		Binder_Profiles.ProfileNum.BindPos.BindingOne = BindingOne
    		Binder_Profiles.ProfileNum.BindPos.BindingTwo = BindingTwo
    		out_frame(BindingOne)
    		end
    end
    



    That is currently what I have, but I have since discovered that you cannot save variables like that, and even if you could they just get overwritten in the loop.

    I hope that gives you the idea of what I am going for. Thank you to anyone who can help with this

    If anything else is needed either pm me or just leave a reply, I will check on this quite often

    Thank you agian

    -Tensai
    Posted in: Need Help?
  • 0

    posted a message on How long does it take to approve files?
    On a similar kind of note, anyone know how long it usually takes for a file to get approved once you post a newer version? Thanks, I'm kinda new.
    Posted in: Need Help?
  • To post a comment, please or register a new account.