Page 1 of 1

Need script for a game

Posted: 26 Jan 2016, 11:03
by piciojunior
Hey , I'm Italian and I'm new in the world of AutoHotkey . I wuold ask you for one problem that afflicts me, I need one script for Rust . It's a game survival for pc and i need a script for open door protected from pin of 4 numbers that test all numbers from 0000 at 9999 ( like bruteforce 8-). The script must do:
1) Press "E" for insert the code and Hold "E"
2) Insert the code ( 0000, 0001 , 0002 ... )
3) Press Enter
4) Wait 2 seconds
5) Try again if the door did not open

The script must work with a game, how to use it?

Sorry for my bad english. Thanks very much !
I attach one photo for make idea for the script
Spoiler

Re: Need script for a game

Posted: 26 Jan 2016, 14:24
by Lebastard
I think it would take ages to find the code tho, you probably get killed in the progress lol

Re: Need script for a game

Posted: 26 Jan 2016, 15:14
by SnowFlake
it would take like 5 hours doing the code from 0000 to 9999 xD

Re: Need script for a game

Posted: 27 Jan 2016, 11:19
by Shadowpheonix
If you really want to do it, this code should work (although I have not tested it myself). It will take a little over 5 hours and 33 minutes to try all 10000 codes. I have set it up so that if you release the key, then press it again, it will continue where it left off (although rebooting or otherwise reloading the script will also reset it).

Code: Select all

PassCode = 0000    ; Get the variable ready for the first use (just in case you forget to manually reset it).

#IfWinActive, ahk_exe Rust.exe    ; Makes the following code only work with you are in your game.  You will likely need to edit this line

^e::PassCode = 0000    ; Ctrl+E used to manually reset the PassCode back to 0000.  Use this before trying a new door.

e::    ; Press & hold E to try and open a door.
While GetKeyState("e","P")    ; Loops as long as you are holding E down.
{
    Send e%PassCode%{Enter}    ; Sends E followed by the current pass code followed by Enter.
    Sleep 2000    ; Waits 2 seconds
	PassCode := PassCode + 1    ; Increases the pass code by 1
	If PassCode = 10000    ; Check if the pass code exceeds 9999
	{
        MsgBox All codes have been tried!    ; Inform the user that all the codes have been tried.
        PassCode = 0000    ; Reset the pass code to 0000 for the next door.
		Break    ; Break out of the loop even if E is still held down.
    }
    PassCode := Format("{1:04}",PassCode)    ; Ensure the increased pass code is 4 digits.
}
Return    ; Ends the code for the E hotkey.
#IfWinActive    ; Ends the previous #IfWinActive statement.

Re: Need script for a game

Posted: 27 Jan 2016, 12:39
by Lebastard
Nice shadowpheonix, but 5 hours in a row on 1 lock it's suspicious + he probably get's killed in the progress by people anyway :P

Re: Need script for a game

Posted: 27 Jan 2016, 16:35
by Shadowpheonix
Lebastard wrote:Nice shadowpheonix, but 5 hours in a row on 1 lock it's suspicious + he probably get's killed in the progress by people anyway :P
Honestly, I wrote the code simply for the practice. I agree that it is likely be too slow to be useful, but a 2 second delay between attempts will do that.