--An input handler, taken from TaroNuke's Spider Dance file, modified to suit what I need in the current file. -Kid
local InputHandler = function( event )

	-- if (somehow) there's no event, bail
	if not event then return end

	if event.type == "InputEventType_FirstPress" then
		
		if event.button == "Left" and event.PlayerNumber == PLAYER_1 then
			sort_keys[1] = 1
		end
		if event.button == "Down" and event.PlayerNumber == PLAYER_1 then
			sort_keys[2] = 1
		end
		if event.button == "Up" and event.PlayerNumber == PLAYER_1 then
			sort_keys[3] = 1
		end
		if event.button == "Right" and event.PlayerNumber == PLAYER_1 then
			sort_keys[4] = 1
		end
		if event.button == "Left" and event.PlayerNumber == PLAYER_2 then
			sort_keys[5] = 1
		end
		if event.button == "Down" and event.PlayerNumber == PLAYER_2 then
			sort_keys[6] = 1
		end
		if event.button == "Up" and event.PlayerNumber == PLAYER_2 then
			sort_keys[7] = 1
		end
		if event.button == "Right" and event.PlayerNumber == PLAYER_2 then
			sort_keys[8] = 1
		end
		
	end
	
	if event.type == "InputEventType_Release" then
		
		if event.button == "Left" and event.PlayerNumber == PLAYER_1 then
			sort_keys[1] = 0
		end
		if event.button == "Down" and event.PlayerNumber == PLAYER_1 then
			sort_keys[2] = 0
		end
		if event.button == "Up" and event.PlayerNumber == PLAYER_1 then
			sort_keys[3] = 0
		end
		if event.button == "Right" and event.PlayerNumber == PLAYER_1 then
			sort_keys[4] = 0
		end
		if event.button == "Left" and event.PlayerNumber == PLAYER_2 then
			sort_keys[5] = 0
		end
		if event.button == "Down" and event.PlayerNumber == PLAYER_2 then
			sort_keys[6] = 0
		end
		if event.button == "Up" and event.PlayerNumber == PLAYER_2 then
			sort_keys[7] = 0
		end
		if event.button == "Right" and event.PlayerNumber == PLAYER_2 then
			sort_keys[8] = 0
		end
		
	end

end

local cond_a_result= FUCK_EXE--No, we're not doing this. -Kid

local cond_d_result= GAMESTATE:IsHumanPlayer(0)

local cond_f_result= GAMESTATE:IsHumanPlayer(0) and GAMESTATE:IsHumanPlayer(1)

local cond_e_result= GAMESTATE:IsHumanPlayer(1)

local cond_b_result= GAMESTATE:IsPlayerEnabled(PLAYER_1)

local cond_c_result= GAMESTATE:IsPlayerEnabled(PLAYER_2)

local height_ratio = SCREEN_HEIGHT/480--Yes, this will be used alot. -Kid
local width_ratio = SCREEN_WIDTH/640--Yes, this will be used alot. -Kid

local function optional_actor(cond, actor)
	if cond then return actor end
	return Def.Actor{}
end

return Def.ActorFrame{
  Name= "actor_g",
  Def.ActorFrame{
    Name= "actor_h",
    Def.Quad{
      Name= "actor_i",
      OnCommand= cmd(sleep,10000),
    },
    Def.Quad{
      Name= "actor_j",
      EndCommand= function(self)
	    if SCREENMAN:GetTopScreen() then screen:RemoveInputCallback( InputHandler ); end
		end,--Alright, pick up your toys and go. -Kid
      InitCommand= function (self)
		
			--[[
			TODO:
				Test it
			]]
			
			sort_bonuscheck = 16;
			
			sort_stream_movespeed = 0.05
			
			sort_stream_firstbeat = 14
			sort_stream_lastbeat = 158
			
			sort_scorevis = {1,1}
			
			sort_DEchecked = false;
			
			--GetSaved isn't a thing. -Kid
			--taroProfile = PROFILEMAN:GetMachineProfile():GetSaved()
			--taroProfile.UKSRT8Sort = taroProfile.UKSRT8Sort or { highScore = 0 }
			
			--Also, we can't use the macine profile as it doesn't have a data table. -Kid
			taroProfile = PROFILEMAN:GetProfile(PLAYER_1):GetUserTable() or PROFILEMAN:GetProfile(PLAYER_2):GetUserTable()
			--Do we exist? -Kid
			if taroProfile then
			    taroProfile.UKSRT8Sort = taroProfile.UKSRT8Sort or { highScore = 0 }
			else
			    taroProfile = { UKSRT8Sort = { highScore = 0 } }
			end
			
			
			sort_stream_highScore = taroProfile.UKSRT8Sort.highScore;
			
			if not sort_stream_todayBest then sort_stream_todayBest = 0 end
					
			function sort_round(num)
				return math.floor((num * 100) + 0.5) / 100
			end
			function sort_round1(num)
				return math.floor((num * 10) + 0.5) / 10
			end
			function sort_round0(num)
				return math.floor(num + 0.5)
			end
			
			checked = false;
			
			songName = GAMESTATE:GetCurrentSong():GetSongDir();
		
			function sort_sound(soundName)
				SOUND:PlayOnce(songName..'lua/'..soundName);
			end
					
			sort_keys = {0,0,0,0,0,0,0,0}
			
			sort_stream_held = {0,0,0,0,0,0,0,0};
			
			sort_stream_score = {0,0};
			sort_stream_multiplier = {2,2};
			
			sort_stream_note = {{},{}}
			sort_stream_nptr = {1,1};
			sort_stream_dirs = {90,0,180,-90}
			
			sort_stream_show = 12;
			
			sort_stream_notespacing = {SCREEN_HEIGHT*0.14,SCREEN_HEIGHT*0.14};
			
			sort_stream_patterns = {
				{1,4},
				{1,1,4,4},
				{1,4,1,4},
				{1,1,1,4,4,4},
				{1,4,4,1,1,4},
			}
			
			--generate one chart per day, so everyone in the tournament plays the same chart*
			--*unless the machine shits the bed
			if not sort_stream_chart then
				sort_stream_chart = {};
				
				local n = 1;
				local r = -1;
				for j=1,1000 do
					n = math.random(1,table.getn(sort_stream_patterns));
					for i=1,table.getn(sort_stream_patterns[n]) do
						table.insert(sort_stream_chart,sort_stream_patterns[n][i]);
					end
				end
				
			end
			
			sort_stream_colors = {};
			for i=1,table.getn(sort_stream_chart) do
				if sort_stream_chart[i] == 1 then
					if i > 120 then
						table.insert(sort_stream_colors,math.random(1,4));
					elseif i > 80 then
						table.insert(sort_stream_colors,math.random(1,3));
					elseif i > 40 then
						table.insert(sort_stream_colors,math.random(1,2));
					else
						table.insert(sort_stream_colors,1);
					end
				else
					if i > 120 then
						table.insert(sort_stream_colors,math.random(5,8));
					elseif i > 80 then
						table.insert(sort_stream_colors,math.random(5,7));
					elseif i > 40 then
						table.insert(sort_stream_colors,math.random(5,6));
					else
						table.insert(sort_stream_colors,5);
					end
				end
			end
			
			function sort_stream_nextn(pn)
				sort_stream_nptr[pn] = sort_stream_nptr[pn]+1;
				if sort_stream_nptr[pn] > table.getn(sort_stream_note[pn]) then
					sort_stream_nptr[pn] = 1
				end
			end
			
			function sort_stream_gety(n)
				return SCREEN_HEIGHT*0.75;
			end
			
			sort_stream_y_offset = -10;
			
			sort_stream_scale = 0.8;
			sort_stream_speedmod = 1.5;
			
			sort_stream_axs = {-96,-32,32,96};
			
			function sort_stream_quantize(obj, b)
				b = b/4;
				local r = b-math.floor(b)
				if r == 0 then sort_stream_color(obj,4)
				elseif r == 0.5 then sort_stream_color(obj,8)
				elseif (r > 0.33 and r < 0.34) or (r > 0.66 and r < 0.67) then sort_stream_color(obj,12)
				elseif r == 0.25 or r == 0.75 then sort_stream_color(obj,16)
				elseif (r > 0.166 and r < 0.167) or (r > 0.83 and r < 0.84) then sort_stream_color(obj,12)
				elseif r == 0.125 or r == 0.375 or r == 0.625 or r == 0.875 then sort_stream_color(obj,32)
				else sort_stream_color(obj,64) end
			end
			
			function sort_stream_color(obj, n)
				if n == 4 then obj:diffuse(1,0.4,0.3,1); end
				if n == 8 then obj:diffuse(0.3,0.7,1,1); end
				if n == 12 then obj:diffuse(1,0.4,1,1); end
				if n == 16 then obj:diffuse(0.3,1,0.4,1); end
				if n == 32 then obj:diffuse(1,0.8,0.3,1); end
				if n == 64 then obj:diffuse(0.3,1,0.7,1); end
			end
			
			function sort_stream_placenote(pn,time,dir,colors)
				local h = sort_stream_notespacing[pn];
				
				--Trace('nptr: '..sort_stream_nptr[pn]);
				--Trace('Place Note for P'..pn);
				
				local a = sort_stream_note[pn][sort_stream_nptr[pn]];
				if not a then return end
				
				local b = a.actor;
				
				table.insert(sort_stream_mynotes[pn],b);
				
				b:visible(true);
				
				b:animate(0);
				
				--sort_stream_quantize(b, time-1);
				
				b:setstate(colors-1);
				
				b:zoom(height_ratio)--Use height_ratio. -Kid
				b:x((SCREEN_WIDTH*-0.25)+((pn)*SCREEN_CENTER_X));
				b:y(sort_stream_gety(0)+sort_stream_y_offset-((time-1)*h));
				
				--Trace(b:GetX());
				
				sort_stream_nextn(pn);
			end
			
			sort_stream_curnotep1 = 1;
			sort_stream_curnotep2 = 1;
			
			function sort_stream_update(pn,move)
			
				--Trace('Update player '..pn);
				
				if not sort_stream_mynotes[pn] then
					return;
				end
				
				if not sort_stream_mynotes[pn][1] then
					return;
				end
				
				if move then
				
					_G['sort_belt'..pn..'mov'] = sort_stream_movespeed;
					
				
					local ind = _G['sort_stream_curnotep'..pn]
					local head = sort_stream_chart[ind]
					local thing = sort_stream_colors[ind];
					
					local last = sort_stream_chart[ind-1]
					
					--sort_stream_mynotes[pn][1]:linear(1/math.max(sort_stream_nps[pn],10));
					--[[
					sort_stream_mynotes[pn][1]:linear(sort_stream_movespeed);
					sort_stream_mynotes[pn][1]:diffusealpha(-1);
					sort_stream_mynotes[pn][1]:zoom(1.4);
					sort_stream_mynotes[pn][1]:sleep(0);
					sort_stream_mynotes[pn][1]:diffusealpha(1);
					sort_stream_mynotes[pn][1]:zoom(1);
					]]
					sort_stream_mynotes[pn][1]:linear(sort_stream_movespeed);
					sort_stream_mynotes[pn][1]:addy(40);
					if last == 1 then
						sort_stream_mynotes[pn][1]:addx(-40);
					else
						sort_stream_mynotes[pn][1]:addx(40);
					end
					sort_stream_mynotes[pn][1]:sleep(0);
					sort_stream_mynotes[pn][1]:x((SCREEN_WIDTH*-0.25)+((pn)*SCREEN_CENTER_X));
					sort_stream_mynotes[pn][1]:addy(-40);
					
					
					
				end
				
				for i=2,sort_stream_show do
					if move then
						sort_stream_mynotes[pn][i]:linear(sort_stream_movespeed);
						sort_stream_mynotes[pn][i]:y(sort_stream_gety(0)+sort_stream_y_offset-(sort_stream_notespacing[pn]*(i-2)));
						sort_stream_mynotes[pn][i]:sleep(0);
						sort_stream_mynotes[pn][i]:y(sort_stream_gety(0)+sort_stream_y_offset-(sort_stream_notespacing[pn]*(i-1)));
						
						local ind = _G['sort_stream_curnotep'..pn]+i-1
						local body = sort_stream_chart[ind];
						local thing = sort_stream_colors[ind];
						sort_stream_mynotes[pn][i]:x((SCREEN_WIDTH*-0.25)+((pn)*SCREEN_CENTER_X));
					else
						sort_stream_mynotes[pn][i]:linear(sort_stream_movespeed);
						sort_stream_mynotes[pn][i]:y(sort_stream_gety(0)+sort_stream_y_offset-(sort_stream_notespacing[pn]*(i-1)));
					end
				end
				
				if move then
					_G['sort_colorchangerp'..pn]:sleep(sort_stream_movespeed);
					_G['sort_colorchangerp'..pn]:queuecommand('UpdateColors');
				end
				
			end
			
		end,
      KillCommand= function(self)
			--any cleanup, if necessary
		end,
      StartMessageCommand= 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:visible(false) end
					if LifeP1 then LifeP1:visible(false) end
					if LifeP2 then LifeP2:visible(false) end
					if ScoreP1 then ScoreP1:visible(false) end
					if ScoreP2 then ScoreP2:visible(false) end
					if SCREENMAN:GetTopScreen():GetChild('BPMDisplay') then BPMDisplay:visible(false) end
					if Overlay then Overlay:visible(false) end
					if Underlay then Underlay:visible(false) end
					if SCREENMAN:GetTopScreen():GetChild('ScoreFrame') then ScoreFrame:visible(false) end
					--Hide more things. -Kid
					if SCREENMAN:GetTopScreen():GetChild('StageDisplay') then SCREENMAN:GetTopScreen():GetChild('StageDisplay'):visible(false) end
					if SCREENMAN:GetTopScreen():GetChild('SongTitle') then SCREENMAN:GetTopScreen():GetChild('SongTitle'):visible(false) end
				end
				
				P1 = SCREENMAN:GetTopScreen():GetChild('PlayerP1');
				P2 = SCREENMAN:GetTopScreen():GetChild('PlayerP2');
				--aliases for old times sake
				if P1 then
					if SCREENMAN:GetTopScreen():GetChild("SongMeterDisplayP1") then SCREENMAN:GetTopScreen():GetChild("SongMeterDisplayP1"):visible(false) end
					if SCREENMAN:GetTopScreen():GetChild("StepsDisplayP1") then SCREENMAN:GetTopScreen():GetChild("StepsDisplayP1"):visible(false) end
					--Lambda specific. -Kid
					if SCREENMAN:GetTopScreen():GetChild('LifeMeterBarP1') then SCREENMAN:GetTopScreen():GetChild('LifeMeterBarP1'):visible(false) end
				end
				if P2 then
					if SCREENMAN:GetTopScreen():GetChild("SongMeterDisplayP2") then SCREENMAN:GetTopScreen():GetChild("SongMeterDisplayP2"):visible(false) end
					if SCREENMAN:GetTopScreen():GetChild("StepsDisplayP2") then SCREENMAN:GetTopScreen():GetChild("StepsDisplayP2"):visible(false) end
					--Lambda specific. -Kid
					if SCREENMAN:GetTopScreen():GetChild('LifeMeterBarP2') then SCREENMAN:GetTopScreen():GetChild('LifeMeterBarP2'):visible(false) end
				end
				
				screen = SCREENMAN:GetTopScreen();
				checked = true;
				screen:AddInputCallback( InputHandler )--The fun begins. -Kid
			end
			
			sort_belt1mov = 0;
			sort_belt2mov = 0;
		
			sort_stream_mynotes = {{},{}};
			
			sort_stream_score = {0,0};
			
			sort_stream_wrongnotes = {0,0}
			
			sort_stream_nps = {1,1}
			sort_stream_nps_count = {0,0}
			sort_stream_nps_timer = {0,0}
			sort_stream_nps_hitdelay = {0,0}
			
			sort_stream_wrongwait = {0,0}
			
			sort_stream_started = {0,0}
			
			for pn=1,2 do
				if GAMESTATE:IsHumanPlayer(pn-1) then
					for i=1,sort_stream_show do
						sort_stream_placenote(pn,i,sort_stream_chart[i],sort_stream_colors[i]);
					end
				end
			end
			
			self:sleep(0.1);
			self:queuecommand('Update');

		end,
      UpdateCommand= function(self)
			
			--game logic
			
			if sort_stream_started[1] == 1 then
				--Trace(sort_stream_nps[1]..' nps');
				--Trace(sort_stream_notespacing[1]..' spacing');
			end
			
			if sort_belt1mov > 0 then
				sort_belt1a:texcoordvelocity(0,-4);
				sort_belt1b:texcoordvelocity(0,-4);
				sort_belt1mov = sort_belt1mov-0.02;
			else
				sort_belt1a:texcoordvelocity(0,0);
				sort_belt1b:texcoordvelocity(0,0);
			end
			
			if sort_belt2mov > 0 then
				sort_belt2a:texcoordvelocity(0,-4);
				sort_belt2b:texcoordvelocity(0,-4);
				sort_belt2mov = sort_belt2mov-0.02;
			else
				sort_belt2a:texcoordvelocity(0,0);
				sort_belt2b:texcoordvelocity(0,0);
			end
			
			for pn=1,2 do
				
				if sort_stream_wrongwait[pn] > 0 then
					sort_stream_wrongwait[pn] = sort_stream_wrongwait[pn]-0.02;
				end
				
				if sort_stream_started[pn] == 1 then
					sort_stream_nps_timer[pn] = sort_stream_nps_timer[pn]+0.02
					sort_stream_nps_hitdelay[pn] = sort_stream_nps_hitdelay[pn]+0.02
				end
				
				if sort_stream_nps_hitdelay[pn]>0.4 and GAMESTATE:GetSongBeat()<sort_stream_lastbeat then
					sort_stream_nps_hitdelay[pn] = 0;
					sort_stream_nps_timer[pn] = 0;
					sort_stream_nps_count[pn] = 0;
					sort_stream_started[pn] = 0;
					sort_stream_nps[pn] = (sort_stream_nps_count[pn]/math.max(sort_stream_nps_timer[pn],1))*1.5;
					--sort_stream_notespacing[pn] = (SCREEN_HEIGHT*0.08)+(SCREEN_HEIGHT*0.1*(sort_stream_nps[pn]/25))*sort_stream_multiplier[pn]*0.33
					sort_stream_update(pn);
				end
				
				sort_stream_nps[pn] = math.max((sort_stream_nps_count[pn]/math.max(sort_stream_nps_timer[pn],1))*1.5,10);
				--sort_stream_notespacing[pn] = (SCREEN_HEIGHT*0.08)+(SCREEN_HEIGHT*0.1*(sort_stream_nps[pn]/25))*sort_stream_multiplier[pn]*0.33
				
				if GAMESTATE:IsHumanPlayer(pn-1) then
					_G['sort_stream_p'..pn]:y(sort_stream_gety(0));
				else
					_G['sort_stream_p'..pn]:y(-1000);
				end
				
				local bpn = pn-1;
				for i=1,4 do
				
					--Trace(sort_keys[i+(bpn*4)]);
					
					----------------------handle button presses-------------------
					if GAMESTATE:IsHumanPlayer(pn-1) and GAMESTATE:GetSongBeat()>sort_stream_firstbeat and GAMESTATE:GetSongBeat()<sort_stream_lastbeat and sort_stream_wrongwait[pn] <= 0 then
						if sort_keys[i+(bpn*4)] == 1 and sort_stream_held[i+(bpn*4)] == 0 and (i==1 or i==4) then
						
							if i==sort_stream_chart[_G['sort_stream_curnotep'..pn]] then
							
								sort_stream_started[pn] = 1;
								sort_stream_nps_hitdelay[pn] = 0;
								
								_G['sort_stream_curnotep'..pn] = _G['sort_stream_curnotep'..pn]+1;
								
								sort_stream_nps_count[pn] = sort_stream_nps_count[pn]+1;
								sort_stream_update(pn,true);
								
								sort_stream_wrongnotes[pn] = 0;
								
								sort_stream_score[pn] = sort_stream_score[pn]+1;
								
								_G['sort_stream_p'..pn..'ctext']:finishtweening();
								_G['sort_stream_p'..pn..'ctext']:settext(sort_stream_score[pn]);
								_G['sort_stream_p'..pn..'ctext']:diffusealpha(0.5);
								_G['sort_stream_p'..pn..'ctext']:zoom(math.min(0.8+(sort_stream_score[pn]/200),1.3)*height_ratio);--Did some *height_ratio. -Kid
								_G['sort_stream_p'..pn..'ctext']:linear(0.2);
								_G['sort_stream_p'..pn..'ctext']:zoom(math.min(0.7+(sort_stream_score[pn]/200),1.2)*height_ratio);--Did some *height_ratio. -Kid
								
								_G['sort_stream_p'..pn..'ctexta']:settext(sort_stream_score[pn]);
								_G['sort_stream_p'..pn..'ctexta']:zoom(math.min(0.7+(sort_stream_score[pn]/200),1.2)*height_ratio);--Did some *height_ratio. -Kid
								
								MESSAGEMAN:Broadcast('StepP'..pn..'Good');
								
								if sort_scorevis[pn] == 1 and sort_stream_score[pn] > 40-6 then
									MESSAGEMAN:Broadcast('Visible2P'..pn);
									sort_scorevis[pn] = sort_scorevis[pn]+1;
								end
								if sort_scorevis[pn] == 2 and sort_stream_score[pn] > 80-6 then
									MESSAGEMAN:Broadcast('Visible3P'..pn);
									sort_scorevis[pn] = sort_scorevis[pn]+1;
								end
								if sort_scorevis[pn] == 3 and sort_stream_score[pn] > 120-6 then
									MESSAGEMAN:Broadcast('Visible4P'..pn);
									sort_scorevis[pn] = sort_scorevis[pn]+1;
								end
							
							else
								
								sort_stream_wrongnotes[pn] = 0;
								sort_stream_wrongwait[pn] = 0.8;
								
								sort_stream_nps_hitdelay[pn] = 0;
								sort_stream_nps_timer[pn] = 0;
								sort_stream_nps_count[pn] = 0;
								sort_stream_started[pn] = 0;
								sort_stream_nps[pn] = (sort_stream_nps_count[pn]/math.max(sort_stream_nps_timer[pn],1))*1.5;
								--sort_stream_notespacing[pn] = (SCREEN_HEIGHT*0.08)+(SCREEN_HEIGHT*0.1*(sort_stream_nps[pn]/25))*sort_stream_multiplier[pn]*0.33
								sort_stream_update(pn);
								
								sort_sound('gung.ogg');
								
								MESSAGEMAN:Broadcast('StepP'..pn..'Bad');
								
								_G['sort_stream_nfp'..pn]:decelerate(0.4);
								_G['sort_stream_nfp'..pn]:addy(-160*height_ratio);--Did some *height_ratio. -Kid
								_G['sort_stream_nfp'..pn]:accelerate(0.4);
								_G['sort_stream_nfp'..pn]:addy(160*height_ratio);--Did some *height_ratio. -Kid
							
							end
							
							sort_stream_held[i+(bpn*4)] = 1
							
						end
					end
					
					----------------------don't touch this------------------------
					--release all buttons - used for detecting if a button is newly pressed, as opposed to held
					if sort_keys[i+(bpn*4)] == 0 then
						sort_stream_held[i+(bpn*4)] = 0
					end
					---------------------end don't touch this----------------------
					
					local beat = GAMESTATE:GetSongBeat();
					if beat>sort_bonuscheck and beat < sort_stream_lastbeat+20 then
						--Not changing this, as we don't have SM5 equivalents. -Kid
						--So,there are methods called SetScore and SetCurMaxScore, which do affect things, but not the end-result percentage. Not much I can do... -Kid
						if FUCK_EXE and STATSMAN:GetCurStageStats() then
							if GAMESTATE:IsHumanPlayer(0) then
								local poss = 100
								local act = sort_stream_score[1]
								uksrt_p1bonus = sort_stream_score[1]
								STATSMAN:GetCurStageStats():GetPlayerStageStats(PLAYER_1):SetPossibleDancePoints(poss);
								STATSMAN:GetCurStageStats():GetPlayerStageStats(PLAYER_1):SetActualDancePoints(act);
							end
							if GAMESTATE:IsHumanPlayer(1) then
								local poss = 100
								local act = sort_stream_score[2]
								uksrt_p2bonus = sort_stream_score[2]
								STATSMAN:GetCurStageStats():GetPlayerStageStats(PLAYER_2):SetPossibleDancePoints(poss);
								STATSMAN:GetCurStageStats():GetPlayerStageStats(PLAYER_2):SetActualDancePoints(act);
							end
						end
						sort_bonuscheck = sort_bonuscheck+1;
					end
					
				end
				
			end
			
			self:sleep(0.02);
			self:queuecommand('Update');
			
		end,
    },
    Def.Sprite{
      Name= "actor_k",
      OnCommand= cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,color('1,1,1,1')),
      Texture= "bg.png",
    },
    Def.Sprite{
      Name= "actor_l",
      OnCommand= cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffusealpha,0.5),
      Texture= "lights2.png",
    },
    Def.Sprite{
      Name= "actor_m",
      InitCommand= function(self) sort_belt1a = self end,
      OnCommand= cmd(vertalign,bottom;y,SCREEN_HEIGHT*0.75;x,SCREEN_WIDTH*0.25;--Did some *height_ratio. -Kid
	customtexturerect,0,0,1,7;zoomto,128*height_ratio,640*height_ratio;texcoordvelocity,0,0),
      Texture= "belt.png",
    },
    Def.Sprite{
      Name= "actor_n",
      InitCommand= function(self) sort_belt1b = self end,
      OnCommand= cmd(vertalign,top;y,SCREEN_HEIGHT*0.75;x,SCREEN_WIDTH*0.25;--Did some *height_ratio. -Kid
	customtexturerect,0,0,1,0.2;zoomto,128*height_ratio,32*height_ratio;texcoordvelocity,0,0;diffuse,color('.6,.6,.6,1')),
      Texture= "belt.png",
    },
    Def.Sprite{
      Name= "actor_o",
      InitCommand= function(self) sort_belt2a = self end,
      OnCommand= cmd(vertalign,bottom;y,SCREEN_HEIGHT*0.75;x,SCREEN_WIDTH*0.75;--Did some *height_ratio. -Kid
	customtexturerect,0,0,1,7;zoomto,128*height_ratio,640*height_ratio;texcoordvelocity,0,0),
      Texture= "belt.png",
    },
    Def.Sprite{
      Name= "actor_p",
      InitCommand= function(self) sort_belt2b = self end,
      OnCommand= cmd(vertalign,top;y,SCREEN_HEIGHT*0.75;x,SCREEN_WIDTH*0.75;--Did some *height_ratio. -Kid
	customtexturerect,0,0,1,0.2;zoomto,128*height_ratio,32*height_ratio;texcoordvelocity,0,0;diffuse,color('.6,.6,.6,1')),
      Texture= "belt.png",
    },
    Def.Sprite{
      Name= "actor_q",
      OnCommand= cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffusealpha,0.6),
      Texture= "lights2.png",
    },
    Def.Sprite{
      Name= "actor_r",
      OnCommand= cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT),
      Texture= "towers.png",
    },
    optional_actor(cond_b_result,
    Def.Sprite{
      Name= "actor_s",
      OnCommand= cmd(x,SCREEN_WIDTH*0.25;y,420*(SCREEN_HEIGHT/480);zoom,height_ratio),--Fixed y pos. -Kid
      Texture= "boxes.png",--Added in a zoom. -Kid
    }),
    optional_actor(cond_c_result,
    Def.Sprite{
      Name= "actor_t",
      OnCommand= cmd(x,SCREEN_WIDTH*0.75;y,420*(SCREEN_HEIGHT/480);zoom,height_ratio),--Fixed y pos. -Kid
      Texture= "boxes.png",--Added in a zoom. -Kid
    }),
    optional_actor(cond_d_result,
    Def.BitmapText{
      Name= "actor_u",
      Font= "Combo numbers",
      InitCommand= function(self) sort_stream_p1ctext = self; end,
      OnCommand= cmd(x,SCREEN_WIDTH*0.25;y,SCREEN_HEIGHT*0.9;diffusealpha,0.5;shadowlength,0),
      Text= "",
    }),
    optional_actor(cond_e_result,
    Def.BitmapText{
      Name= "actor_v",
      Font= "Combo numbers",
      InitCommand= function(self) sort_stream_p2ctext = self; end,
      OnCommand= cmd(x,SCREEN_WIDTH*0.75;y,SCREEN_HEIGHT*0.9;diffusealpha,0.5;shadowlength,0),
      Text= "",
    }),
    Def.ActorFrame{
      Name= "actor_w",
      InitCommand= function(self) sort_stream_p1 = self end,
      OnCommand= cmd(x,SCREEN_WIDTH*0.25;y,SCREEN_CENTER_Y+10*height_ratio),--Did some *height_ratio. -Kid
      Def.Quad{
        Name= "actor_x",--SCREEN_WIDTH -> 640 * height_ratio. -Kid
        OnCommand= cmd(blend,"BlendMode_Add";zoomto,(640 * height_ratio)/3,6*height_ratio;diffuse,color('1,1,1,0.5')),
        StepP1BadMessageCommand= cmd(finishtweening;zoomy,12*height_ratio;diffuse,color('1,0,0,1');linear,0.2;zoomy,6*height_ratio),
        StepP1GoodMessageCommand= cmd(finishtweening;zoomy,12*height_ratio;diffuse,color('0,1,0,1');linear,0.2;zoomy,6*height_ratio),
      },
    },
    Def.ActorFrame{
      Name= "actor_y",
      InitCommand= function(self) sort_stream_p2 = self end,
      OnCommand= cmd(x,SCREEN_WIDTH*0.75;y,SCREEN_CENTER_Y+10*height_ratio),--Did some *height_ratio. -Kid
      Def.Quad{
        Name= "actor_z",--SCREEN_WIDTH -> 640 * height_ratio. -Kid
        OnCommand= cmd(blend,"BlendMode_Add";zoomto,(640 * height_ratio)/3,6;diffuse,color('1,1,1,0.5')),
        StepP2BadMessageCommand= cmd(finishtweening;zoomy,12*height_ratio;diffuse,color('1,0,0,1');linear,0.2;zoomy,6*height_ratio),
        StepP2GoodMessageCommand= cmd(finishtweening;zoomy,12*height_ratio;diffuse,color('0,1,0,1');linear,0.2;zoomy,6*height_ratio),
      },
    },
    Def.ActorFrame{
      Name= "actor_A",
      InitCommand= function(self) sort_stream_nfp1 = self; end,
      Def.Sprite{
        Name= "actor_B",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_C",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_D",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_E",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_F",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_ab",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_bb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_cb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_db",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_eb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_fb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_gb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_hb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_ib",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_jb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_kb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_lb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_mb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_nb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_ob",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[1],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
    },
    Def.ActorFrame{
      Name= "actor_pb",
      InitCommand= function(self) sort_stream_nfp2 = self; end,
      Def.Sprite{
        Name= "actor_qb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_rb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_sb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_tb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_ub",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_vb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_wb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_xb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_yb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_zb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_Ab",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_Bb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_Cb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_Db",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_Eb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_Fb",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_ac",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_bc",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_cc",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_dc",
        HideCommand= function(self) self:visible(false); end,
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(sort_stream_note[2],{actor = self}) end,
        Texture= "objects 2x4.png",
      },
    },
    --Quad full of input message commands is replaced with an InputHandler function. -Kid
    Def.Quad{
      Name= "actor_fc",--Unconverted x & y pos and used ratios. -Kid
      OnCommand= cmd(horizalign,left;x,98*width_ratio;y,52*height_ratio;zoomto,(SCREEN_WIDTH-200*width_ratio)+4*width_ratio,20*height_ratio;diffuse,color('0,0,0,1')),
      StartTimerMessageCommand= cmd(linear,56.512-5.686;zoomto,4*width_ratio,20*height_ratio;diffuse,color('0,0,0,1')),
      TimeUpMessageCommand= cmd(finishtweening;zoom,0),
    },
    Def.Quad{
      Name= "actor_gc",--Unconverted x & y pos and used ratios. -Kid
      OnCommand= cmd(horizalign,left;x,100*width_ratio;y,52*height_ratio;zoomto,SCREEN_WIDTH-200*width_ratio,16*height_ratio;diffuse,0,2,0,1),--Made diffuse use numbers. -Kid
      StartTimerMessageCommand= cmd(linear,56.512-5.686;zoomto,0,16*height_ratio;diffuse,2,0,0,1),
    },
    optional_actor(cond_d_result,
    Def.ActorFrame{
      Name= "actor_hc",
      Def.Quad{
        Name= "actor_ic",--Used ratios. -Kid
        OnCommand= cmd(zoomto,50*height_ratio,50*height_ratio;x,SCREEN_WIDTH*0.25-80*height_ratio;y,SCREEN_HEIGHT*0.67+25*height_ratio;vertalign,bottom;diffuse,color('0,0,0,.5')),
        Visible2P1MessageCommand= cmd(decelerate,0.3;zoomy,90*height_ratio),
        Visible3P1MessageCommand= cmd(decelerate,0.3;zoomy,130*height_ratio),
        Visible4P1MessageCommand= cmd(decelerate,0.3;zoomy,170*height_ratio),
      },
      Def.Quad{
        Name= "actor_jc",--Used ratios. -Kid
        OnCommand= cmd(zoomto,50*height_ratio,50*height_ratio;x,SCREEN_WIDTH*0.25+80*height_ratio;y,SCREEN_HEIGHT*0.67+25*height_ratio;vertalign,bottom;diffuse,color('0,0,0,.5')),
        Visible2P1MessageCommand= cmd(decelerate,0.3;zoomy,90*height_ratio),
        Visible3P1MessageCommand= cmd(decelerate,0.3;zoomy,130*height_ratio),
        Visible4P1MessageCommand= cmd(decelerate,0.3;zoomy,170*height_ratio),
      },
      --For all objects, did some ratios. -Kid
      Def.Sprite{
        Name= "actor_kc",
        OnCommand= cmd(diffusealpha,1;animate,0;setstate,0;x,(SCREEN_WIDTH*0.25)-80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67),
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_lc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,1;x,(SCREEN_WIDTH*0.25)-80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-40*height_ratio),
        Texture= "objects 2x4.png",
        Visible2P1MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
      Def.Sprite{
        Name= "actor_mc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,2;x,(SCREEN_WIDTH*0.25)-80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-80*height_ratio),
        Texture= "objects 2x4.png",
        Visible3P1MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
      Def.Sprite{
        Name= "actor_nc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,3;x,(SCREEN_WIDTH*0.25)-80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-120*height_ratio),
        Texture= "objects 2x4.png",
        Visible4P1MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
      Def.Sprite{
        Name= "actor_oc",
        OnCommand= cmd(diffusealpha,1;animate,0;setstate,0+4;x,(SCREEN_WIDTH*0.25)+80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67),
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_pc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,1+4;x,(SCREEN_WIDTH*0.25)+80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-40*height_ratio),
        Texture= "objects 2x4.png",
        Visible2P1MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
      Def.Sprite{
        Name= "actor_qc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,2+4;x,(SCREEN_WIDTH*0.25)+80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-80*height_ratio),
        Texture= "objects 2x4.png",
        Visible3P1MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
      Def.Sprite{
        Name= "actor_rc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,3+4;x,(SCREEN_WIDTH*0.25)+80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-120*height_ratio),
        Texture= "objects 2x4.png",
        Visible4P1MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
    }),
    optional_actor(cond_e_result,
    Def.ActorFrame{
      Name= "actor_sc",
      Def.Quad{
        Name= "actor_tc",--Used ratios. -Kid
        OnCommand= cmd(zoomto,50*height_ratio,50*height_ratio;x,SCREEN_WIDTH*0.75-80*height_ratio;y,SCREEN_HEIGHT*0.67+25*height_ratio;vertalign,bottom;diffuse,color('0,0,0,.5')),
        Visible2P2MessageCommand= cmd(decelerate,0.3;zoomy,90*height_ratio),
        Visible3P2MessageCommand= cmd(decelerate,0.3;zoomy,130*height_ratio),
        Visible4P2MessageCommand= cmd(decelerate,0.3;zoomy,170*height_ratio),
      },
      Def.Quad{
        Name= "actor_uc",--Used ratios. -Kid
        OnCommand= cmd(zoomto,50*height_ratio,50*height_ratio;x,SCREEN_WIDTH*0.75+80*height_ratio;y,SCREEN_HEIGHT*0.67+25*height_ratio;vertalign,bottom;diffuse,color('0,0,0,.5')),
        Visible2P2MessageCommand= cmd(decelerate,0.3;zoomy,90*height_ratio),
        Visible3P2MessageCommand= cmd(decelerate,0.3;zoomy,130*height_ratio),
        Visible4P2MessageCommand= cmd(decelerate,0.3;zoomy,170*height_ratio),
      },
      --For all objects, did some ratios. -Kid
      Def.Sprite{
        Name= "actor_vc",
        OnCommand= cmd(diffusealpha,1;animate,0;setstate,0;x,(SCREEN_WIDTH*0.75)-80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67),
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_wc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,1;x,(SCREEN_WIDTH*0.75)-80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-40*height_ratio),
        Texture= "objects 2x4.png",
        Visible2P2MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
      Def.Sprite{
        Name= "actor_xc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,2;x,(SCREEN_WIDTH*0.75)-80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-80*height_ratio),
        Texture= "objects 2x4.png",
        Visible3P2MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
      Def.Sprite{
        Name= "actor_yc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,3;x,(SCREEN_WIDTH*0.75)-80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-120*height_ratio),
        Texture= "objects 2x4.png",
        Visible4P2MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
      Def.Sprite{
        Name= "actor_zc",
        OnCommand= cmd(diffusealpha,1;animate,0;setstate,0+4;x,(SCREEN_WIDTH*0.75)+80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67),
        Texture= "objects 2x4.png",
      },
      Def.Sprite{
        Name= "actor_Ac",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,1+4;x,(SCREEN_WIDTH*0.75)+80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-40*height_ratio),
        Texture= "objects 2x4.png",
        Visible2P2MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
      Def.Sprite{
        Name= "actor_Bc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,2+4;x,(SCREEN_WIDTH*0.75)+80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-80*height_ratio),
        Texture= "objects 2x4.png",
        Visible3P2MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
      Def.Sprite{
        Name= "actor_Cc",
        OnCommand= cmd(diffusealpha,0;animate,0;setstate,3+4;x,(SCREEN_WIDTH*0.75)+80*height_ratio;zoom,0.6*height_ratio;y,SCREEN_HEIGHT*0.67-120*height_ratio),
        Texture= "objects 2x4.png",
        Visible4P2MessageCommand= cmd(zoom,height_ratio;rotationz,360;linear,0.4;zoom,0.6*height_ratio;rotationz,0;diffusealpha,1),
      },
    }),
    Def.ActorFrame{
      Name= "actor_Dc",--Unconverted x & y pos and did some ratio; 70 -> 80. -Kid
      OnCommand= cmd(x,80*width_ratio;y,45*height_ratio;zoom,0.45*height_ratio;pulse;effectmagnitude,1.2,1,0;effectclock,"bgm";effectperiod,.5;effect_hold_at_full,.5;effectoffset,0.5),--effectdelay -> effect_hold_at_full -Kid
      TimeUpMessageCommand= cmd(visible,false),
      Def.Sprite{
        Name= "actor_Ec",
        InitCommand= cmd(zbuffer,1),
        Texture= "stopwatch.png",
      },
      Def.ActorFrame{
        Name= "actor_Fc",--Unconverted x & y pos. -Kid
        OnCommand= cmd(x,8;y,16;rotationz,15;spin;effectmagnitude,0,0,45;effectclock,"bgm"),
        Def.Sprite{
          Name= "actor_ad",--Unconverted x & y pos. -Kid
          InitCommand= cmd(zbuffer,1;horizalign,right;vertalign,bottom;x,24;y,16),
          Texture= "hand.png",
        },
      },
      Def.Sprite{
        Name= "actor_bd",--Unconverted x & y pos. -Kid
        InitCommand= cmd(zbuffer,1;horizalign,right;vertalign,bottom;x,36;y,36;visible,true),
        Texture= "center.png",
      },
    },
    Def.Sprite{
      Name= "actor_cd",
      Frames= {
        {Frame= 0, Delay= 0.05},
        {Frame= 1, Delay= 0.05},
        {Frame= 2, Delay= 0.05},
        {Frame= 3, Delay= 0.05},
        {Frame= 4, Delay= 0.05},
        {Frame= 5, Delay= 0.05},
        {Frame= 6, Delay= 0.05},
        {Frame= 7, Delay= 0.05},
        {Frame= 8, Delay= 0.05},
        {Frame= 9, Delay= 0.05},
        {Frame= 10, Delay= 0.05},
        {Frame= 11, Delay= 0.05},
        {Frame= 12, Delay= 0.05},
        {Frame= 13, Delay= 0.05},
        {Frame= 14, Delay= 0.05},
        {Frame= 15, Delay= 0.05},
        {Frame= 16, Delay= 0.05},
        {Frame= 17, Delay= 0.05},
        {Frame= 18, Delay= 0.05},
        {Frame= 19, Delay= 0.05},
        {Frame= 20, Delay= 0.05},
        {Frame= 21, Delay= 0.05},
        {Frame= 22, Delay= 0.05},
        {Frame= 23, Delay= 0.05},
        {Frame= 24, Delay= 0.05},
    },
      OnCommand= cmd(zoom,0),
      Texture= "./_explosion 5x5.png",--Same positioning as the watch. -Kid
      TimeUpMessageCommand= cmd(animate,1;setstate,0;x,80*width_ratio;y,45*height_ratio;zoom,2*height_ratio;sleep,1.25;zoom,0),
    },
    Def.Quad{
      Name= "actor_dd",
      InitCommand= function(self) sort_stream_controller = self end,
    },
    Def.Quad{
      Name= "actor_ed",
      OnCommand= function(self)
		sort_started = false;
		mod_firstSeenBeat = GAMESTATE:GetSongBeat();
		fgcurcommand = 1;
		self:sleep(0.02);
		self:queuecommand('Update');
	end,
      UpdateCommand= function(self)
		
		local beat = GAMESTATE:GetSongBeat();
		
		if beat > mod_firstSeenBeat+1 and not sort_started then
			MESSAGEMAN:Broadcast('Start');
			sort_started = true;
		end
		
		if beat > sort_stream_firstbeat-1 and fgcurcommand == 1 then
			MESSAGEMAN:Broadcast('InstAway');
			fgcurcommand = fgcurcommand+1;
		end
		
		if beat > sort_stream_firstbeat-.2 and fgcurcommand == 2 then
			--sort_sound('airhorn.ogg');
			MESSAGEMAN:Broadcast('StartTimer');
			fgcurcommand = fgcurcommand+0.5;
		end
		
		if beat > sort_stream_firstbeat+4 and fgcurcommand == 2.5 then
			--sort_sound('airhorn.ogg');
			MESSAGEMAN:Broadcast('ShowScores');
			fgcurcommand = fgcurcommand+0.5;
		end
		
		if beat > sort_stream_lastbeat-.2 and fgcurcommand == 3 then
			--sort_sound('airhorn.ogg');
			--sort_sound('bang.ogg');
			fgcurcommand = fgcurcommand+1;
		end
		
		if beat > sort_stream_lastbeat+0.2 and fgcurcommand == 4 then
			MESSAGEMAN:Broadcast('TimeUp');
			
			local maxscore = math.max(sort_stream_score[1], sort_stream_score[2])
			if maxscore > sort_stream_todayBest then
				sort_stream_todayBest = maxscore
				sort_sound('record.ogg');
				MESSAGEMAN:Broadcast('UpdateTodayBest');
			end
			if maxscore > sort_stream_highScore then
				taroProfile.UKSRT8Sort.highScore = maxscore
				sort_stream_highScore = maxscore;
				MESSAGEMAN:Broadcast('UpdateHighScore');
			end
			
			if _G['sort_stream_p1ctexta'] then
				_G['sort_stream_p1ctexta']:diffusealpha(1);
			end
			if _G['sort_stream_p2ctexta'] then
				_G['sort_stream_p2ctexta']:diffusealpha(1);
			end
			
			for pn=1,2 do
				if sort_stream_score[pn] == maxscore then
					if _G['sort_stream_p'..pn..'ctexta'] then
						_G['sort_stream_p'..pn..'ctexta']:rainbow();
					end
				end
			end
			
			fgcurcommand = fgcurcommand+1;
		end
		
		self:sleep(0.02);
		self:queuecommand('Update');
	end,
    },
    optional_actor(cond_f_result,
    Def.BitmapText{
      Name= "actor_fd",
      Font= "_eurostile outline",--Did some ratios. -Kid
      OnCommand= cmd(x,SCREEN_CENTER_X-160*width_ratio;y,SCREEN_CENTER_Y-14-35*height_ratio;zoom,1.3*height_ratio;diffusealpha,0;sleep,0),
      Text= "WINNER",
      TimeUpMessageCommand= function(self)
			if sort_stream_score[1] > sort_stream_score[2] then
				self:settext('WINNER');
				if _G['sort_stream_p1ctexta'] then
					_G['sort_stream_p1ctexta']:rainbow();
				end
				self:rainbow();
			end
			if sort_stream_score[1] < sort_stream_score[2] then
				self:settext('LOSE...');
				self:diffuse(0.4,0.6,1,1);
				self:zoom(1.1*height_ratio);--Did some ratios. -Kid
			end
			if sort_stream_score[1] == sort_stream_score[2] then
				self:settext('DRAW');
				self:zoom(1.1*height_ratio);--Did some ratios. -Kid
			end
			self:diffusealpha(1);
		end,
    }),
    optional_actor(cond_f_result,
    Def.BitmapText{
      Name= "actor_gd",
      Font= "_eurostile outline",--Did some ratios. -Kid
      OnCommand= cmd(x,SCREEN_CENTER_X+160*width_ratio;y,SCREEN_CENTER_Y-14-35*height_ratio;zoom,1.3*height_ratio;diffusealpha,0;sleep,0),
      Text= "WINNER",
      TimeUpMessageCommand= function(self)
			if sort_stream_score[1] < sort_stream_score[2] then
				self:settext('WINNER');
				if _G['sort_stream_p2ctexta'] then
					_G['sort_stream_p2ctexta']:rainbow();
				end
				self:rainbow();
			end
			if sort_stream_score[1] > sort_stream_score[2] then
				self:settext('LOSE...');
				self:diffuse(0.4,0.6,1,1);
				self:zoom(1.1*height_ratio);--Did some ratios. -Kid
			end
			if sort_stream_score[1] == sort_stream_score[2] then
				self:settext('DRAW');
				self:zoom(1.1*height_ratio);--Did some ratios. -Kid
			end
			self:diffusealpha(1);
		end,
    }),
    optional_actor(cond_d_result,
    Def.BitmapText{
      Name= "actor_hd",
      Font= "Combo numbers",
      InitCommand= function(self) sort_stream_p1ctexta = self; end,
      OnCommand= cmd(x,SCREEN_WIDTH*0.25;y,SCREEN_HEIGHT*0.9;diffusealpha,0;shadowlength,0),
      Text= "0",
    }),
    optional_actor(cond_e_result,
    Def.BitmapText{
      Name= "actor_id",
      Font= "Combo numbers",
      InitCommand= function(self) sort_stream_p2ctexta = self; end,
      OnCommand= cmd(x,SCREEN_WIDTH*0.75;y,SCREEN_HEIGHT*0.9;diffusealpha,0;shadowlength,0),
      Text= "0",
    }),
    Def.ActorFrame{
      Name= "actor_jd",
      OnCommand= cmd(y,SCREEN_CENTER_Y + -208*height_ratio),--Did some ratio. -Kid
      Def.BitmapText{
        Name= "actor_kd",
        Font= "_eurostile outline",--Unconverted y pos and did some raio. -Kid
        OnCommand= cmd(vertalign,top;x,SCREEN_CENTER_X;y,52*height_ratio;zoom,0.8*height_ratio;diffusealpha,0;sleep,0),
        ShowScoresMessageCommand= cmd(linear,0.5;diffusealpha,1),
        Text= "HIGH SCORE",
      },
      Def.BitmapText{
        Name= "actor_ld",
        DoCommand= function(self)
			self:settext(sort_stream_highScore);
			self:linear(0.5);
			self:diffusealpha(1);
		end,
        Font= "_eurostile outline",--Unconverted y pos and did some ratio. -Kid
        OnCommand= cmd(vertalign,top;x,SCREEN_CENTER_X;y,80*height_ratio;zoom,0.8*height_ratio;diffusealpha,0;sleep,0),
        ShowScoresMessageCommand= cmd(playcommand,"Do"),
        Text= "",
        UpdateHighScoreMessageCommand= cmd(rainbow;playcommand,"Do"),
      },
      Def.BitmapText{
        Name= "actor_md",
        Font= "_eurostile outline",--Unconverted y pos and did some ratio. -Kid
        OnCommand= cmd(vertalign,top;x,SCREEN_CENTER_X;y,(52+56)*height_ratio;zoom,0.8*height_ratio;diffusealpha,0;sleep,0),
        ShowScoresMessageCommand= cmd(linear,0.5;diffusealpha,1),
        Text= "TODAY'S BEST",
      },
      Def.BitmapText{
        Name= "actor_nd",
        DoCommand= function(self)
			self:settext(sort_stream_todayBest);
			self:linear(0.5);
			self:diffusealpha(1);
		end,
        Font= "_eurostile outline",--Unconverted y pos and did some ratio. -Kid
        OnCommand= cmd(vertalign,top;x,SCREEN_CENTER_X;y,(80+56)*height_ratio;zoom,0.8*height_ratio;diffusealpha,0;sleep,0),
        ShowScoresMessageCommand= cmd(playcommand,"Do"),
        Text= "",
        UpdateTodayBestMessageCommand= cmd(rainbow;playcommand,"Do"),
      },
    },
    Def.Sprite{
      Name= "actor_od",
      NoteskinWarningMessageCommand= function(self)
		sort_sound('airhorn.ogg');
		self:linear(0.5);
		self:diffusealpha(1);
		self:sleep(8);
		self:linear(0.4);
		self:diffusealpha(0);
	end,
      OnCommand= cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffusealpha,0),
      Texture= "noteskinwarning.png",
    },
    Def.Quad{
      Name= "actor_pd",
      InitCommand= function(self) sort_colorchangerp1 = self end,
      OnCommand= cmd(visible,false),
      UpdateColorsCommand= function(self)
	
		local pn = 1;
	
		local ind = _G['sort_stream_curnotep'..pn]
		local thing = sort_stream_colors[ind];
		sort_stream_mynotes[pn][1]:x((SCREEN_WIDTH*-0.25)+((pn)*SCREEN_CENTER_X));
		sort_stream_mynotes[pn][1]:setstate(thing-1);
		
		for i=2,sort_stream_show do
			local ind = _G['sort_stream_curnotep'..pn]+i-1
			local thing = sort_stream_colors[ind];
			sort_stream_mynotes[pn][i]:x((SCREEN_WIDTH*-0.25)+((pn)*SCREEN_CENTER_X));
			sort_stream_mynotes[pn][i]:setstate(thing-1);
		end
		
	end,
    },
    Def.Quad{
      Name= "actor_qd",
      InitCommand= function(self) sort_colorchangerp2 = self end,
      OnCommand= cmd(visible,false),
      UpdateColorsCommand= function(self)
	
		local pn = 2;
	
		local ind = _G['sort_stream_curnotep'..pn]
		local thing = sort_stream_colors[ind];
		sort_stream_mynotes[pn][1]:x((SCREEN_WIDTH*-0.25)+((pn)*SCREEN_CENTER_X));
		sort_stream_mynotes[pn][1]:setstate(thing-1);
		
		for i=2,sort_stream_show do
			local ind = _G['sort_stream_curnotep'..pn]+i-1
			local thing = sort_stream_colors[ind];
			sort_stream_mynotes[pn][i]:x((SCREEN_WIDTH*-0.25)+((pn)*SCREEN_CENTER_X));
			sort_stream_mynotes[pn][i]:setstate(thing-1);
		end
		
	end,
    },
    Def.Sprite{
      Name= "actor_rd",--Unconverted x pos and did some ratio. -Kid
      OnCommand= cmd(horizalign,right;x,0;y,SCREEN_CENTER_Y-5*height_ratio),
      StartTimerMessageCommand= cmd(zoom,1.3*height_ratio;linear,0.1;x,SCREEN_CENTER_X+24*width_ratio;
	queuecommand,"Vib"),--Enclosed "Vib". -Kid
      StopVibCommand= cmd(stopeffect;linear,1;addy,-5*height_ratio;decelerate,0.6;addy,-100*height_ratio;zoomx,0.8*height_ratio;zoomy,1*height_ratio;diffusealpha,0),
      Texture= "go_g.png",
      VibCommand= cmd(vibrate;effectmagnitude,5,5,5;glow,1,1,1,1;linear,0.3;glow,1,1,1,0;queuecommand,"StopVib"),
    },
    Def.Sprite{
      Name= "actor_sd",--Did some ratios. -Kid
      OnCommand= cmd(horizalign,left;x,SCREEN_WIDTH;y,SCREEN_CENTER_Y+5*height_ratio),
      StartTimerMessageCommand= cmd(zoom,1.3*height_ratio;linear,0.1;x,SCREEN_CENTER_X-24*width_ratio;
	queuecommand,"Vib"),--Enclosed "Vib". -Kid
      StopVibCommand= cmd(stopeffect;linear,1;addy,5*height_ratio;decelerate,0.6;addy,100*height_ratio;zoomx,0.8*height_ratio;zoomy,1*height_ratio;diffusealpha,0),
      Texture= "go_o.png",
      VibCommand= cmd(vibrate;effectmagnitude,5,5,5;glow,1,1,1,1;linear,0.3;glow,1,1,1,0;queuecommand,"StopVib"),
    },
    Def.Sprite{
      Name= "actor_td",--Added zoom and did some ratio. -Kid
      OnCommand= cmd(zoom,height_ratio;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;visible,false),
      StopVibCommand= cmd(stopeffect;sleep,3;decelerate,1;diffusealpha,0;addy,50*height_ratio),
      Texture= "timeup.png",
      TimeUpMessageCommand= cmd(visible,true;vibrate;effectmagnitude,3,3,3;diffusealpha,1;glow,1,1,1,1;zoom,1.4*height_ratio;linear,0.3;glow,1,1,1,0;zoom,1.4*height_ratio;queuecommand,"StopVib"),
    },
    Def.Sprite{
      Name= "actor_ud",
      HideCommand= cmd(visible,false),--Added zoom. -Kid
      InstAwayMessageCommand= cmd(linear,0.3;diffusealpha,0;queuecommand,"Hide"),
      OnCommand= cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoom,height_ratio;diffusealpha,1),
      Texture= "instr.png",
    },
    Def.Sprite{
      Name= "actor_vd",
      OnCommand= cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;
	diffuse,0,0,0,1;sleep,0.5*(60/170);linear,60/170;diffusealpha,0),
      Texture= "_black.png",
    },
  },
}
