I currently have a skin that writes variables to a notes skin using the InputText plugin using the following lua code:
The notes skin has 16 items (Item1, Item2, Item3, and so on) and what the script does is that it shifts the contents of each item to the next item and finally writes the user input value to the first item and refreshes the skin to load the changes.
Code: Select all
function AddItem() local input, crlf = SKIN:GetVariable('Item0'):gsub("\r\n", "#*CRLF*#") if input ~= "" then for i = 1, 15 do SKIN:Bang('[!WriteKeyValue Variables Item'..(i+1)..' """'..SKIN:GetVariable('Item'..i):gsub("\n", "#*CRLF*#")..'""" "#@#Notes\\Notes.txt"]') end SKIN:Bang('[!WriteKeyValue Variables Item1 """'..input..'""" "#@#Notes\\Notes.txt"][!Refresh]') end
I tried adding the !SetVariable bang after !WriteKeyValue as
But what it did was write the value of Item2 to all the items and the value of user input to Item1.
Is there any way to do this correctly?