I need help with a game called Growtopia.
Can anyone assist me with a script that input characters between intervals then looping itself.
For example,
The phrase "Hello World" will spell out letter by letter with a 1 second interval, afterwards "Entering" (or pressing the Enter Key) to display the text in the game. Looping over and over for (let us say) thirty minutes.
I would be thankful if there would be an explanation so that I can learn how to do it myself in the future.
Thanks in advance.
Script for Typing
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: Script for Typing
So first is the interval between each letter of the phrase "Hello World", which by default autohotkey has a slower typing speed as long as sendmode Input is not found in the script. So SetKeyDelay setting to 1000 (since time is in milliseconds) will need to be at the top of the script. https://autohotkey.com/docs/commands/SetKeyDelay.htm
In this case the other parameters can be left blank.
Next will be the hotkey to which will run the script. You can set this to anything and you can find all the specific here https://autohotkey.com/docs/Hotkeys.htm
Now we need the phrase in which to send so we will set a variable for phrase like so
Notice that the phrase is enclosed with "" which lets the code know that phrase is a string of text and not another variable. If you want a phrase to include a " use a "" in its place. This variable can be place anywhere before the hotkey or in the hotkey as long as its not being called before the variable has been established.
The last step is the Loop for 30 minutes. Right after the hotkey has been stated we want to include a statement of StartTime := A_TickCount which can be found here https://autohotkey.com/docs/Variables.htm#date
This is another variable that looks at the current time at which the hotkey started. Now comes a little bit of the tricky part, we will use a loop until statement for this process which can be found here https://autohotkey.com/docs/commands/Until.htm
So inside the loop we want to have 2 commands, the send command with our variable phrase, and another send command with the {enter}. You can find the send command here https://autohotkey.com/docs/commands/Send.htm
Now for the Until Statement which follows the loop, so we need to do some math in order to get the time that has elapsed. So our until statement will look like this
The break is the way that we want to end the loop. Notice that I have used another variable Timer, which we will use for the max time we want the loop to run (I am doing this since 30 minutes in milliseconds is a very large number). So we will do something like this
After your until statement place a return to tell the hotkey that once its done with the Until statement that it can go back to waiting for the hotkey to be pressed again.
Your final code should look something like this.
In this case the other parameters can be left blank.
Next will be the hotkey to which will run the script. You can set this to anything and you can find all the specific here https://autohotkey.com/docs/Hotkeys.htm
Now we need the phrase in which to send so we will set a variable for phrase like so
Code: Select all
phrase := "Hello World"
The last step is the Loop for 30 minutes. Right after the hotkey has been stated we want to include a statement of StartTime := A_TickCount which can be found here https://autohotkey.com/docs/Variables.htm#date
This is another variable that looks at the current time at which the hotkey started. Now comes a little bit of the tricky part, we will use a loop until statement for this process which can be found here https://autohotkey.com/docs/commands/Until.htm
So inside the loop we want to have 2 commands, the send command with our variable phrase, and another send command with the {enter}. You can find the send command here https://autohotkey.com/docs/commands/Send.htm
Now for the Until Statement which follows the loop, so we need to do some math in order to get the time that has elapsed. So our until statement will look like this
Code: Select all
Until (A_TickCount - StartTime) > Timer
Break
Code: Select all
Timer := 30 * 60 * 1000 ;The first number is number of minutes that is needed to run, the second is the conversion from minutes to seconds, and the third is from seconds to milliseconds.
Your final code should look something like this.
Spoiler
Who is online
Users browsing this forum: Google [Bot] and 174 guests