Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ActorFrame
- InitCommand="%function(self)
- songName = GAMESTATE:GetCurrentSong():GetSongDir();
- m_bl = 60/315 --use this to define length of a beat for use in the rest of the song
- sw = SCREEN_WIDTH
- sh = SCREEN_HEIGHT --shortcuts
- function Player(pn)
- return _G['P'..pn]
- end
- function Proxy(pn)
- return _G['P'..pn..'p']
- end
- end"
- ><children>
- <Layer
- Type="Quad"
- InitCommand="hidden,1"
- OnCommand="sleep,1000"
- />
- <Layer File="modhelpers" />
- <Layer
- Type="Quad"
- OnCommand="hidden,1"
- InitCommand="%function(self)
- checked = false;
- ---------------------------------------------------------
- ---------DOCUMENTATION-----------------------------------
- ---------------------------------------------------------
- --function perframe( beat, endBeat )
- --return true if the current beat is between 'beat' and 'endBeat'
- --function mod_shader(beat,key,which)
- --turn on shader key at specified beat (up to 10 keys available, defined by 'which' = 0-9
- --function mod_insert(beat,len,mod,len_or_end,pn)
- --insert mod into beat mods table
- --function mod_insert2(time,len,mod,len_or_end,pn)
- --insert mod into time mods table
- --function mod_message(beat,msg,persistent)
- --insert something into the actions table.
- --msg can also be a function. If string, a message gets broadcast at that beat
- --if 'persistent' is true, message will run even if editor starts at a beat past it
- --function mod_blacklist(t,n)
- --check if number n occurs in table t
- --useful for doing 'every beat EXCEPT the contents of t'
- --function simple_m0d(beat,strength,mult,mod)
- --function simple_m0d2(beat,strength,mult,mod,pn)
- --function simple_m0d3(beat,strength,duration,bpm,mod,pn)
- --activate mods at specific beat but also deactivate them
- --function mod_wiggle(beat,num,div,amt,speed,mod,pn,first)
- --alternates a mod back and forth before resetting to 0
- --function mod_spring(beat,strength,num,mod,pn)
- --like mod_wiggle, but springier
- --function mod_springt(time,strength,dur,mod,pn)
- --time-based per-frame alternating mod that decreases based on how much time is left.
- --think doorstopper
- --function mod_springt2(time,strength,dur,mod,pn)
- --time-based per-frame alternating mod
- --function mod_spring_adjustable(beat,strength,num,period,mod,pn, first)
- --it's not very good
- --function mod_beat(beat,strength,pn)
- --turns on beat for the beat specified, at the desired strength
- --function switcheroo_add(beat,which,speed,len,pn)
- --adds a column swap at the desired beat
- --[[ switcheroos = {normal = {0,0}, ldur = {0,0}, reset = {0,0},
- flip = {100,0}, rudl = {100,0}, invert = {0,100}, dlru = {0,100},
- ludr = {25,-75}, rdul = {75,75}, drlu = {25,125}, ulrd = {75,-125}, urld = {100,-100}}
- ]]
- --function mod_sugarkiller(beat,duration,speed,minstealth,maxstealth,pn)
- --portable version of the effect from sugarkill X
- ---------------------------------------------------------
- --------END DOCUMENTATION--------------------------------
- ---------------------------------------------------------
- init_modsp1 = '';
- init_modsp2 = '';
- mod_plr = {};
- mod_firstSeenBeat = GAMESTATE:GetSongBeat(); --necessary to prevent long freezes
- ---------------------------------------------------------------------------------------
- ----------------------Begin tables 'n stuff--------------------------------------------
- ---------------------------------------------------------------------------------------
- --beat based mods
- --{beat_start, beat_end, mods, len_or_end, player_number}
- mods = {
- {0,9999,'*1000 2x','end'},
- }
- --time based mods
- mod_time = 0;
- --{time_start, time_end, mods, len_or_end, player_number}
- mods2 = {
- --{0,200.345,'3x','end',1},
- }
- --this is both a message broadcaster and a function runner
- --if you put {beat,'String'}, then 'String' is broadcast as a message on that beat
- --if you put {beat,function() somecode end}, then function() is run at that beat
- --see example on beat 0
- curaction = 1;
- --{beat,thing,persists}
- mod_actions = {
- --{0,function(self)
- --for i,v in pairs(mod_plr) do
- --if v then
- --v:linear(5)
- --v:x(SCREEN_CENTER_X)
- --end
- --end
- --this message sets up the proxies
- --end, true},
- --{0,'GetProxy',true},
- --this function sets up the judgments and playfield objects
- --[[{0,function()
- for pn=1,2 do
- local a = Player(pn)
- if a then
- a:x(SCREEN_WIDTH/2);
- a:y(SCREEN_HEIGHT/2);
- end
- end
- for pn=1,2 do
- local d = 0.25; if pn == 2 then d = 0.75 end
- local a = _G['P'..pn]
- if a then
- a:hidden(1);
- end
- local b = _G['jud'..pn..'p']
- if b then
- b:hidden(0);
- b:basezoomx(0.6);
- b:basezoomy(0.6);
- b:x(SCREEN_WIDTH*d)
- b:y(SCREEN_HEIGHT*0.45)
- end
- local c = _G['com'..pn..'p']
- if c then
- c:hidden(0);
- c:basezoomx(0.6);
- c:basezoomy(0.6);
- c:x(SCREEN_WIDTH*d)
- c:y(SCREEN_HEIGHT*0.5)
- end
- end
- for pn=1,2 do
- local a = Proxy(pn)
- local d = .25; --if pn > 2 then d = 0.25 end
- if pn == 2 then d = .75 end
- if a then
- if pn<3 then
- a:hidden(0);
- end
- a:x(SCREEN_WIDTH*d);
- a:y(SCREEN_HEIGHT/2);
- end
- end
- end,true},]]
- --{1,'ShowAFT',true},
- {0,'Bob'},
- {1.5,'Stop'},
- {8,'Bob'},
- {9.5,'Stop'},
- {16,'Bob'},
- {17.5,'Stop'},
- {24,'Bob'},
- {25.5,'Stop'},
- {32,'Bob'},
- {33.5,'Stop'},
- {40,'Bob'},
- {41.5,'Stop'},
- {48,'Bob'},
- {49.5,'Stop'},
- }
- --some mods, using the helpers in modhelpers.xml
- switcheroo_add(5.5,'rdul',1,'len')
- --mod_insert(1,999,'30 bumpyx','end',1)
- --mod_insert(1,999,'80 zigzag','end',2)
- --mod_insert(1,999,'50 stealth','end');
- --function mod_wiggle(beat,num,div,amt,speed,mod,pn,first)
- --mod_wiggle(16-.1,234,.5,100,5,'tiny');
- --mod_wiggle(78,8,2,200,1,'drunk',1);
- --mod_wiggle(78,8,2,-200,1,'drunk',2);
- --mod_wiggle(86.5,11,2,120,1,'drunk');
- --first step at beat 86.5, 11 steps, 2 steps every beat, 120% drunk at normal (1*5ish) speed
- ---------------------------------------------------------------------------------------
- ----------------------Sort the actions table-------------------------------------------
- ---------------------------------------------------------------------------------------
- function modtable_compare(a,b)
- return a[1] < b[1]
- end
- if table.getn(mod_actions) > 1 then
- table.sort(mod_actions, modtable_compare)
- end
- self:queuecommand('Update');
- end"
- UpdateCommand="%function(self)
- if GAMESTATE:GetSongBeat()>=0 and not checked then
- ----------------------
- -- grab everything? --
- ----------------------
- if SCREENMAN:GetTopScreen():GetChild('LifeP1') then LifeP1 = SCREENMAN:GetTopScreen():GetChild('LifeP1') end
- if SCREENMAN:GetTopScreen():GetChild('LifeP2') then LifeP2 = SCREENMAN:GetTopScreen():GetChild('LifeP2') end
- if SCREENMAN:GetTopScreen():GetChild('ScoreP1') then ScoreP1 = SCREENMAN:GetTopScreen():GetChild('ScoreP1') end
- if SCREENMAN:GetTopScreen():GetChild('ScoreP2') then ScoreP2 = SCREENMAN:GetTopScreen():GetChild('ScoreP2') end
- if SCREENMAN:GetTopScreen():GetChild('BPMDisplay') then BPMDisplay = SCREENMAN:GetTopScreen():GetChild('BPMDisplay') end
- if SCREENMAN:GetTopScreen():GetChild('LifeFrame') then LifeFrame = SCREENMAN:GetTopScreen():GetChild('LifeFrame') end
- if SCREENMAN:GetTopScreen():GetChild('ScoreFrame') then ScoreFrame = SCREENMAN:GetTopScreen():GetChild('ScoreFrame') end
- if SCREENMAN:GetTopScreen():GetChild('Lyrics') then Lyrics = SCREENMAN:GetTopScreen():GetChild('Lyrics') end
- if SCREENMAN:GetTopScreen():GetChild('SongForeground') then SongForeground = SCREENMAN:GetTopScreen():GetChild('SongForeground') end
- if SCREENMAN:GetTopScreen():GetChild('SongBackground') then SongBackground = SCREENMAN:GetTopScreen():GetChild('SongBackground') end
- if SCREENMAN:GetTopScreen():GetChild('Overlay') then Overlay = SCREENMAN:GetTopScreen():GetChild('Overlay') end
- if SCREENMAN:GetTopScreen():GetChild('Underlay') then Underlay = SCREENMAN:GetTopScreen():GetChild('Underlay') end
- --------------------------
- -- hide everything? y/n --
- --------------------------
- mod_hideall = true;
- if mod_hideall == true then
- if LifeFrame then LifeFrame:hidden(1) end
- if LifeP1 then LifeP1:hidden(1) end
- if LifeP2 then LifeP2:hidden(1) end
- if ScoreP1 then ScoreP1:hidden(1) end
- if ScoreP2 then ScoreP2:hidden(1) end
- if BPMDisplay then BPMDisplay:hidden(1) end
- if Overlay then Overlay:hidden(1) end
- if Underlay then Underlay:hidden(1) end
- if ScoreFrame then ScoreFrame:hidden(1) end
- end
- table.insert(mod_plr,SCREENMAN:GetTopScreen():GetChild('PlayerP1'));
- table.insert(mod_plr,SCREENMAN:GetTopScreen():GetChild('PlayerP2'));
- for i,v in pairs(mod_plr) do
- if SCREENMAN:GetTopScreen():GetChild('PlayerOptionsP'..i) then
- _G['init_modsp'..i] = SCREENMAN:GetTopScreen():GetChild('PlayerOptionsP'..i):GetText();
- end
- end
- P1 = SCREENMAN:GetTopScreen():GetChild('PlayerP1');
- P2 = SCREENMAN:GetTopScreen():GetChild('PlayerP2');
- --aliases for old times sake
- if P1 then
- jud1 = P1:GetChild('Judgment');
- com1 = P1:GetChild('Combo');
- end
- if P2 then
- jud2 = P2:GetChild('Judgment');
- com2 = P2:GetChild('Combo');
- end
- if P1 then P1x_origin = SCREENMAN:GetTopScreen():GetChild('PlayerP1'):GetX(); end
- if P2 then P2x_origin = SCREENMAN:GetTopScreen():GetChild('PlayerP2'):GetX(); end
- screen = SCREENMAN:GetTopScreen();
- checked = true;
- end
- local beat = GAMESTATE:GetSongBeat()
- --set the vanish point of each fake playfield proxy actorframe to be its center, much like a real playfield
- --[[if beat > mod_firstSeenBeat+1 then
- for pn=1,2 do
- local a = Proxy(pn)
- if a then
- a:SetVanishPoint(a:GetX(),a:GetY());
- end
- end
- end]]
- --let's move shit around. simple enough experiemtn
- --[[if beat > 1 then
- for i=1,3 do
- _G['t_sprite_'..i]:x( (32*math.sin((beat*0.25*math.pi) + (math.pi*i*(2/3)))))
- end
- end]]
- ---------------------------------------------------------------------------------------
- ----------------------Begin table handlers---------------------------------------------
- ---------------------------------------------------------------------------------------
- disable = false;
- if disable ~= true and checked then
- -----------------------
- -- Player mod resets --
- -----------------------
- if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
- for i=1,2 do
- GAMESTATE:ApplyGameCommand('mod,clearall',i)
- if _G['init_modsp'..i] then
- GAMESTATE:ApplyGameCommand('mod,'.._G['init_modsp'..i],i)
- end
- end
- end
- ------------------------------------------------------------------------------
- -- custom mod reader by TaroNuke edited by WinDEU and re-stolen by TaroNuke --
- ------------------------------------------------------------------------------
- if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
- for i,v in pairs(mods) do
- if v and table.getn(v) > 3 and v[1] and v[2] and v[3] and v[4] then
- if beat >=v[1] then
- if (v[4] == 'len' and beat <=v[1]+v[2]) or (v[4] == 'end' and beat <=v[2]) then
- if table.getn(v) == 5 then
- GAMESTATE:ApplyGameCommand('mod,'..v[3],v[5]);
- else
- GAMESTATE:ApplyGameCommand('mod,'..v[3]);
- end
- end
- end
- else
- v[1] = 0;
- v[2] = 0;
- v[3] = '';
- v[4] = 'error';
- SCREENMAN:SystemMessage('Bad mod in beat-based table (line '..i..')');
- end
- end
- end
- -----------------------------------------------------------------------------------------------------
- -- WinDEU's time-based len/end version of the #swag custom mod reader #teamproofofconcept (c) 2015 --
- -----------------------------------------------------------------------------------------------------
- if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
- for i,v in pairs(mods2) do
- if v and table.getn(v) > 3 and v[1] and v[2] and v[3] and v[4] then
- if mod_time >=v[1] then
- if (v[4] == 'len' and mod_time <=v[1]+v[2]) or (v[4] == 'end' and mod_time <=v[2]) then
- if table.getn(v) == 5 then
- GAMESTATE:ApplyGameCommand('mod,'..v[3],v[5]);
- else
- GAMESTATE:ApplyGameCommand('mod,'..v[3]);
- end
- end
- end
- else
- v[1] = 0;
- v[2] = 0;
- v[3] = 'error';
- v[4] = 'error';
- SCREENMAN:SystemMessage('Bad mod in time-based table (line '..i..')');
- end
- end
- end
- --------------------
- -- Perframe stuff --
- --------------------
- --[[
- if beat > 95 and beat < 159 then
- for i,v in pairs(prefix_plr) do
- local multi = -1; if i == 2 then multi = 1; end
- if v then
- v:skewx(math.sin(beat*math.pi/4+0.5)*multi);
- if beat >= 96 then
- v:x(SCREEN_CENTER_X+math.cos(beat*math.pi/4)*160*multi);
- end
- end
- end
- end
- ]]
- ---------------------------------------
- -- Actions table --
- ---------------------------------------
- if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
- while curaction<=table.getn(mod_actions) and GAMESTATE:GetSongBeat()>=mod_actions[curaction][1] do
- if mod_actions[curaction][3] or GAMESTATE:GetSongBeat() < mod_actions[curaction][1]+2 then
- if type(mod_actions[curaction][2]) == 'function' then
- mod_actions[curaction][2]()
- elseif type(mod_actions[curaction][2]) == 'string' then
- MESSAGEMAN:Broadcast(mod_actions[curaction][2]);
- end
- end
- curaction = curaction+1;
- end
- end
- end
- self:sleep(0.02);
- self:queuecommand('Update');
- ---------------------------------------------------------------------------------------
- ----------------------END DON'T TOUCH IT KIDDO-----------------------------------------
- ---------------------------------------------------------------------------------------
- end"
- />
- <!--Black quad covers the screen-->
- <LAER Type="Quad" ShowAFTMessageCommand="hidden,0" HideAFTMessageCommand="hidden,1"
- OnCommand="hidden,1;diffuse,0,0,0,1;stretchto,0,0,sw,sh" />
- <!--Handling messages here is still fun and profitable-->
- <!--I didn't do anything with it in this example file though.-->
- <CODE Type="Quad" OnCommand="hidden,1"
- ShareArrowsMessageCommand="%function(self)
- for pn=1,2 do
- local a = _G['P'..pn]
- if a then
- end
- end
- end"
- ReturnArrowsMessageCommand="%function(self)
- end"
- />
- <!--This is for the time based mod reader-->
- <BitmapText
- Font="Common Normal"
- Text="test"
- OnCommand="x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;effectclock,music;playcommand,SetTime;hidden,1"
- SetTimeCommand="%function(self) self:settext(self:GetSecsIntoEffect()); mod_time = tonumber(self:GetText()); self:sleep(0.02); self:queuecommand('SetTime'); end"
- />
- <Layer Type="Quad" OnCommand="hidden,1"
- BobMessageCommand="%function(self)
- if P1 then
- P1:bob()
- P1:effectmagnitude(0,50,0)
- P1:effectperiod(1/100)
- end
- if P2 then
- P2:bob()
- P2:effectmagnitude(0,50,0)
- P2:effectperiod(1/100)
- end
- end"
- StopMessageCommand="%function(self)
- if P1 then
- P1:stopeffect()
- end
- if P2 then
- P2:stopeffect()
- end
- end"
- />
- </children></ActorFrame>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement