View Single Post
  #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