Advertisement
MHFiver

AutoPlay

Mar 26th, 2021
1,593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include joylib
  2.  
  3. joynum:=2   ;how many joysticks
  4. butnum:=5   ;how many buttons on each
  5. delay:=1000 ;delay between inputs
  6. buttur:=5   ;optional turbo button
  7.  
  8. while(1)    ;loop entire script
  9. {
  10.     lap:=1  ;init lap for next loop
  11.     while(lap<=joynum)  ;init all joys
  12.     {
  13.         joy_%lap%.initialize[%lap%]
  14.         lap_b:=1    ;init lap for next loop
  15.         while(lap_b<=butnum)    ;init buttons for each joy
  16.         {
  17.             joy_%lap%_but_%lap2%=0
  18.             lap_b++
  19.         }
  20.         lap++
  21.     }
  22.     reset:=0    ;init reset var
  23.     while(!reset)   ;input generation
  24.     {
  25.         if getkeystate("rctrl") ;detect input before
  26.         {
  27.             reset:=1
  28.         }
  29.         joysel=random,1,joynum  ;randomize picks
  30.         butsel=random,1,butnum  ;
  31.         delay_b=random,1,delay  ;
  32.         delay_c=random,1,delay_b    ;weigh towards low delay
  33.         joy_%joysel%.setbtn(joy_%joysel%_but_%butsel%,butsel)   ;actual input
  34.         joy_%joysel%_but_%butsel%:=!(joy_%joysel%_but_%butsel%) ;invert button state
  35.         wait,delay_c/(joynum*butnum)    ;wait depends on number of buttons/joys
  36.         joy_%joysel%.setbtn(0,buttur)   ;turbo input
  37.         wait,10 ;
  38.         joy_%joysel%.setbtn(1,buttur)   ;
  39.         if getkeyval("rctrl")   ;detect input after
  40.         {
  41.             reset=1
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement