Jousway

Jous-Testing-and-Learning Noteskin.lua

Feb 26th, 2012
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.42 KB | None | 0 0
  1. --[[
  2. Ok now its time for the Noteskin.lua, Normaly first make the metric.ini and then the Noteskin.lua, Which I also did with this noteskin.
  3. The Noteskin.lua fallsback on the noteskin thats been defined in the metric.ini, Which is common in this case.
  4. The Noteskin.lua is a file which we used for lets say advanced defining how noteskins act, While the metric.ini uses pre-defined code.
  5. In the Noteskin.lua we can do a load of cool stuff to a noteskins, And add redirects and everything, So we dont have to use a load of redir/duplicate files.
  6. Also to edit a code out there are two ways, there is -- and then just he code behind it, Or --[[ --]], which can be used with enters.
  7. We dont have to add -- to the last brackets but we still do it incase we remove the --[[ and leave the ]] because that will break the code and result in errors.
  8. --]]
  9. --Okey lets start with defining everything as ret, so we can return it at the end.
  10. local ret = ... or {};
  11.  
  12. --Also I'm gonna add a extra local, It might be silly but it helps me and people when this mistake of using var instead of Var because its case sensetive.
  13. local var = Var;
  14.  
  15. --And now we define the redirect table, We use this table so we dont have to use massive code for all the directions redirecting on to Down.
  16. --Because the images are basicly the same, It just needs to rotate a bit, In the 3.9 line we used .redir files eveywere, Which used a load of space.
  17. --.redir files still work but most people that use sm5 and know how to work with lua dont use them anymore, Also with this code.
  18. --You might wonder what is calling some of the code, Check out the Noteskin.lua in the common noteskin, Because they are defined there.
  19. --I recomend you to not touch or play with the common Noteskin.lua tough, You might break the code and be confused for hours.
  20. ret.RedirTable =
  21. {
  22.     Left = "Down",
  23.     UpLeft = "Down",
  24.     Down = "Down",
  25.     Up = "Down",
  26.     UpRight = "Down",
  27.     Right = "Down",
  28. };
  29.  
  30. --Anyways lets start with the redirects shall we, So first we are going to define the stuff he that we defined in the common Noteskin.lua so we can use them.
  31. --We define the ret.Redir to be called OldRedir, So we dont get problems, We can also call it OneDoesNotSimpelyRedir, Or whatever we want.
  32. --But we are used to OldRedir, so we use that, same with the local ret = ... or {};, You can call it whatever you want, But still using the standards are best.
  33. local OldRedir = ret.Redir;
  34. --I always wondered why we use this to define sButton and sElement, Because we also have the Var option, So we could basicly use.
  35. --local sButton - Var "Button";, Same for element, But this also works, And it has been used for some time, And I dont feel like changing it ;)
  36. ret.Redir = function(sButton, sElement)
  37.     sButton, sElement = OldRedir(sButton, sElement);
  38.    
  39.     --I'm going to define some stuff here for my silly testing code, Its nothing important.
  40.     4thPreColour = NOTESKIN:GetMetricA("JousDefine", "4thColour");
  41.     if 4thPreColour == "Red" then 4thColour = "ff0000";
  42.     elseif 4thPreColour == "Blue" then 4thColour = "0000ff";
  43.     elseif 4thPreColour == "Purple" then 4thColour = "662d91";
  44.     elseif 4thPreColour == "Yellow" then 4thColour = "ffff00";
  45.     elseif 4thPreColour == "Pink" then 4thColour = "ff00ff";
  46.     elseif 4thPreColour == "Orange" then 4thColour = "f7941d";
  47.     elseif 4thPreColour == "Aqua" then 4thColour = "00ffff";
  48.     elseif 4thPreColour == "Green" then 4thColour = "00c600";
  49.     elseif 4thPreColour == "Gray" then 4thColour = "848484";
  50.     else 4thColour = 4thPreColour; end
  51.     8thPreColour = NOTESKIN:GetMetricA("JousDefine", "8thColour");
  52.     if 8thPreColour == "Red" then 8thColour = "ff0000";
  53.     elseif 8thPreColour == "Blue" then 8thColour = "0000ff";
  54.     elseif 8thPreColour == "Purple" then 8thColour = "662d91";
  55.     elseif 8thPreColour == "Yellow" then 8thColour = "ffff00";
  56.     elseif 8thPreColour == "Pink" then 8thColour = "ff00ff";
  57.     elseif 8thPreColour == "Orange" then 8thColour = "f7941d";
  58.     elseif 8thPreColour == "Aqua" then 8thColour = "00ffff";
  59.     elseif 8thPreColour == "Green" then 8thColour = "00c600";
  60.     elseif 8thPreColour == "Gray" then 8thColour = "848484";
  61.     else 8thColour = 8thPreColour; end
  62.     12thPreColour = NOTESKIN:GetMetricA("JousDefine", "12thColour");
  63.     if 12thPreColour == "Red" then 12thColour = "ff0000";
  64.     elseif 12thPreColour == "Blue" then 12thColour = "0000ff";
  65.     elseif 12thPreColour == "Purple" then 12thColour = "662d91";
  66.     elseif 12thPreColour == "Yellow" then 12thColour = "ffff00";
  67.     elseif 12thPreColour == "Pink" then 12thColour = "ff00ff";
  68.     elseif 12thPreColour == "Orange" then 12thColour = "f7941d";
  69.     elseif 12thPreColour == "Aqua" then 12thColour = "00ffff";
  70.     elseif 12thPreColour == "Green" then 12thColour = "00c600";
  71.     elseif 12thPreColour == "Gray" then 12thColour = "848484";
  72.     else 12thColour = 12thPreColour; end
  73.     16thPreColour = NOTESKIN:GetMetricA("JousDefine", "16thColour");
  74.     if 16thPreColour == "Red" then 16thColour = "ff0000";
  75.     elseif 16thPreColour == "Blue" then 16thColour = "0000ff";
  76.     elseif 16thPreColour == "Purple" then 16thColour = "662d91";
  77.     elseif 16thPreColour == "Yellow" then 16thColour = "ffff00";
  78.     elseif 16thPreColour == "Pink" then 16thColour = "ff00ff";
  79.     elseif 16thPreColour == "Orange" then 16thColour = "f7941d";
  80.     elseif 16thPreColour == "Aqua" then 16thColour = "00ffff";
  81.     elseif 16thPreColour == "Green" then 16thColour = "00c600";
  82.     elseif 16thPreColour == "Gray" then 16thColour = "848484";
  83.     else 16thColour = 16thPreColour; end
  84.     24thPreColour = NOTESKIN:GetMetricA("JousDefine", "24thColour");
  85.     if 24thPreColour == "Red" then 24thColour = "ff0000";
  86.     elseif 24thPreColour == "Blue" then 24thColour = "0000ff";
  87.     elseif 24thPreColour == "Purple" then 24thColour = "662d91";
  88.     elseif 24thPreColour == "Yellow" then 24thColour = "ffff00";
  89.     elseif 24thPreColour == "Pink" then 24thColour = "ff00ff";
  90.     elseif 24thPreColour == "Orange" then 24thColour = "f7941d";
  91.     elseif 24thPreColour == "Aqua" then 24thColour = "00ffff";
  92.     elseif 24thPreColour == "Green" then 24thColour = "00c600";
  93.     elseif 24thPreColour == "Gray" then 24thColour = "848484";
  94.     else 24thColour = 24thPreColour; end
  95.     32ndPreColour = NOTESKIN:GetMetricA("JousDefine", "32ndColour");
  96.     if 32ndPreColour == "Red" then 32ndColour = "ff0000";
  97.     elseif 32ndPreColour == "Blue" then 32ndColour = "0000ff";
  98.     elseif 32ndPreColour == "Purple" then 32ndColour = "662d91";
  99.     elseif 32ndPreColour == "Yellow" then 32ndColour = "ffff00";
  100.     elseif 32ndPreColour == "Pink" then 32ndColour = "ff00ff";
  101.     elseif 32ndPreColour == "Orange" then 32ndColour = "f7941d";
  102.     elseif 32ndPreColour == "Aqua" then 32ndColour = "00ffff";
  103.     elseif 32ndPreColour == "Green" then 32ndColour = "00c600";
  104.     elseif 32ndPreColour == "Gray" then 32ndColour = "848484";
  105.     else 32ndColour = 32ndPreColour; end
  106.     48thPreColour = NOTESKIN:GetMetricA("JousDefine", "48thColour");
  107.     if 48thPreColour == "Red" then 48thColour = "ff0000";
  108.     elseif 48thPreColour == "Blue" then 48thColour = "0000ff";
  109.     elseif 48thPreColour == "Purple" then 48thColour = "662d91";
  110.     elseif 48thPreColour == "Yellow" then 48thColour = "ffff00";
  111.     elseif 48thPreColour == "Pink" then 48thColour = "ff00ff";
  112.     elseif 48thPreColour == "Orange" then 48thColour = "f7941d";
  113.     elseif 48thPreColour == "Aqua" then 48thColour = "00ffff";
  114.     elseif 48thPreColour == "Green" then 48thColour = "00c600";
  115.     elseif 48thPreColour == "Gray" then 48thColour = "848484";
  116.     else 48thColour = 48thPreColour; end
  117.     64thPreColour = NOTESKIN:GetMetricA("JousDefine", "64thColour");
  118.         if 64thPreColour == "Red" then 64thColour = "ff0000";
  119.     elseif 64thPreColour == "Blue" then 64thColour = "0000ff";
  120.     elseif 64thPreColour == "Purple" then 64thColour = "662d91";
  121.     elseif 64thPreColour == "Yellow" then 64thColour = "ffff00";
  122.     elseif 64thPreColour == "Pink" then 64thColour = "ff00ff";
  123.     elseif 64thPreColour == "Orange" then 64thColour = "f7941d";
  124.     elseif 64thPreColour == "Aqua" then 64thColour = "00ffff";
  125.     elseif 64thPreColour == "Green" then 64thColour = "00c600";
  126.     elseif 64thPreColour == "Gray" then 64thColour = "848484";
  127.     else 64thColour = 64thPreColour; end
  128.     192ndPreColour = NOTESKIN:GetMetricA("JousDefine", "192ndColour");
  129.     if 192ndPreColour == "Red" then 192ndColour = "ff0000";
  130.     elseif 192ndPreColour == "Blue" then 192ndColour = "0000ff";
  131.     elseif 192ndPreColour == "Purple" then 192ndColour = "662d91";
  132.     elseif 192ndPreColour == "Yellow" then 192ndColour = "ffff00";
  133.     elseif 192ndPreColour == "Pink" then 192ndColour = "ff00ff";
  134.     elseif 192ndPreColour == "Orange" then 192ndColour = "f7941d";
  135.     elseif 192ndPreColour == "Aqua" then 192ndColour = "00ffff";
  136.     elseif 192ndPreColour == "Green" then 192ndColour = "00c600";
  137.     elseif 192ndPreColour == "Gray" then 192ndColour = "848484";
  138.     else 192ndColour = 192ndPreColour; end
  139.     ITGHolds = NOTESKIN:GetMetricA("JousDefine", "ITGHolds");
  140.     ColourHoldHeads = NOTESKIN:GetMetricA("JousDefine", "ColourHoldHeads");
  141.    
  142.     --more of my silly code so ;)
  143.     if ITGHolds == "False" then
  144.     --if we dont have it on ITG mode, we use holds for every direction like ddr
  145.     if not string.find(sElement, "Head") and
  146.     not string.find(sElement, "Explosion") then
  147.         if string.find(sElement, "Hold") or
  148.         string.find(sElement, "Roll") then
  149.             return sButton, sElement;
  150.         end
  151.     end
  152.     else end
  153.    
  154.     --If you have looked at midi-note for example you have noticed that this is at the bottom of the ret.Redir parent, But I put it on top for a reason.
  155.     --When we put it at the bottom, All directions we defined for sButton will be overwrited, In other words, They will be ignored, And we dont want that.
  156.     sButton = ret.RedirTable[sButton];
Add Comment
Please, Sign In to add comment