Advertisement
IcarusLives

Slot Machine

Nov 7th, 2018
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 12.98 KB | None | 0 0
  1. @echo off & setlocal enableDelayedExpansion & mode 50,50
  2.  
  3. if "%~1" neq "" goto :%~1
  4.  
  5. call :macros
  6. call :cMouse
  7.    
  8.     %button% 20 33
  9.     %button% 25 33
  10.     %button% 30 33
  11.     %button% 10 16
  12.     %button% 10 19
  13.     %button% 10 25
  14.     %button% 10 28
  15.     %button% 48  2
  16.     set "money=500"
  17.     set /a "i1=1", "i2=3", "i3=5"
  18.     for %%a in ("" "" "" "  1. Master" "  2. Daring" "  3. Getting there!" "  4. Slug" "  5. Dead sloth" "") do echo=%%~a
  19.     set /p "difficulty=Select difficulty: "
  20.     if !difficulty! gtr 15 set "difficulty=15"
  21.     if !difficulty! lss 1 set "difficulty=1"
  22.     echo. & echo    Current funds: %money%
  23.     set /p "bet=How much do you want to bet?: "
  24.     if !bet! gtr %money% set /a "bet=money"
  25.     if !bet! lss 1 set "bet=1"
  26.     set /a "speed=difficulty"
  27.     set "b[6]=true"
  28.    
  29. if exist getClickInfo.txt del /f /q getClickInfo.txt
  30. ( start /b cmd /c "%~nx0" Controller ) | "%~nx0" GAME_ENGINE
  31. goto :eof
  32.  
  33.  
  34. :GAME_ENGINE
  35. for /l %%# in () do (
  36.    
  37.     rem ----------------------------------------------------------------------------------------------------------------------------
  38.     rem scrolling number engine
  39.     if "!stopScroll!" neq "true" (
  40.         set /a "frame+=1", "sd=frame %% speed"
  41.         if !sd! equ 0 (
  42.             set /a "gframe+=1"
  43.             if "!l1!" equ "" if "!b[6]!" neq "true" ( set /a "i1=(!random! %% 5 + 5)" ) else ( set /a "i1=((gframe + 1) + 1) %% 10" )
  44.             if "!l2!" equ "" if "!b[6]!" neq "true" ( set /a "i2=(!random! %% 5 + 5)" ) else ( set /a "i2=((gframe + 3) + 1) %% 10" )
  45.             if "!l3!" equ "" if "!b[6]!" neq "true" ( set /a "i3=(!random! %% 5 + 5)" ) else ( set /a "i3=((gframe + 5) + 1) %% 10" )
  46.         )
  47.         ( for %%p in (%button[8](c):c=16%) do %plot% %%~p )
  48.     ) else (
  49.         for %%r in (%button[1](c):c=16% %button[2](c):c=16% %button[3](c):c=16% ) do %plot% %%~r
  50.     )
  51.     rem ----------------------------------------------------------------------------------------------------------------------------
  52.    
  53.    
  54.    
  55.     rem ----------------------------------------------------------------------------------------------------------------------------
  56.     rem capture clickable information
  57.     if exist getClickInfo.txt ( < getClickInfo.txt ( set /p "mx=" & set /p "my=" ))
  58.    
  59.     rem Stop game
  60.     if !my! geq 1 if !my! leq 3 if !mx! geq 47 if !mx! leq 50 ( ( for %%p in (%button[8](c):c=9%) do %plot% %%~p )
  61.         if "!stopScroll!" neq "true" ( set "stopScroll=true" & set "l1=" & set "l2=" & set "l3=" ) else ( set "stopScroll=false")
  62.     )
  63.    
  64.     rem Scrolling numbers buttons
  65.     if !my! geq 30 if !my! leq 32 (
  66.         if !mx! geq 18 if !mx! leq 21 ( ( for %%p in (%button[1](c):c=10%) do %plot% %%~p ) & set /a "l1=i1" )
  67.         if !mx! geq 23 if !mx! leq 26 ( ( for %%p in (%button[2](c):c=10%) do %plot% %%~p ) & set /a "l2=i2" )
  68.         if !mx! geq 28 if !mx! leq 31 ( ( for %%p in (%button[3](c):c=10%) do %plot% %%~p ) & set /a "l3=i3" )
  69.     )
  70.    
  71.     rem Scrolling or Random Numbers buttons
  72.     if !my! geq 23 if !my! leq 25 if !mx! geq 9 if !mx! leq 12 ( set "b[6]=true"  & <nul set /p "=%esc%[2J")
  73.     if !my! geq 26 if !my! leq 28 if !mx! geq 9 if !mx! leq 12 ( set "b[6]=false" & <nul set /p "=%esc%[2J")
  74.     if "!b[6]!" equ "true" ( for %%r in (%button[6](c):c=11%) do ( %plot% %%~r ) ) else ( for %%r in (%button[7](c):c=11%) do ( %plot% %%~r ) )
  75.    
  76.     rem Toggle BET:MORE/LESS buttons
  77.     if "!turnOffButton!" equ "" (
  78.         if !my! geq 14 if !my! leq 16 if !mx! geq 9 if !mx! leq 12 ( set /a "turnOffButton=frame + 10" & set "b[4]=true" & if !bet! leq 10000 set /a "bet*=2" & <nul set /p "=%esc%[2J")
  79.         if !my! geq 17 if !my! leq 19 if !mx! geq 9 if !mx! leq 12 ( set /a "turnOffButton=frame + 10" & set "b[5]=true" & if !bet! geq     5 set /a "bet/=2" & <nul set /p "=%esc%[2J")
  80.     )
  81.     if "!b[4]!" equ "true" if !frame! gtr !turnOffButton! ( ( for %%r in (%button[4](c):c=16%) do ( %plot% %%~r )) & set "b[4]=false" & set "turnOffButton=" ) else ( ( for %%p in (%button[4](c):c=9%) do %plot% %%~p ) )
  82.     if "!b[5]!" equ "true" if !frame! gtr !turnOffButton! ( ( for %%r in (%button[5](c):c=16%) do ( %plot% %%~r )) & set "b[5]=false" & set "turnOffButton=" ) else ( ( for %%p in (%button[5](c):c=9%) do %plot% %%~p ) )
  83.    
  84.     ( set "mx=" & set "my=") & if exist getClickInfo.txt del /f /q getClickInfo.txt
  85.     rem ----------------------------------------------------------------------------------------------------------------------------
  86.    
  87.     rem This is what happens when all the buttons are clicked
  88.     if "!l1!" equ "4" if "!l2!" equ "0" if "!l3!" equ "4" ( call :winningOdds )
  89.     if defined l1 if defined l2 if defined l3 ( if "!l1!" equ "!l2!" ( if "!l2!" equ "!l3!" ( call :winningOdds ) else ( call :losingOdds ) ) else ( call :losingOdds ) )
  90.     rem ----------------------------------------------------------------------------------------------------------------------------
  91.    
  92.    
  93.    
  94.    
  95.    
  96.     rem ----------------------------------------------------------------------------------------------------------------------------
  97.     rem draw sevenSegmentDisplay
  98.     call :sevenSegmentDisplay !i1! 43 20 20
  99.     call :sevenSegmentDisplay !i2! 57 25 20
  100.     call :sevenSegmentDisplay !i3! 90 30 20
  101.    
  102.     rem draw clickable buttons
  103.     %plot% 1 16 10 "BET:More"
  104.     %buttonDisplay%  9 15 7
  105.     %plot% 1 19 10 "BET:Less"
  106.     %buttonDisplay%  9 18 7
  107.    
  108.     %plot% 2 25 11 "Scroll"
  109.     %buttonDisplay%  9 24 7
  110.     %plot% 2 28 11 "Random"
  111.     %buttonDisplay%  9 27 7
  112.    
  113.     %plot% 42 2 9 "STOP"
  114.     %buttonDisplay% 47 1 7
  115.    
  116.     %buttonDisplay% 19 32 7
  117.     %buttonDisplay% 24 32 7
  118.     %buttonDisplay% 29 32 7
  119.     rem ----------------------------------------------------------------------------------------------------------------------------
  120.     rem display the screen
  121.     <nul set /p "=!screen! %esc%[6;5H Difficulty - !difficulty! Money: !money!  Bet: !bet!" & set "screen="
  122. )
  123. :exit
  124. exit
  125.  
  126. :Controller
  127.     for %%a in (c x y) do set "%%a="
  128.     for /f "tokens=1-3" %%W in ('"%temp%\Mouse.exe"') do set /a "mc=%%W,mx=%%X,my=%%Y"
  129.     (   echo !mx!
  130.         echo !my!
  131.     )>getClickInfo.txt
  132. goto :controller
  133.  
  134. :winningOdds
  135.     %plot% 24 15 10 "WINNER"
  136.     ( set /a "money+=(bet + (bet / difficulty) + 10)", "i1=1", "i2=3", "i3=5") & set "l1=" & set "l2=" & set "l3="
  137.     for %%r in (%button[1](c):c=16% %button[2](c):c=16% %button[3](c):c=16% ) do %plot% %%~r
  138.     call :particleAnimation
  139. goto :eof
  140.  
  141. :losingOdds
  142.     ( set /a "i1=1", "i2=3", "i3=5") & set "l1=" & set "l2=" & set "l3="
  143.     for %%r in (%button[1](c):c=16% %button[2](c):c=16% %button[3](c):c=16% ) do %plot% %%~r
  144. goto :eof
  145.  
  146. :particleAnimation
  147.     for /l %%p in (0,1,50) do (
  148.         set /a "tx[%%p]=%%p", "ty[%%p]=!random! %% 10 + 50", "alpha[%%p]=255", "lifeSpan[%%p]=!random! %% 10 + 15" & set "a[%%p]=true"
  149.     )
  150.     for /l %%# in (1,1,20) do (
  151.         for /l %%p in (1,1,50) do (
  152.             if "!a[%%p]!" equ "true" (
  153.                 set /a "ty[%%p]+=-1", "lifeSpan[%%p]-=1", "alpha[%%p]-=1"
  154.                 if !lifeSpan[%%p]! leq 0 ( set "a[%%p]=false" ) else ( %plot% !tx[%%p]! !ty[%%p]! !alpha[%%p]! Û )
  155.             ) else (
  156.                 set /a "ty[%%p]=!random! %% 10 + 50", "alpha[%%p]=255", "lifeSpan[%%p]=!random! %% 10 + 15" & set "a[%%p]=true"
  157.             )
  158.         )
  159.         for /l %%a in (1,15,1000000) do rem
  160.         <nul set /p "=!screen!" & set "screen="
  161.     )
  162.         <nul set /p "=%esc%[2J"
  163. goto :eof
  164.  
  165. :sevenSegmentDisplay
  166.     if not defined n[9] (
  167.         set /a "n[0]=0x7E", "n[1]=0x30", "n[2]=0x6D", "n[3]=0x79", "n[4]=0x33", "n[5]=0x5B", "n[6]=0x5F", "n[7]=0x70", "n[8]=0x7F", "n[9]=0x7B"
  168.     )
  169.     set /a "index=%~1", "posX_1=%~3", "posX_2=%~3 + 1", "posX_3=%~3 + 2", "posX_4=%~3 - 1", "posY_1=%~4", "posY_2=%~4 + 1", "posY_3=%~4 + 2", "posY_4=%~4 + 3", "posY_5=%~4 + 4", "posY_6=%~4 + 5", "posY_7=%~4 + 6"
  170.  
  171.     for %%i in (!index!) do (
  172.         set /a "a=%~2 * ((n[%%i] >> 6) & 1)"
  173.         %plot% !posX_1! !posY_1! !a! Û
  174.         %plot% !posX_2! !posY_1! !a! Û
  175.         set /a "a=%~2 * ((n[%%i] >> 5) & 1)"
  176.         %plot% !posX_3! !posY_2! !a! Û
  177.         %plot% !posX_3! !posY_3! !a! Û
  178.         set /a "a=%~2 * ((n[%%i] >> 4) & 1)"
  179.         %plot% !posX_3! !posY_5! !a! Û
  180.         %plot% !posX_3! !posY_6! !a! Û
  181.         set /a "a=%~2 * ((n[%%i] >> 3) & 1)"
  182.         %plot% !posX_1! !posY_7! !a! Û
  183.         %plot% !posX_2! !posY_7! !a! Û
  184.         set /a "a=%~2 * ((n[%%i] >> 2) & 1)"
  185.         %plot% !posX_4! !posY_5! !a! Û
  186.         %plot% !posX_4! !posY_6! !a! Û
  187.         set /a "a=%~2 * ((n[%%i] >> 1) & 1)"
  188.         %plot% !posX_4! !posY_2! !a! Û
  189.         %plot% !posX_4! !posY_3! !a! Û
  190.         set /a "a=%~2 * ((n[%%i] >> 0) & 1)"
  191.         %plot% !posX_1! !posY_4! !a! Û
  192.         %plot% !posX_2! !posY_4! !a! Û
  193.     )
  194. goto :eof
  195.  
  196. :macros
  197. rem ----------------------------------------------------------------------------------------------------------------------------
  198. set ^"LF=^
  199.  
  200. ^" Above empty line is required - do not remove
  201. set ^"\n=^^^%LF%%LF%^%LF%%LF%^^"
  202. for /F %%a in ('echo prompt $E^| cmd') do set "ESC=%%a"
  203. <nul set /p "=!esc![?25l"
  204.  
  205. rem %plot% x y 0-255 CHAR
  206. set plot=for %%# in (1 2) do if %%#==2 ( for /f "tokens=1-4" %%1 in ("^!args^!") do (%\n%
  207.     set "screen=^!screen^!!esc![%%2;%%1H!esc![38;5;%%3m%%~4!esc![0m"%\n%
  208. )) else set args=
  209.  
  210. rem %button% x y - This macro creates an array of buttons with the data in place for you.
  211. rem Example output ( "X Y C Û" "X+1 Y C Û")
  212. rem Example output clarified ( "20 30 C Û" "21 30 C Û")
  213. rem USAGE:
  214. REM     %button% 20 30
  215. REM     %button% 23 30
  216. REM     echo %button[1](c):c=10%
  217. REM     echo %button[2](c):c=10%
  218. rem We do this because C is variable, and we want to be able to change colors on the fly.
  219. rem Here is example of how to display this button
  220. rem     for %a in (%buttonDisplay[1](c):c=9%) do PLOT %~a
  221. rem Since the button data is an array of information we want to loop through it, and plot the data
  222. set "buttons="
  223. set button=for %%# in (1 2) do if %%#==2 ( for /f "tokens=1-3" %%1 in ("^!args^!") do (%\n%
  224.     set /a "$bxp1=%%~1 + 1", "buttons+=1"%\n%
  225.     for /f "tokens=1-2" %%b in ("^!$bxp1^! ^!buttons^!") do ( set "button[%%c]^(c^)="%%~1 %%~2 c Û" "%%~b %%~2 c Û"")%\n%
  226. )) else set args=
  227.  
  228. rem %buttonDisplay% x y c - This macro is used to display a border around the buttons we created from BUTTON
  229. set buttonDisplay=for %%# in (1 2) do if %%#==2 ( for /f "tokens=1-3" %%1 in ("^!args^!") do (%\n%
  230.     set /a "$bx1=%%~1", "$bx2=$bx1 + 1", "$bx3=$bx1 + 2", "$bx4=$bx1 + 3", "$by1=%%~2", "$by2=$by1 + 1", "$by3=$by1 + 2", "$bc=%%~3"%\n%
  231.     for %%b in ("^!$bx1^! ^!$by1^! ^!$bc^! É" "^!$bx2^! ^!$by1^! ^!$bc^! Í" "^!$bx3^! ^!$by1^! ^!$bc^! Í" "^!$bx4^! ^!$by1^! ^!$bc^! »" "^!$bx4^! ^!$by2^! ^!$bc^! º" "^!$bx4^! ^!$by3^! ^!$bc^! ¼" "^!$bx3^! ^!$by3^! ^!$bc^! Í" "^!$bx2^! ^!$by3^! ^!$bc^! Í" "^!$bx1^! ^!$by3^! ^!$bc^! È" "^!$bx1^! ^!$by2^! ^!$bc^! º") do ( ^!plot^! %%~b )%\n%
  232. )) else set args=
  233.  
  234. rem ----------------------------------------------------------------------------------------------------------------------------
  235. goto :eof
  236.  
  237. :cMouse
  238.     if not exist "%temp%\mouse.exe" (
  239.         for %%a in ("TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  240.                     "AAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5v"
  241.                     "dCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAECAAAAAAAAAAAA"
  242.                     "AAAAAOAADwMLAQYAAAAAAAAAAAAAAAAAQBEAAAAQAAAAIAAAAABAAAAQAAAAAgAA"
  243.                     "BAAAAAAAAAAEAAAAAAAAAFAhAAAAAgAAAAAAAAMAAAAAABAAABAAAAAAEAAAEAAA"
  244.                     "AAAAABAAAAAAAAAAAAAAACAgAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  245.                     "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  246.                     "AAAAAAAAAABcIAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC50ZXh0AAAA"
  247.                     "ABAAAAAQAAAAAgAAAAIAAAAAAAAAAAAAAAAAACAAAGAuZGF0YQAAAFABAAAAIAAA"
  248.                     "UgEAAAAEAAAAAAAAAAAAAAAAAABAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  249.                     "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVieWB7AgAAACQjUX6UOgs"
  250.                     "AAAAg8QED79F/lAPv0X8UA+2RfpQuAAgQABQ6IgBAACDxBC4AAAAAOkAAAAAycNV"
  251.                     "ieWB7CQAAACQuPb///9Q6GwBAACJRfy4AAAAAIlF3I1F+FCLRfxQ6FwBAACLRfiD"
  252.                     "yBCD4L+D4N9Qi0X8UOhOAQAAi0XchcAPhAUAAADpnAAAAI1F9FC4AQAAAFCNReBQ"
  253.                     "i0X8UOgvAQAAD7dF4IP4Ag+FcwAAAItF6IP4AbgAAAAAD5TAiUXchcAPhA8AAACL"
  254.                     "RQi5AQAAAIgI6SMAAACLReiD+AK4AAAAAA+UwIlF3IXAD4QKAAAAi0UIuQIAAACI"
  255.                     "CItF3IXAD4QdAAAAi0UIg8ACD79N5GaJCItFCIPAAoPAAg+/TeZmiQjpVP///4tF"
  256.                     "+FCLRfxQ6JUAAADJwwAAAFWJ5YHsFAAAAJC4AAAAAIlF7LgAAAMAULgAAAEAUOh9"
  257.                     "AAAAg8QIuAEAAABQ6HcAAACDxASNRexQuAAAAABQjUX0UI1F+FCNRfxQ6GEAAACD"
  258.                     "xBSLRfRQi0X4UItF/FDoXf7//4PEDIlF8ItF8FDoRgAAAIPEBMnDAP8lXCBAAAAA"
  259.                     "/yV0IEAAAAD/JXggQAAAAP8lfCBAAAAA/yWAIEAAAAD/JWAgQAAAAP8lZCBAAAAA"
  260.                     "/yVoIEAAAAD/JWwgQAAAACVkICVkICVkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  261.                     "iCAAAAAAAAAAAAAAtCAAAFwgAACgIAAAAAAAAAAAAAD9IAAAdCAAAAAAAAAAAAAA"
  262.                     "AAAAAAAAAAAAAAAAvyAAAMggAADVIAAA5iAAAPYgAAAAAAAACiEAABkhAAAqIQAA"
  263.                     "OyEAAAAAAAC/IAAAyCAAANUgAADmIAAA9iAAAAAAAAAKIQAAGSEAACohAAA7IQAA"
  264.                     "AAAAAG1zdmNydC5kbGwAAABwcmludGYAAABfY29udHJvbGZwAAAAX19zZXRfYXBw"
  265.                     "X3R5cGUAAABfX2dldG1haW5hcmdzAAAAZXhpdABrZXJuZWwzMi5kbGwAAABHZXRT"
  266.                     "dGRIYW5kbGUAAABHZXRDb25zb2xlTW9kZQAAAFNldENvbnNvbGVNb2RlAAAAUmVh"
  267.                     "ZENvbnNvbGVJbnB1dEEAAAAA") do echo %%~a>>cMouse.txt
  268.        
  269.         certutil -decode cMouse.txt %temp%\mouse.exe >nul
  270.         del /f /q cmouse.txt
  271.     )
  272. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement