Number to numpad inputs

Ask gaming related questions
Younety
Posts: 1
Joined: 15 Mar 2023, 09:21

Number to numpad inputs

Post by Younety » 15 Mar 2023, 09:41

Hi
I am trying to code a script which tries every combination of number between 0000 and 9999 by either doing numpad inputs or clicking on the screen, I am basically trying to bruteforce storage boxes in Ark. The problem is that my coding capacities are quite limited so here I am seeking for help :)
Here is a list of features I would like to implement in that script:
-Take a number, split it in 4 numbers and each number gets a different input (example: 7390 is split between 7, 3, 9 and 0 and for the 7 we get a numpad input of 7 (or mouse click where the 7 is on the screen) and same for the 3, 9 and 0
-Build a list of every combination that has been tried so far
-Stop when the storage box opens
-Ask where to start and where to stop (if the script ran for 10 minutes and stopped at number 4672 then it is not necessary to try all the numbers arleady tested before upon relaunch)
-Maybe start with a list of the most common pincodes such as 0000 1111 2222 1234...

Thanks to anyone willing to help me :')

User avatar
DuckingQuack
Posts: 219
Joined: 20 Jan 2023, 18:20

Re: Number to numpad inputs

Post by DuckingQuack » 22 Mar 2023, 21:56

Give this a shot and let me know how it goes... I'm willing to help you improve it, but if you want it to stop automatically after finding a winning combo, then you need to add image search to the code and find a unique pixel that is always present while picking the lock and when it goes away, the checker stops.
If reactivating the box is needed between the checks, just add something like send "e" to the FnPin at the bottom of it.

Adding Image search to the code is the easy part. :lolno: Happy pixel/image hunting.

Code: Select all

#Requires AutoHotkey v2.0 ; Made by DuckingQuack
#SingleInstance Force
; The hotkeys are currently "Esc" to kill the app, "f" to check the pin, and "g" to see the last used pin.
; You can change them to whatever works best for you.
Esc::ExitApp                                    ; Press this if things start going crazy.
f:: {                                           ; MANUALLY Start/Pause the Pin Checker. It does NOT stop automatically after opening a box.
    Static on := False
    SetTimer(FnPin, 100 * on := !on)            ; 100 is how often the Pin Checker will check another pin. 100ms is 10 times per second.
}
g:: MsgBox Pin ?? "Ready"                       ; Press this key to see the most recently used Pin. Can be but should not be used while the pin checker is still checking but will CAUSE COMBOS TO BE SKIPPED!
FnPin() {
    ;If WinActive(YourWindowTitle) {            ; I highly suggest uncommenting this line after adding your game's window title to prevent a spam of numbers outside of the game.
    Static Var1 := 0                            ; Used to increment the pin. This number is the checker start point, edit it to control the start point.
    Global Pin := Format("{:04}", Var1++)       ; Formats the pin to be four digits with leading zeroes. Editing the "4" controls pin length.
    PinArray := StrSplit(Pin)                   ; Splits the pin into an array to allow adding Numpad to the digits so the send uses the Numpad.
    For i, v in PinArray {                      ; This automatically loops a number of times equal to the pin length,
            PinArray[A_Index] := '{Numpad' . PinArray[A_Index] . '}'    ; adds Numpad to each digit,
            Send(PinArray[A_Index])                                     ; and sends them as a keystroke.
    }
    If Var1 > 9999                              ; This sets the upper limit of the pin and resets it to zero if over that value.
        Var1 := 0
    ToolTip(Pin)                                ; Displays the curently used pin as a tooltip.
}
;}     ; After setting the window title, uncomment this bracket too.
Best of Luck,
The Duck

Post Reply

Return to “Gaming”