Programming Showdown in Joystick, How to guide.

I do have desenvolved a way to play Pokemon Showdown through my joystick. It's helpful if you want to be on your bed and has a monitor in long distance, por example.
I'm learning the english language. Sorry for any errors.

Requeriments:
- AutoIT 3
- JoyToKey
- Joystick with 14 functional buttons, at least


Introduction

Whats AutoIT?

AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!

AutoIt was initially designed for PC “roll out” situations to reliably automate and configure thousands of PCs. Over time it has become a powerful language that supports complex expressions, user functions, loops and everything else that veteran scripters would expect.
Basicaly, We will use it to make hotkeys to peform some actions, that is click on moves, pokemons, forfeit button and etc... Then we will use JoyToKey to trigger that functions through a joystick.

IMPORTANT
If do you want to check what these lines realy do for you own, you can check help files on AutoIT or search it on internet.

HOW TO
a - Install AutoIT 3
b - Open that: Autoit Window Info and SciTE script editor
c - paste my code on Scite script editor
d - Enter on a battle in pokemon showdown (sugested random)


1 - Finder Tool: That will pick some information about the pokemon showdown window. Click and drag to the first move of u pokemon.
2 - buttons: -
3 - Position: This is important. After u get this information about the first move, you ill doublick on it in AutoIT Window Info and paste in the specific function
4 - PixelSearch: This is helpful to search for a pixel on the screen before make some actions. We will need it only to close battle window, forfeit and search for new battles.

5 - Assing the cordenates:



6 - Assing the pixels ( do exactly what im doing to do):

6.1 - Activate Magnify:


6.2 - Close battle circule:


Drag the finder tool on the this circule , not in the cross.(in the battle window, not in my print)
Double click on color section on windows info and paste on $forfeitcircule function

6.3 - Confirm forfeit:


Use finder tool inside the red circule on pokemon showdown window (not in my print)

Where to paste the color?
Example:


Save the script After u assign all coordenates. Then configure joytokey, come back to the scite and press F5 to run the script.



Code:
;~ This product was be developed to be used on Showdown and others pokemon plataform.
;~ Feel free to make any improviment or edit.
;~ Free license.
;~ Requeriments: Windows OS, JoyToKey, Joystick with 14 functional buttons and duo charizard background on showdown (to pixelsearch).
;~ Pokemon Showdown to Joystick by: NaK HORUZEN - 2017 // Everyone can share this script, but share the credits too. ;D

WinActivate(",Google Chrome")
;this will stop the whole script
;esc button
HotKeySet("{esc}","myexit")

;will activate z power or mega evolution
;home button
HotKeySet("{END}","ZPowerMegaEvolution")

;the moves buttons
; end button
HotKeySet("{BREAK}","move01")
;pageup button
HotKeySet("{PGUP}","move02")
;pagedown button
HotKeySet("{PGDN}","move03")
;left windows button
HotKeySet("{HOME}","move04")


;will close the battle window if you in battle or will search for battle if you on home screen
;break button
HotKeySet("{end}","CloseBattleWindowOrSearchForBattle")

;the pokemon's button
HotKeySet("{f6}","pokemon01")
HotKeySet("{f7}","pokemon02")
HotKeySet("{f8}","pokemon03")
HotKeySet("{f9}","pokemon04")
HotKeySet("{f10}","pokemon05")
HotKeySet("{f12}","pokemon06")

;utility
;will check oponent pokemon speed
HotKeySet("{RWIN}","CheckPokemonSpeed")
;turn on timer
HotKeySet("{LWIN}","Timer")
;only click
HotKeySet("{RSHIFT}","Click")


while 1

WEnd

func ZPowerMegaEvolution()

MouseClick("left",261, 595,1,1)

   EndFunc

func move01()

MouseClick("left",90, 556,1,1)

EndFunc

func move02()

MouseClick("left",291, 561,1,1)

EndFunc

func move03()

MouseClick("left",452, 561,1,1)

EndFunc

func move04()

MouseClick("left",549, 563,1,1)

EndFunc

func CheckPokemonSpeed()
MouseMove(427, 259)
EndFunc

func CloseBattleWindowOrSearchForBattle()
$SearchForBattle = PixelSearch(58, 347,58, 347,0xD5BE54)
if IsArray($SearchForBattle) = 1 Then
MouseClick("left",164, 335,1,1)
Else
$forfeitCircule = PixelSearch(366, 98,366, 98,0x999999)
if IsArray($forfeitCircule) = 1 Then
MouseClick("left",364, 87,1,1)
Else
$forfeitWindow = PixelSearch(690, 105,690, 105,0x0D151E)
if IsArray($forfeitWindow) = 1 Then
MouseClick("left",406, 189,1,1)
EndIf
EndIf
EndIf
EndFunc


func pokemon01()

MouseClick("left",66, 624,1,1)

EndFunc

func pokemon02()

MouseClick("left",195, 626,1,1)

EndFunc

func pokemon03()

MouseClick("left",261, 617,1,1)

EndFunc

func pokemon04()

MouseClick("left",389, 546,1,1)

EndFunc

func pokemon05()

MouseClick("left",502, 552,1,1)

EndFunc

func pokemon06()

MouseClick("left",600, 548,1,1)

EndFunc

func click()

MouseClick("left")

EndFunc

Func myexit()

   Exit

   EndFunc
Some AutoIT buttons code:

Code:
{!} !
{#} #
{+} +
{^} ^
{{} {
{}} }
{SPACE} SPACE
{ENTER} ENTER key on the main keyboard
{ALT} ALT
{BACKSPACE} or {BS} BACKSPACE
{DELETE} or {DEL} DELETE
{UP} Up arrow
{DOWN} Down arrow
{LEFT} Left arrow
{RIGHT} Right arrow
{HOME} HOME
{END} END
{ESCAPE} or {ESC} ESCAPE
{INSERT} or {INS} INS
{PGUP} PageUp
{PGDN} PageDown
{F1} - {F12} Function keys
{TAB} TAB
{PRINTSCREEN} Print Screen key
{LWIN} Left Windows key
{RWIN} Right Windows key
{NUMLOCK on} NUMLOCK (on/off/toggle)
{CAPSLOCK off} CAPSLOCK (on/off/toggle)
{SCROLLLOCK toggle} SCROLLLOCK (on/off/toggle)
{BREAK} for Ctrl+Break processing
{PAUSE} PAUSE
{NUMPAD0} - {NUMPAD9} Numpad digits
{NUMPADMULT} Numpad Multiply
{NUMPADADD} Numpad Add
{NUMPADSUB} Numpad Subtract
{NUMPADDIV} Numpad Divide
{NUMPADDOT} Numpad period
{NUMPADENTER} Enter key on the numpad
{APPSKEY} Windows App key
{LALT} Left ALT key
{RALT} Right ALT key
{LCTRL} Left CTRL key
{RCTRL} Right CTRL key
{LSHIFT} Left Shift key
{RSHIFT} Right Shift key
{SLEEP} Computer SLEEP key
{ALTDOWN} Holds the ALT key down until {ALTUP} is sent
{SHIFTDOWN} Holds the SHIFT key down until {SHIFTUP} is sent
{CTRLDOWN} Holds the CTRL key down until {CTRLUP} is sent
{LWINDOWN} Holds the left Windows key down until {LWINUP} is sent
{RWINDOWN} Holds the right Windows key down until {RWINUP} is sent
{ASC nnnn} Send the ALT+nnnn key combination
{BROWSER_BACK} Select the browser "back" button
{BROWSER_FORWARD} Select the browser "forward" button
{BROWSER_REFRESH} Select the browser "refresh" button
{BROWSER_STOP} Select the browser "stop" button
{BROWSER_SEARCH} Select the browser "search" button
{BROWSER_FAVORITES} Select the browser "favorites" button
{BROWSER_HOME} Launch the browser and go to the home page
{VOLUME_MUTE} Mute the volume
{VOLUME_DOWN} Reduce the volume
{VOLUME_UP} Increase the volume
{MEDIA_NEXT} Select next track in media player
{MEDIA_PREV} Select previous track in media player
{MEDIA_STOP} Stop media player
{MEDIA_PLAY_PAUSE} Play/pause media player
{LAUNCH_MAIL} Launch the email application
{LAUNCH_MEDIA} Launch media player
{LAUNCH_APP1} Launch user app1
{LAUNCH_APP2} Launch user app2
{OEM_102} Either the angle bracket key or the backslash key on the RT 102-key keyboard
 
Last edited:

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top