Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.44 KB | None | 0 0
  1. <ActorFrame
  2. InitCommand="%function(self)
  3.  
  4.     songName = GAMESTATE:GetCurrentSong():GetSongDir();
  5.    
  6.     m_bl = 60/315 --use this to define length of a beat for use in the rest of the song
  7.     sw = SCREEN_WIDTH
  8.     sh = SCREEN_HEIGHT --shortcuts
  9.    
  10.     function Player(pn)
  11.         return _G['P'..pn]
  12.     end
  13.     function Proxy(pn)
  14.         return _G['P'..pn..'p']
  15.     end
  16.    
  17. end"
  18. ><children>
  19.  
  20.     <Layer
  21.         Type="Quad"
  22.         InitCommand="hidden,1"
  23.         OnCommand="sleep,1000"
  24.     />
  25.    
  26.     <Layer File="modhelpers" />
  27.    
  28.     <Layer
  29.         Type="Quad"
  30.         OnCommand="hidden,1"
  31.         InitCommand="%function(self)
  32.        
  33.             checked = false;
  34.        
  35.             ---------------------------------------------------------
  36.             ---------DOCUMENTATION-----------------------------------
  37.             ---------------------------------------------------------
  38.            
  39.             --function perframe( beat, endBeat )
  40.                 --return true if the current beat is between 'beat' and 'endBeat'
  41.            
  42.             --function mod_shader(beat,key,which)
  43.                 --turn on shader key at specified beat (up to 10 keys available, defined by 'which' = 0-9
  44.                
  45.             --function mod_insert(beat,len,mod,len_or_end,pn)
  46.                 --insert mod into beat mods table
  47.             --function mod_insert2(time,len,mod,len_or_end,pn)
  48.                 --insert mod into time mods table
  49.                
  50.             --function mod_message(beat,msg,persistent)
  51.                 --insert something into the actions table.
  52.                 --msg can also be a function. If string, a message gets broadcast at that beat
  53.                 --if 'persistent' is true, message will run even if editor starts at a beat past it
  54.                
  55.             --function mod_blacklist(t,n)
  56.                 --check if number n occurs in table t
  57.                 --useful for doing 'every beat EXCEPT the contents of t'
  58.                
  59.             --function simple_m0d(beat,strength,mult,mod)
  60.             --function simple_m0d2(beat,strength,mult,mod,pn)
  61.             --function simple_m0d3(beat,strength,duration,bpm,mod,pn)
  62.                 --activate mods at specific beat but also deactivate them
  63.                
  64.             --function mod_wiggle(beat,num,div,amt,speed,mod,pn,first)
  65.                 --alternates a mod back and forth before resetting to 0
  66.                
  67.             --function mod_spring(beat,strength,num,mod,pn)
  68.                 --like mod_wiggle, but springier
  69.            
  70.             --function mod_springt(time,strength,dur,mod,pn)
  71.                 --time-based per-frame alternating mod that decreases based on how much time is left.
  72.                     --think doorstopper
  73.            
  74.             --function mod_springt2(time,strength,dur,mod,pn)
  75.                 --time-based per-frame alternating mod
  76.            
  77.             --function mod_spring_adjustable(beat,strength,num,period,mod,pn, first)
  78.                 --it's not very good
  79.            
  80.             --function mod_beat(beat,strength,pn)
  81.                 --turns on beat for the beat specified, at the desired strength
  82.            
  83.             --function switcheroo_add(beat,which,speed,len,pn)
  84.                 --adds a column swap at the desired beat
  85.             --[[    switcheroos = {normal = {0,0}, ldur = {0,0}, reset = {0,0},
  86.                     flip = {100,0}, rudl = {100,0}, invert = {0,100}, dlru = {0,100},
  87.                     ludr = {25,-75}, rdul = {75,75}, drlu = {25,125}, ulrd = {75,-125}, urld = {100,-100}}
  88.             ]]
  89.            
  90.             --function mod_sugarkiller(beat,duration,speed,minstealth,maxstealth,pn)
  91.                 --portable version of the effect from sugarkill X
  92.            
  93.             ---------------------------------------------------------
  94.             --------END DOCUMENTATION--------------------------------
  95.             ---------------------------------------------------------
  96.            
  97.            
  98.            
  99.            
  100.            
  101.            
  102.            
  103.            
  104.            
  105.            
  106.            
  107.            
  108.            
  109.             init_modsp1 = '';
  110.             init_modsp2 = '';
  111.            
  112.             mod_plr = {};
  113.            
  114.             mod_firstSeenBeat = GAMESTATE:GetSongBeat(); --necessary to prevent long freezes
  115.            
  116.            
  117.            
  118.            
  119.            
  120.            
  121.            
  122.            
  123.            
  124.            
  125.            
  126. ---------------------------------------------------------------------------------------
  127. ----------------------Begin tables 'n stuff--------------------------------------------
  128. ---------------------------------------------------------------------------------------
  129.  
  130.             --beat based mods
  131.             --{beat_start, beat_end, mods, len_or_end, player_number}
  132.             mods = {
  133.                 {0,9999,'*1000 2x','end'},
  134.                
  135.             }
  136.            
  137.            
  138.             --time based mods
  139.             mod_time = 0;
  140.             --{time_start, time_end, mods, len_or_end, player_number}
  141.             mods2 = {
  142.                 --{0,200.345,'3x','end',1},
  143.             }
  144.            
  145.            
  146.            
  147.            
  148.            
  149.             --this is both a message broadcaster and a function runner
  150.             --if you put {beat,'String'}, then 'String' is broadcast as a message on that beat
  151.             --if you put {beat,function() somecode end}, then function() is run at that beat
  152.             --see example on beat 0
  153.            
  154.             curaction = 1;
  155.             --{beat,thing,persists}
  156.             mod_actions = {
  157.             --{0,function(self)
  158.                 --for i,v in pairs(mod_plr) do
  159.                     --if v then
  160.                     --v:linear(5)
  161.                     --v:x(SCREEN_CENTER_X)
  162.                     --end
  163.                 --end
  164.                 --this message sets up the proxies
  165.             --end, true},
  166.                 --{0,'GetProxy',true},
  167.                
  168.                 --this function sets up the judgments and playfield objects
  169.                 --[[{0,function()
  170.                    
  171.                     for pn=1,2 do
  172.                         local a = Player(pn)
  173.                         if a then
  174.                             a:x(SCREEN_WIDTH/2);
  175.                             a:y(SCREEN_HEIGHT/2);
  176.                         end
  177.                     end
  178.                    
  179.                     for pn=1,2 do
  180.                         local d = 0.25; if pn == 2 then d = 0.75 end
  181.                         local a = _G['P'..pn]
  182.                         if a then
  183.                             a:hidden(1);
  184.                         end
  185.                         local b = _G['jud'..pn..'p']
  186.                         if b then
  187.                             b:hidden(0);
  188.                             b:basezoomx(0.6);
  189.                             b:basezoomy(0.6);
  190.                             b:x(SCREEN_WIDTH*d)
  191.                             b:y(SCREEN_HEIGHT*0.45)
  192.                         end
  193.                         local c = _G['com'..pn..'p']
  194.                         if c then
  195.                             c:hidden(0);
  196.                             c:basezoomx(0.6);
  197.                             c:basezoomy(0.6);
  198.                             c:x(SCREEN_WIDTH*d)
  199.                             c:y(SCREEN_HEIGHT*0.5)
  200.                         end
  201.                     end
  202.                    
  203.                     for pn=1,2 do
  204.                         local a = Proxy(pn)
  205.                         local d = .25; --if pn > 2 then d = 0.25 end
  206.                         if pn == 2 then d = .75 end
  207.                         if a then
  208.                             if pn<3 then
  209.                                 a:hidden(0);
  210.                             end
  211.                             a:x(SCREEN_WIDTH*d);
  212.                             a:y(SCREEN_HEIGHT/2);
  213.                         end
  214.                     end
  215.                    
  216.                 end,true},]]
  217.                
  218.                 --{1,'ShowAFT',true},
  219.                 {0,'Bob'},
  220.                 {1.5,'Stop'},
  221.                 {8,'Bob'},
  222.                 {9.5,'Stop'},
  223.                 {16,'Bob'},
  224.                 {17.5,'Stop'},
  225.                 {24,'Bob'},
  226.                 {25.5,'Stop'},
  227.                 {32,'Bob'},
  228.                 {33.5,'Stop'},
  229.                 {40,'Bob'},
  230.                 {41.5,'Stop'},
  231.                 {48,'Bob'},
  232.                 {49.5,'Stop'},
  233.                
  234.                
  235.             }
  236.            
  237.            
  238.            
  239.            
  240.            
  241.            
  242.            
  243.            
  244.             --some mods, using the helpers in modhelpers.xml
  245.            
  246.             switcheroo_add(5.5,'rdul',1,'len')
  247.            
  248.             --mod_insert(1,999,'30 bumpyx','end',1)
  249.             --mod_insert(1,999,'80 zigzag','end',2)
  250.            
  251.             --mod_insert(1,999,'50 stealth','end');
  252.            
  253.            
  254.             --function mod_wiggle(beat,num,div,amt,speed,mod,pn,first)
  255.             --mod_wiggle(16-.1,234,.5,100,5,'tiny');
  256.             --mod_wiggle(78,8,2,200,1,'drunk',1);
  257.             --mod_wiggle(78,8,2,-200,1,'drunk',2);
  258.             --mod_wiggle(86.5,11,2,120,1,'drunk');
  259. --first step at beat 86.5, 11 steps, 2 steps every beat, 120% drunk at normal (1*5ish) speed
  260.            
  261.  
  262.            
  263.            
  264.            
  265.            
  266.            
  267. ---------------------------------------------------------------------------------------
  268. ----------------------Sort the actions table-------------------------------------------
  269. ---------------------------------------------------------------------------------------
  270.            
  271.             function modtable_compare(a,b)
  272.                 return a[1] < b[1]
  273.             end
  274.            
  275.             if table.getn(mod_actions) > 1 then
  276.                 table.sort(mod_actions, modtable_compare)
  277.             end
  278.            
  279.             self:queuecommand('Update');
  280.            
  281.         end"
  282.        
  283.         UpdateCommand="%function(self)
  284.  
  285.             if GAMESTATE:GetSongBeat()>=0 and not checked then
  286.                
  287.                 ----------------------
  288.                 -- grab everything? --
  289.                 ----------------------
  290.                 if SCREENMAN:GetTopScreen():GetChild('LifeP1') then LifeP1 = SCREENMAN:GetTopScreen():GetChild('LifeP1') end
  291.                 if SCREENMAN:GetTopScreen():GetChild('LifeP2') then LifeP2 = SCREENMAN:GetTopScreen():GetChild('LifeP2') end
  292.                 if SCREENMAN:GetTopScreen():GetChild('ScoreP1') then ScoreP1 = SCREENMAN:GetTopScreen():GetChild('ScoreP1') end
  293.                 if SCREENMAN:GetTopScreen():GetChild('ScoreP2') then ScoreP2 = SCREENMAN:GetTopScreen():GetChild('ScoreP2') end
  294.                 if SCREENMAN:GetTopScreen():GetChild('BPMDisplay') then BPMDisplay = SCREENMAN:GetTopScreen():GetChild('BPMDisplay') end
  295.                 if SCREENMAN:GetTopScreen():GetChild('LifeFrame') then LifeFrame = SCREENMAN:GetTopScreen():GetChild('LifeFrame') end
  296.                 if SCREENMAN:GetTopScreen():GetChild('ScoreFrame') then ScoreFrame = SCREENMAN:GetTopScreen():GetChild('ScoreFrame') end
  297.                 if SCREENMAN:GetTopScreen():GetChild('Lyrics') then Lyrics = SCREENMAN:GetTopScreen():GetChild('Lyrics') end
  298.                 if SCREENMAN:GetTopScreen():GetChild('SongForeground') then SongForeground = SCREENMAN:GetTopScreen():GetChild('SongForeground') end
  299.                 if SCREENMAN:GetTopScreen():GetChild('SongBackground') then SongBackground = SCREENMAN:GetTopScreen():GetChild('SongBackground') end
  300.                 if SCREENMAN:GetTopScreen():GetChild('Overlay') then Overlay = SCREENMAN:GetTopScreen():GetChild('Overlay') end
  301.                 if SCREENMAN:GetTopScreen():GetChild('Underlay') then Underlay = SCREENMAN:GetTopScreen():GetChild('Underlay') end
  302.                
  303.                 --------------------------
  304.                 -- hide everything? y/n --
  305.                 --------------------------
  306.                 mod_hideall = true;
  307.                 if mod_hideall == true then
  308.                     if LifeFrame then LifeFrame:hidden(1) end
  309.                     if LifeP1 then LifeP1:hidden(1) end
  310.                     if LifeP2 then LifeP2:hidden(1) end
  311.                     if ScoreP1 then ScoreP1:hidden(1) end
  312.                     if ScoreP2 then ScoreP2:hidden(1) end
  313.                     if BPMDisplay then BPMDisplay:hidden(1) end
  314.                     if Overlay then Overlay:hidden(1) end
  315.                     if Underlay then Underlay:hidden(1) end
  316.                     if ScoreFrame then ScoreFrame:hidden(1) end
  317.                 end
  318.                
  319.                 table.insert(mod_plr,SCREENMAN:GetTopScreen():GetChild('PlayerP1'));
  320.                 table.insert(mod_plr,SCREENMAN:GetTopScreen():GetChild('PlayerP2'));
  321.                
  322.                 for i,v in pairs(mod_plr) do
  323.                     if SCREENMAN:GetTopScreen():GetChild('PlayerOptionsP'..i) then
  324.                         _G['init_modsp'..i] = SCREENMAN:GetTopScreen():GetChild('PlayerOptionsP'..i):GetText();
  325.                     end
  326.                 end
  327.                
  328.                 P1 = SCREENMAN:GetTopScreen():GetChild('PlayerP1');
  329.                 P2 = SCREENMAN:GetTopScreen():GetChild('PlayerP2');
  330.                 --aliases for old times sake
  331.                
  332.                 if P1 then
  333.                     jud1 = P1:GetChild('Judgment');
  334.                     com1 = P1:GetChild('Combo');
  335.                 end
  336.                 if P2 then
  337.                     jud2 = P2:GetChild('Judgment');
  338.                     com2 = P2:GetChild('Combo');
  339.                 end
  340.                 if P1 then P1x_origin = SCREENMAN:GetTopScreen():GetChild('PlayerP1'):GetX(); end
  341.                 if P2 then P2x_origin = SCREENMAN:GetTopScreen():GetChild('PlayerP2'):GetX(); end
  342.                 screen = SCREENMAN:GetTopScreen();
  343.                 checked = true;
  344.                
  345.             end
  346.  
  347.             local beat = GAMESTATE:GetSongBeat()
  348.            
  349.            
  350.            
  351.            
  352.            
  353.            
  354.             --set the vanish point of each fake playfield proxy actorframe to be its center, much like a real playfield
  355.             --[[if beat > mod_firstSeenBeat+1 then
  356.                 for pn=1,2 do
  357.                     local a = Proxy(pn)
  358.                     if a then
  359.                         a:SetVanishPoint(a:GetX(),a:GetY());
  360.                     end
  361.                 end
  362.             end]]
  363.            
  364.            
  365.            
  366.            
  367.            
  368.            
  369.            
  370.            
  371.             --let's move shit around. simple enough experiemtn
  372.             --[[if beat > 1 then
  373.                
  374.                 for i=1,3 do
  375.                
  376.                     _G['t_sprite_'..i]:x( (32*math.sin((beat*0.25*math.pi) + (math.pi*i*(2/3)))))
  377.                    
  378.                 end
  379.                
  380.             end]]
  381.            
  382.            
  383.            
  384.            
  385.            
  386.            
  387. ---------------------------------------------------------------------------------------
  388. ----------------------Begin table handlers---------------------------------------------
  389. ---------------------------------------------------------------------------------------
  390.            
  391.             disable = false;
  392.             if disable ~= true and checked then
  393.                
  394.                 -----------------------
  395.                 -- Player mod resets --
  396.                 -----------------------
  397.                 if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
  398.                     for i=1,2 do
  399.                         GAMESTATE:ApplyGameCommand('mod,clearall',i)
  400.                         if _G['init_modsp'..i] then
  401.                             GAMESTATE:ApplyGameCommand('mod,'.._G['init_modsp'..i],i)
  402.                         end
  403.                     end
  404.                 end
  405.                
  406.                 ------------------------------------------------------------------------------
  407.                 -- custom mod reader by TaroNuke edited by WinDEU and re-stolen by TaroNuke --
  408.                 ------------------------------------------------------------------------------
  409.                 if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
  410.                     for i,v in pairs(mods) do
  411.                         if v and table.getn(v) > 3 and v[1] and v[2] and v[3] and v[4] then
  412.                             if beat >=v[1] then
  413.                                 if (v[4] == 'len' and beat <=v[1]+v[2]) or (v[4] == 'end' and beat <=v[2]) then
  414.                                     if table.getn(v) == 5 then
  415.                                         GAMESTATE:ApplyGameCommand('mod,'..v[3],v[5]);
  416.                                     else
  417.                                         GAMESTATE:ApplyGameCommand('mod,'..v[3]);
  418.                                     end
  419.                                 end
  420.                             end
  421.                         else
  422.                             v[1] = 0;
  423.                             v[2] = 0;
  424.                             v[3] = '';
  425.                             v[4] = 'error';
  426.                             SCREENMAN:SystemMessage('Bad mod in beat-based table (line '..i..')');
  427.                         end
  428.                     end
  429.                 end
  430.                
  431.                 -----------------------------------------------------------------------------------------------------
  432.                 -- WinDEU's time-based len/end version of the #swag custom mod reader #teamproofofconcept (c) 2015 --
  433.                 -----------------------------------------------------------------------------------------------------
  434.                 if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
  435.                     for i,v in pairs(mods2) do
  436.                         if v and table.getn(v) > 3 and v[1] and v[2] and v[3] and v[4] then
  437.                             if mod_time >=v[1] then
  438.                                 if (v[4] == 'len' and mod_time <=v[1]+v[2]) or (v[4] == 'end' and mod_time <=v[2]) then
  439.                                     if table.getn(v) == 5 then
  440.                                         GAMESTATE:ApplyGameCommand('mod,'..v[3],v[5]);
  441.                                     else
  442.                                         GAMESTATE:ApplyGameCommand('mod,'..v[3]);
  443.                                     end
  444.                                 end
  445.                             end
  446.                         else
  447.                             v[1] = 0;
  448.                             v[2] = 0;
  449.                             v[3] = 'error';
  450.                             v[4] = 'error';
  451.                             SCREENMAN:SystemMessage('Bad mod in time-based table (line '..i..')');
  452.                         end
  453.                     end
  454.                 end
  455.                
  456.                 --------------------
  457.                 -- Perframe stuff --
  458.                 --------------------
  459.                
  460.                 --[[
  461.                 if beat > 95 and beat < 159 then
  462.                     for i,v in pairs(prefix_plr) do
  463.                         local multi = -1; if i == 2 then multi = 1; end
  464.                         if v then
  465.                             v:skewx(math.sin(beat*math.pi/4+0.5)*multi);
  466.                             if beat >= 96 then
  467.                                 v:x(SCREEN_CENTER_X+math.cos(beat*math.pi/4)*160*multi);
  468.                             end
  469.                         end
  470.                     end
  471.                 end
  472.                 ]]
  473.                
  474.                 ---------------------------------------
  475.                 -- Actions table --
  476.                 ---------------------------------------
  477.                 if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
  478.                     while curaction<=table.getn(mod_actions) and GAMESTATE:GetSongBeat()>=mod_actions[curaction][1] do
  479.                         if mod_actions[curaction][3] or GAMESTATE:GetSongBeat() < mod_actions[curaction][1]+2 then
  480.                             if type(mod_actions[curaction][2]) == 'function' then
  481.                                 mod_actions[curaction][2]()
  482.                             elseif type(mod_actions[curaction][2]) == 'string' then
  483.                                 MESSAGEMAN:Broadcast(mod_actions[curaction][2]);
  484.                             end
  485.                         end
  486.                         curaction = curaction+1;
  487.                     end
  488.                 end
  489.                
  490.             end
  491.            
  492.             self:sleep(0.02);
  493.             self:queuecommand('Update');
  494.  
  495. ---------------------------------------------------------------------------------------
  496. ----------------------END DON'T TOUCH IT KIDDO-----------------------------------------
  497. ---------------------------------------------------------------------------------------
  498.            
  499.         end"
  500.        
  501.     />
  502.        
  503.     <!--Black quad covers the screen-->
  504.     <LAER Type="Quad" ShowAFTMessageCommand="hidden,0" HideAFTMessageCommand="hidden,1"
  505.     OnCommand="hidden,1;diffuse,0,0,0,1;stretchto,0,0,sw,sh" />
  506.    
  507.  
  508.    
  509.    
  510.    
  511.    
  512.    
  513.     <!--Handling messages here is still fun and profitable-->
  514.     <!--I didn't do anything with it in this example file though.-->
  515.     <CODE Type="Quad" OnCommand="hidden,1"
  516.     ShareArrowsMessageCommand="%function(self)
  517.         for pn=1,2 do
  518.             local a = _G['P'..pn]
  519.             if a then
  520.                
  521.             end
  522.         end
  523.     end"
  524.     ReturnArrowsMessageCommand="%function(self)
  525.    
  526.     end"
  527.     />
  528.    
  529.     <!--This is for the time based mod reader-->
  530.     <BitmapText
  531.         Font="Common Normal"
  532.         Text="test"
  533.         OnCommand="x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;effectclock,music;playcommand,SetTime;hidden,1"
  534.         SetTimeCommand="%function(self) self:settext(self:GetSecsIntoEffect()); mod_time = tonumber(self:GetText()); self:sleep(0.02); self:queuecommand('SetTime'); end"
  535.     />
  536.    <Layer Type="Quad" OnCommand="hidden,1"
  537.     BobMessageCommand="%function(self)
  538.          if P1 then
  539.            P1:bob()
  540.             P1:effectmagnitude(0,50,0)
  541.             P1:effectperiod(1/100)
  542.         end
  543.       if P2 then
  544.            P2:bob()
  545.             P2:effectmagnitude(0,50,0)
  546.             P2:effectperiod(1/100)
  547.       end
  548.    end"
  549.     StopMessageCommand="%function(self)
  550.          if P1 then
  551.            P1:stopeffect()
  552.         end
  553.       if P2 then
  554.            P2:stopeffect()
  555.       end
  556.    end"
  557.  
  558.     />
  559.  
  560.        
  561.    
  562. </children></ActorFrame>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement