Advertisement
Jousway

CONSOLE GO!

Feb 22nd, 2015
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.12 KB | None | 0 0
  1. --HEHU I CANT LUA - Jousway
  2. text,word = "SM:\\> ","";
  3. output = "Stepmania Console 1.0 - Use DIR for Screens"
  4. nobut = 0;
  5.  
  6. function input(event)
  7.     if event.type == "InputEventType_Release" then
  8.         nobut = 1;
  9.         return;
  10.     end;
  11.            
  12.     if nobut == 1 then
  13.         word = ToEnumShortString(event.DeviceInput.button);
  14.         if string.match(text, "SM... .+") ~= nil then
  15.             cm,st = string.match(text, "(SM... )(.+)");
  16.         end;
  17.         if word == "backspace" then
  18.             if text ~= "SM:\\> " then
  19.                 text = string.match(text, "(.+).");
  20.             end;
  21.         elseif word == "space" then
  22.             text = text.." ";
  23.         elseif word == "enter" then
  24.             if st == "dir" then
  25.                 output = output.."\nScreenSelectMusic ScreenOptionsService ScreenExit"
  26.             elseif st == "screenselectmusic" then
  27.                 ts:SetNextScreenName("ScreenSelectMusic");
  28.                 ts:StartTransitioningScreen("SM_GoToNextScreen");
  29.             elseif st == "screenoptionsservice" then
  30.                 ts:SetNextScreenName("ScreenOptionsService");
  31.                 ts:StartTransitioningScreen("SM_GoToNextScreen");
  32.             elseif st == "screenexit" then
  33.                 output = "Exiting Game";
  34.                 text = "";
  35.                 ts:SetNextScreenName("ScreenExit");
  36.                 ts:StartTransitioningScreen("SM_GoToNextScreen");
  37.             elseif st == "cls" then
  38.                 output = "";
  39.             elseif st == "help" then
  40.                 output = "Stepmania Console 1.0 - Use DIR for Screens";
  41.             else
  42.                 output = output.."\nERROR: Screen Not Found"
  43.             end;
  44.             text = cm;
  45.         elseif string.match(word, "..") == nil then
  46.             text = text..word;
  47.         end;
  48.         CONSOLEI:settext(text);
  49.         CONSOLEO:settext(output);      
  50.             nlin = 1;
  51.         for l in string.gmatch(output, "\n") do
  52.             nlin = nlin+1;
  53.         end;
  54.        
  55.         CONSOLEO:y(SCREEN_BOTTOM-60-(16.5*nlin));
  56.         nobut = 0;
  57.     end;
  58. end;
  59.  
  60. return Def.ActorFrame {    
  61.     Def.BitmapText{ Name="CONSOLEI", Font= "Common Normal", InitCommand=cmd(xy,5,SCREEN_BOTTOM-50;halign,0), Text=text},
  62.     Def.BitmapText{ Name="CONSOLEO", Font= "Common Normal", InitCommand=cmd(xy,5,SCREEN_BOTTOM-50-26.5;halign,0), Text=output};
  63.     OnCommand = function(self)
  64.         CONSOLEO = self:GetChild("CONSOLEO");
  65.         CONSOLEI = self:GetChild("CONSOLEI");
  66.    
  67.         ts = SCREENMAN:GetTopScreen();
  68.         ts:AddInputCallback(input);
  69.     end;
  70. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement