Advertisement
Jousway

WHY AM I DOING THIS TO ME

Jul 3rd, 2012
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.30 KB | None | 0 0
  1. local tChoices = {};
  2. if GetUserPref("Use10sinsteadof1s") == "2" then
  3.     for i=1,256  do
  4.     tChoices[i] = i-1;
  5.     end;
  6. else
  7.     for i=1,26  do
  8.     tChoices[i] = (i-1)*10;
  9.     end;
  10. end;   
  11.  
  12. function Use10sinsteadof1s()
  13.     local t = {
  14.         Name = "Use10sinsteadof1s";
  15.         LayoutType = "ShowAllInRow";
  16.         SelectType = "SelectOne";
  17.         OneChoiceForAllPlayers = true;
  18.         ExportOnChange = true;
  19.         Choices = { 'On','Off' };
  20.         LoadSelections = function(self, list, pn)
  21.             if ReadPrefFromFile("Use10sinsteadof1s") ~= nil then
  22.                 if GetUserPref("Use10sinsteadof1s") == "2" then
  23.                     list[2] = true;
  24.                 else
  25.                     list[1] = true;
  26.                 end;
  27.             else
  28.                 WritePrefToFile("Use10sinsteadof1s","1");
  29.                 list[1] = true;
  30.             end;
  31.         end;
  32.         SaveSelections = function(self, list, pn)
  33.             local val;
  34.             if list[2] then
  35.                 val = "2";
  36.             else
  37.                 val = "1";
  38.             end;
  39.             WritePrefToFile("Use10sinsteadof1s",val);
  40.             MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
  41.             THEME:ReloadMetrics();
  42.         end;
  43.     };
  44.     setmetatable( t, t );
  45.     return t;
  46. end
  47.  
  48. function NoteskinColour4Red()
  49.     local t = {
  50.         Name = "NoteskinColour4Red";
  51.         LayoutType = "ShowAllInRow";
  52.         SelectType = "SelectOne";
  53.         OneChoiceForAllPlayers = true;
  54.         ExportOnChange = true;
  55.         Choices = tChoices;
  56.         LoadSelections = function(self, list, pn)
  57.             if ReadPrefFromFile("NoteskinColour4Red") ~= nil then
  58.                 if GetUserPref("Use10sinsteadof1s") == "1" then
  59.                     if GetUserPrefN("NoteskinColour4Red") < 26 then
  60.                         local loadval = GetUserPrefN("NoteskinColour4Red")+1;
  61.                         list[loadval] = true;
  62.                     else
  63.                         WritePrefToFile("NoteskinColour4Red",string.format('%.0f',GetUserPrefN("NoteskinColour4Red")/10));
  64.                         list[1] = true;
  65.                     end;
  66.                 else
  67.                     local loadval = GetUserPrefN("NoteskinColour4Red")+1;
  68.                     list[loadval] = true;
  69.                 end;
  70.             else
  71.                 WritePrefToFile("NoteskinColour4Red","1");
  72.                 list[1] = true;
  73.             end;
  74.         end;
  75.         SaveSelections = function(self, list, pn)
  76.             local found = false
  77.             for i=1,#list do
  78.                 if not found then
  79.                     if list[i] == true then
  80.                         local val = i-1;
  81.                         WritePrefToFile("NoteskinColour4Red",val);
  82.                         found = true
  83.                     end
  84.                 end
  85.             end
  86.             MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
  87.             THEME:ReloadMetrics();
  88.         end;
  89.     };
  90.     setmetatable( t, t );
  91.     return t;
  92. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement