A simple but versatile script Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Forsti

A simple but versatile script  Topic is solved

23 Oct 2017, 04:58

I'm a real noob at this coding stuff, but i have managed to use the scripts i have in several ways because modifying them is a lot easier than writing new code, so i need a new script that does a bit of everything which i can then later use to rip apart and do other things, this thing im going to ask for will be really simple for someone experienced to make but i wouldnt even know where to begin. It is for gaming purposes, something to stop me from being afk basically, but does other things.

So first, of course it needs a button to start and stop it.
The main part is pressing and holding mouse 1, it should do it for 10 minutes and then do the following sequence.
stop holding mouse 1
hold keys W,A,S and D for 0.1 seconds in a RANDOM order (but W always last) one after another.
press spacebar
turn my mouse to the left for 0.3 seconds and then right after, turn it right the same amount.
send y/repair{enter} with enough time between letters (lets say 0.2 seconds) for any game to understand it. (might need this to be done every second loop or even every third loop.)
start holding mouse 1 again untill the next loop begins in 10 minutes.

This is what i need it to do right now, but since its going to be the basis that i will use to make future scripts you can add a whole bunch of stuff that is just sitting there not actually doing anything as long as you explain its function, the more the better but not adding any is really fine, i will ask for more if the need arises.
User avatar
Reloaded
Posts: 283
Joined: 25 Aug 2017, 08:48

Re: A simple but versatile script

24 Oct 2017, 08:47

Forsti wrote:I'm a real noob at this coding stuff, but i have managed to use the scripts i have in several ways because modifying them is a lot easier than writing new code, so i need a new script that does a bit of everything which i can then later use to rip apart and do other things, this thing im going to ask for will be really simple for someone experienced to make but i wouldnt even know where to begin. It is for gaming purposes, something to stop me from being afk basically, but does other things.

So first, of course it needs a button to start and stop it.
The main part is pressing and holding mouse 1, it should do it for 10 minutes and then do the following sequence.
stop holding mouse 1
hold keys W,A,S and D for 0.1 seconds in a RANDOM order (but W always last) one after another.
press spacebar
turn my mouse to the left for 0.3 seconds and then right after, turn it right the same amount.
send y/repair{enter} with enough time between letters (lets say 0.2 seconds) for any game to understand it. (might need this to be done every second loop or even every third loop.)
start holding mouse 1 again untill the next loop begins in 10 minutes.

This is what i need it to do right now, but since its going to be the basis that i will use to make future scripts you can add a whole bunch of stuff that is just sitting there not actually doing anything as long as you explain its function, the more the better but not adding any is really fine, i will ask for more if the need arises.
I did it so, the Script just start if you hold your "Mouse1"

Code: Select all

Mouse1::		;Idk "Mouse1" but if you know the name make it here 
    While GetKeyState("RButton", "P"){		;And here again your "Mouse1" but let the P ! 
 
Send, {A}
Send, {Space}
Send, {S}
Send, {Space}
Send, {D}
Send, {Space}
Send, {W}
Send, {Space}
MouseMove, -5, 00, 50, R
MouseMove, +5, 00, 50, R

SendRaw, y/repair
Send, {enter}

Sleep, 120000
reload
}
return
And, you press your "Mouse1" and the Script start did what you writted.

Code: Select all

F1::		;You can change the "F1" to your "Mouse1" 

Send, {A}
Send, {Space}
Send, {S}
Send, {Space}
Send, {D}
Send, {Space}
Send, {W}
Send, {Space}
MouseMove, -5, 00, 50, R
MouseMove, +5, 00, 50, R

SendRaw, y/repair
Send, {enter}

Sleep, 120000
reload
Forsti
Posts: 4
Joined: 23 Oct 2017, 05:05

Re: A simple but versatile script

24 Oct 2017, 09:26

I'll test it shortly, but im going to ask 1 thing first, how do you make something random, what if i dont want it to be asdw every time?

This has already been a great help as i can change it as i please.
User avatar
Reloaded
Posts: 283
Joined: 25 Aug 2017, 08:48

Re: A simple but versatile script

24 Oct 2017, 11:03

Forsti wrote:I'll test it shortly, but im going to ask 1 thing first, how do you make something random, what if i dont want it to be asdw every time?

This has already been a great help as i can change it as i please.
Like this ?

Code: Select all

F::		;You can change the "F1" to your "Mouse1" 

Random, rand, 1, 3
goto, %rand%

1:
send {a}
Send, {W}
return

2:
send {s}
Send, {W}
return

3:
send {d}
Send, {W}
return

MouseMove, -5, 00, 50, R
MouseMove, +5, 00, 50, R

SendRaw, y/repair
Send, {enter}

Sleep, 120000
reload
Forsti
Posts: 4
Joined: 23 Oct 2017, 05:05

Re: A simple but versatile script

24 Oct 2017, 17:29

The random part works fine, but now it doesnt send the /repair part.

I also learned that i really need to figure out how to make a script that holds a button and then can stop pressing it and doing it as a loop.
the thing i had in mind when first posting was to have a script that plays the game for me while i sleep but at the same time does enough random stuff to go around the afk system, which seems to be a bit complicated.
User avatar
Reloaded
Posts: 283
Joined: 25 Aug 2017, 08:48

Re: A simple but versatile script

25 Oct 2017, 07:15

Forsti wrote:The random part works fine, but now it doesnt send the /repair part.

I also learned that i really need to figure out how to make a script that holds a button and then can stop pressing it and doing it as a loop.
the thing i had in mind when first posting was to have a script that plays the game for me while i sleep but at the same time does enough random stuff to go around the afk system, which seems to be a bit complicated.
Like this?

Code: Select all

F::		;You can change the "F1" to your "Mouse1" 

Random, rand, 1, 2, 3
goto, %rand%

1:
send {a}
Send, {W}
return

2:
send {s}
Send, {W}
return

3:
send {d}
Send, {W}
return

MouseMove, -5, 00, 50, R
MouseMove, +5, 00, 50, R

Sleep, 120000
reload



F1::					 ;Change the "F1" to whatever you want 
    While GetKeyState("F1"){     	 ;Change the "F1" to whatever you want.

SendRaw, y/repair
Send, {enter}

}
return
 


Esc:: ExitApp
Forsti
Posts: 4
Joined: 23 Oct 2017, 05:05

Re: A simple but versatile script

25 Oct 2017, 07:34

I figured it all out now, thanks for the help.
User avatar
Reloaded
Posts: 283
Joined: 25 Aug 2017, 08:48

Re: A simple but versatile script

25 Oct 2017, 10:19

Forsti wrote:I figured it all out now, thanks for the help.
Np :)

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Shoobis and 77 guests