Advertisement
MHFiver

AutoPlay 4

Mar 27th, 2021
1,357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #singleinstance, force
  2. #include <cvjoyinterface>   ;vjoy interface
  3.  
  4. vjoy:=new cvjoyinterface()  ;create parent obj
  5. vjoy.singlestickmode:=0 ;control multiple joys
  6.  
  7. joynum:=2   ;how many joysticks
  8. btnnum:=5   ;how many buttons on each
  9. delay:=2500 ;delay between inputs
  10. mindelay:=50    ;minimum delay
  11. btntur:=5   ;optional turbo button
  12.  
  13. while(1)    ;loop entire script
  14. {
  15.     lap:=1  ;init lap for next loop
  16.     while(lap<=joynum)  ;init all joys
  17.     {
  18.         joy_%lap%:=vjoy.devices[lap]
  19.         lap_b:=1    ;init lap for next loop
  20.         while(lap_b<=btnnum)    ;init buttons for each joy
  21.         {
  22.             joy_%lap%_btn_%lap_b%:=0
  23.             joy_%lap%.setbtn(0,lap_b)
  24.             lap_b++
  25.         }
  26.         lap++
  27.     }
  28.     reset:=0    ;init reset var
  29.     MsgBox, 0, ,    ;pause until closed
  30.     while(!reset)   ;input generation
  31.     {
  32.         if getkeystate("rctrl") ;detect input before
  33.         {
  34.             reset:=1
  35.         }
  36.         random,joysel,1,joynum  ;randomize picks
  37.         random,btnsel,1,btnnum  ;
  38.         random,delay_b,1,delay  ;
  39.         random,delay_c,1,delay_b    ;weigh towards low delay
  40.         joy_%joysel%.setbtn(joy_%joysel%_btn_%btnsel%,btnsel)   ;actual input
  41.         joy_%joysel%_btn_%btnsel%:=!(joy_%joysel%_btn_%btnsel%) ;invert button state
  42.         joy_%joysel%.setbtn(joy_%joysel%_btn_%btntur%,btntur)   ;turbo input
  43.         joy_%joysel%_btn_%btntur%:=!(joy_%joysel%_btn_%btntur%)
  44.         sleep,delay_c/(joynum*btnnum)   ;wait depends on number of buttons/joys
  45.         if getkeystate("rctrl") ;detect input after
  46.         {
  47.             reset=1
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement