AutoPlay 5 Gold Edition

Mar 27th, 2021 (edited)
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  4. ;   Seeing this is getting more views than I expected on PasteBin, I suppose i should write a proper "Read Me" with a few pointers. First of all, if you're reading this, thanks for taking a look. I am sorta proud I could do something like this given my lack of coding skills and pea sized brain. If you're already good at AHKing, I'm sure you can hustle your way around this little mess, but I've thrown some comments to help whoever needs helping. (I hope they're good enough.)
  6. ;   This is a script for AutoHotKey that uses both the vJoy software (That creates virtual joysticks on Windows) and a library that integrates it with AHK. Just google them up, I'm sure you'll find them. Thanks to the creators of both!
  8. ;   Basically, it toggles a random button with a random delay between them, and also I did a "turbo" function of sorts that triggers a specific button every loop, no matter what button was chosen to be pressed, a held button which is always activated, and an unheld one which is vice versa. (If 0 was chosen then it disables the function.) If you hold the right Ctrl key a message box appears. (The same one that appears at the start.) Click OK to start the inputnado. right Ctrl works as a sort of pause button, and a reset button. (It clears all the inputs, making all buttons unpressed.)
  10. ;   How is this script useful? Well...the most useful I can find is by being a dumb opponent on 2 player games without a CPU option. Atari 2600 had a lot of these. Alternatively, you could make both be controlled by the script so you can watch...that's what I do. I even put bets on who's going to win. It's kinda fun...don't laugh! >:(
  12. ;   Optimally, you should set the variables below to suit your needs, but i've set some defaults that should work on simple Atari 2600 games. The delay is calculated based on the number of buttons and joysticks, so that having more won't make it necessary to reduce the delay. It also has a minimum amount of delay you can set so that no button toggle is faster than it.
  14. ;   I don't know what else to explain, but feel free to fool around and mess with the code. It has the "Do whatever with it, but don't blame me if something happens." license, which should be self-explanatory. I don't even need credit, just knowing my code is making the world better makes me all fuzzy wuzzy inside :3
  16. ;   So...what you waiting for? Go have some fun!
  18. #singleinstance, force
  19. #include <cvjoyinterface>   ;vjoy interface
  21. vjoy:=new cvjoyinterface()  ;create parent obj
  22. vjoy.singlestickmode:=0 ;control multiple joys
  24. joynum:=2   ;how many joysticks
  25. btnnum:=5   ;how many buttons on each
  26. delay:=2000 ;delay between inputs
  27. mindelay:=500   ;minimum delay
  28. btntur:=    ;optional turbo button
  29. btnhld:=    ;optional held button
  30. btnunhld:=  ;optional unheld button
  32. while(1)    ;loop entire script
  33. {
  34.     lap:=1  ;init lap for next loop
  35.     while(lap<=joynum)  ;init all joys
  36.     {
  37.         joy_%lap%:=vjoy.devices[lap]
  38.         lap_b:=1    ;init lap for next loop
  39.         while(lap_b<=btnnum)    ;init buttons for each joy
  40.         {
  41.             joy_%lap%_btn_%lap_b%:=0
  42.             joy_%lap%.setbtn(0,lap_b)
  43.             lap_b++
  44.         }
  45.         lap++
  46.     }
  47.     reset:=0    ;init reset var
  48.     MsgBox, 0, ,    ;pause until closed
  49.     while(!reset)   ;input generation
  50.     {
  51.         if getkeystate("rctrl") ;detect input before
  52.         {
  53.             reset:=1
  54.         }
  55.         random,joysel,1,joynum  ;randomize picks
  56.         random,btnsel,1,btnnum  ;
  57.         random,delay_b,1,delay  ;
  58.         random,delay_c,1,delay_b    ;weigh towards low delay
  60.         joy_%joysel%.setbtn(joy_%joysel%_btn_%btnsel%,btnsel)   ;actual input
  61.         joy_%joysel%_btn_%btnsel%:=!(joy_%joysel%_btn_%btnsel%) ;invert button state
  63.         joy_%joysel%.setbtn(joy_%joysel%_btn_%btntur%,btntur)   ;turbo input
  64.         joy_%joysel%_btn_%btntur%:=!(joy_%joysel%_btn_%btntur%)
  66.         joy_%joysel%.setbtn(1,btnhld)   ;held input
  67.         joy_%joysel%_btn_%btnhld%:=1
  69.         joy_%joysel%.setbtn(0,btnunhld) ;unheld input
  70.         joy_%joysel%_btn_%btnunhld%:=0
  72.         sleep,(delay_c+mindelay)/(joynum*btnnum)    ;wait depends on number of buttons/joys
  73.         if getkeystate("rctrl") ;detect input after
  74.         {
  75.             reset=1
  76.         }
  77.     }
  78. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add to your ad blocker whitelist or disable your adblocking software.