lotrointerface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Lua Programming Help (L)

Reply
Thread Tools Display Modes
  #11  
Unread 11-15-2011, 02:28 PM
Queekusme's Avatar
Queekusme Queekusme is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: May 2011
Posts: 13
right, so i need to set each datastring of quickslot(n)savedatax to a table with data and type

(where n = quickslot's number)

e.g.

Code:
shortcut(n) = quickslot(n):GetShortcut()
        local type(n) = shortcut(n):GetType(),
        local data(n) = shortcut(n):GetData()
                                    
	quickslot1SavData = type,data,
	          -- And then copy for the other shortcuts...
		}

local savedatax ={
		quickslot(n)SavData = { Data = data(n),
                                               Type = type(n),
                                               }
		...
		}
and for loading:

Code:
savedatax = Turbine.etc.loading(Blardyblar)

local sc(n)=Turbine.UI.Lotro.Shortcut();
sc(n):SetType(savedatax.quickslot(n)SavData.Type);
sc(n):SetData((savedatax.quickslot(n)SavData.Data); 
quickslot(n):SetShortcut(sc(n));
God that's a bit confusing! lets try it shall we...


SRY 4 FORMATTING
__________________
We create that what only we love most, But what truly creates us is what(who) loves us the most. - ME, i'm philosopher nao
Where's Chuck Norris' plugin?
Reply With Quote
  #12  
Unread 11-15-2011, 02:55 PM
Queekusme's Avatar
Queekusme Queekusme is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: May 2011
Posts: 13
ok it's not working!

i can get the type value of 0.000000 but no data, i've tried items, skills and alias'... here's the code:

Code:
	Save = Turbine.UI.Button();
	Save:SetParent( window );
	Save:SetPosition( 210, 34 );
	Save:SetSize( 78, 15 );
	Save:SetBackColor( Turbine.UI.Color( 0.0, 0.05, 1.0 ) );
	Save:SetText( ""..Lang[1][21] ); --for lang files
	Save:SetTextAlignment( Turbine.UI.ContentAlignment.MiddleCenter );
	Save:SetForeColor( Turbine.UI.Color(  0.0, 0.0, 0.0 ) );

	local savedatax ={
			quickslot1SavData = { Data = "",
					      Type = "",
					    }
			 }

	shortcut1 = quickslot1:GetShortcut();
	local type1 = shortcut1:GetType();
	local data1 = shortcut1:GetData();	
	
		Save.Click = function( sender , args )

			savedatax.quickslot1SavData.Data = data1;
			savedatax.quickslot1SavData.Type = type1;

				Turbine.Shell.WriteLine("Pre Save");

					Turbine.PluginData.Save(Turbine.DataScope.Character, "KmabcSaveData", savedatax); 

				Turbine.Shell.WriteLine("Post Save");
		end
__________________
We create that what only we love most, But what truly creates us is what(who) loves us the most. - ME, i'm philosopher nao
Where's Chuck Norris' plugin?
Reply With Quote
  #13  
Unread 11-16-2011, 01:04 AM
Equendil Equendil is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Apr 2011
Posts: 52
You seem to be building your data for saving where you initialize the UI. At that point I imagine your quickslot is empty.
__________________
Author of LIP, Bootstrap and Baruk
Reply With Quote
  #14  
Unread 11-16-2011, 02:10 AM
Queekusme's Avatar
Queekusme Queekusme is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: May 2011
Posts: 13
Quote:
Originally Posted by Equendil
You seem to be building your data for saving where you initialize the UI. At that point I imagine your quickslot is empty.
so... how do i sort this? I've never done this before and so have no clue what i'm doing really.
__________________
We create that what only we love most, But what truly creates us is what(who) loves us the most. - ME, i'm philosopher nao
Where's Chuck Norris' plugin?
Reply With Quote
  #15  
Unread 11-16-2011, 02:20 AM
Equendil Equendil is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Apr 2011
Posts: 52
Quote:
Originally Posted by Queekusme
so... how do i sort this? I've never done this before and so have no clue what i'm doing really.
Move that stuff:

Code:
shortcut1 = quickslot1:GetShortcut();
	local type1 = shortcut1:GetType();
	local data1 = shortcut1:GetData();
to where you save the data.
__________________
Author of LIP, Bootstrap and Baruk
Reply With Quote
  #16  
Unread 11-16-2011, 01:40 PM
Queekusme's Avatar
Queekusme Queekusme is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: May 2011
Posts: 13
so in savedatax, i'll try it now!
__________________
We create that what only we love most, But what truly creates us is what(who) loves us the most. - ME, i'm philosopher nao
Where's Chuck Norris' plugin?
Reply With Quote
  #17  
Unread 11-16-2011, 02:04 PM
Queekusme's Avatar
Queekusme Queekusme is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: May 2011
Posts: 13
still not getting the data,

Code:
Save = Turbine.UI.Button();
	Save:SetParent( window );
	Save:SetPosition( 210, 34 );
	Save:SetSize( 78, 15 );
	Save:SetBackColor( Turbine.UI.Color( 0.0, 0.05, 1.0 ) );
	Save:SetText( ""..Lang[1][21] );
	Save:SetTextAlignment( Turbine.UI.ContentAlignment.MiddleCenter );
	Save:SetForeColor( Turbine.UI.Color(  0.0, 0.0, 0.0 ) );

	shortcut1 = quickslot1:GetShortcut();

	local savedatax ={
			quickslot1SavData = { Data = shortcut1:GetType(),
					      Type = shortcut1:GetData(),
					    }
			 }	
	
	quickslot1.ShortcutChanged = function( sender , args ) -- I changed this to save me time whilst clicking the button, Should be Save.Click...

		savedatax.quickslot1SavData.Data = shortcut1:GetData();
		savedatax.quickslot1SavData.Type = shortcut1:GetType();

			Turbine.Shell.WriteLine("Pre Save");

				Turbine.PluginData.Save(Turbine.DataScope.Character, "KmabcSaveData", savedatax); 

			Turbine.Shell.WriteLine("Post Save");
	end
could people copy this into their posts when they reply so i can see exactly what you are referring to, as it would really help me,

thanks

PS, when i change the line:
shortcut1 = quickslot1:GetShortcut();

to
shortcut1 = quickslotlyrical:GetShortcut();

it gets the value for the link, but not on any of the quickslots with items
__________________
We create that what only we love most, But what truly creates us is what(who) loves us the most. - ME, i'm philosopher nao
Where's Chuck Norris' plugin?

Last edited by Queekusme : 11-16-2011 at 02:06 PM.
Reply With Quote
  #18  
Unread 11-17-2011, 01:15 PM
Equendil Equendil is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Apr 2011
Posts: 52
If your quickslot has changed, you must reacquire the shortcut. Move "shortcut1 = quickslot1:GetShortcut();" to when you save things.

There is no magic performed by the lua runtime, if you get components/data before shortcuts are set, you'll get empty shortcuts.


Code:
Save = Turbine.UI.Button();
	Save:SetParent( window );
	Save:SetPosition( 210, 34 );
	Save:SetSize( 78, 15 );
	Save:SetBackColor( Turbine.UI.Color( 0.0, 0.05, 1.0 ) );
	Save:SetText( ""..Lang[1][21] );
	Save:SetTextAlignment( Turbine.UI.ContentAlignment.MiddleCenter );
	Save:SetForeColor( Turbine.UI.Color(  0.0, 0.0, 0.0 ) );

	local savedatax ={
			quickslot1SavData = { Data = shortcut1:GetType(),
					      Type = shortcut1:GetData(),
					    }
			 }	
	
	quickslot1.ShortcutChanged = function( sender , args ) -- I changed this to save me time whilst clicking the button, Should be Save.Click...
	        shortcut1 = quickslot1:GetShortcut();
		savedatax.quickslot1SavData.Data = shortcut1:GetData();
		savedatax.quickslot1SavData.Type = shortcut1:GetType();

			Turbine.Shell.WriteLine("Pre Save");

				Turbine.PluginData.Save(Turbine.DataScope.Character, "KmabcSaveData", savedatax); 

			Turbine.Shell.WriteLine("Post Save");
	end
__________________
Author of LIP, Bootstrap and Baruk

Last edited by Equendil : 11-17-2011 at 01:19 PM.
Reply With Quote
  #19  
Unread 11-18-2011, 02:04 AM
Queekusme's Avatar
Queekusme Queekusme is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: May 2011
Posts: 13
IT'S WORKING

For anyone else's reference:

Code:
        Save = Turbine.UI.Button(); -- Not used anymore but will keep in
	Save:SetParent( window );
	Save:SetPosition( 210, 34 );
	Save:SetSize( 78, 15 );
	Save:SetBackColor( Turbine.UI.Color( 0.0, 0.05, 1.0 ) );
	Save:SetText( ""..Lang[1][21] );
	Save:SetTextAlignment( Turbine.UI.ContentAlignment.MiddleCenter );
	Save:SetForeColor( Turbine.UI.Color(  0.0, 0.0, 0.0 ) );

	shortcut = quickslot1:GetShortcut();

	local savedatax ={
			quickslot1SavData = { Data = shortcut:GetType(),
					      Type = shortcut:GetData(),
					    }
			 }	
	
	quickslot1.ShortcutChanged = function( sender , args )

		shortcut1 = quickslot1:GetShortcut();
		savedatax.quickslot1SavData.Data = shortcut1:GetData();
		savedatax.quickslot1SavData.Type = shortcut1:GetType();

			Turbine.Shell.WriteLine("Pre Save");

				Turbine.PluginData.Save(Turbine.DataScope.Character, "KmabcSaveData", savedatax); 

			Turbine.Shell.WriteLine("Post Save");
	end
__________________
We create that what only we love most, But what truly creates us is what(who) loves us the most. - ME, i'm philosopher nao
Where's Chuck Norris' plugin?

Last edited by Queekusme : 11-18-2011 at 02:13 AM.
Reply With Quote
Reply


Thread Tools
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving quickslot data to table Marll Lua Programming Help (L) 8 01-07-2011 02:09 PM
Saving window position Olenn Lua Programming Help (L) 25 10-01-2010 01:08 AM
Plugins Not Saving Settings Valdacil Interface Help (L) 13 09-10-2010 10:43 PM
Saving UI Layout... Sythix Interface Help (L) 1 07-05-2007 11:15 PM
chat window not saving position... AstroCat Interface Help (L) 1 07-01-2007 11:12 AM


All times are GMT -5. The time now is 08:45 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui