It works
Thank you very much Rohwedder. I have added some other lines to the code in order to accomodate other features. Here is the full code for future reference to anyone else struggling with the same issue:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
/* Description
Written By: Zain
Date Started: 28/11/2021
Last Edit: 28/11/2021
Program Description:
This is a script that automatically creates a random nick on Jartex.
IMPORTANT: This must be ran as admin for it to work on Minecraft!
Rand is just a file with random stuff people write in their names like XD.
*/
NumpadDiv::
SetKeyDelay, 0, 60
ControlSend, , t/unnick{Enter}, A
fileread, list, nouns.txt
noun := strsplit(list, ["`r`n","`n","`r"])
random,rdm,1,noun.Length()
var1 := noun[rdm],1
fileread, list, rand.txt
rand := strsplit(list, ["`r`n","`n","`r"])
random,rdm,1,rand.Length()
rand1 := rand[rdm],1
StringReplace, var1, var1,`r`n,, All
StringReplace, rand1, rand1,`r`n,, All
Random, var2, 1, 9999
var1 .= rand1 .= var2
nick := SubStr(var1, 1, 16) ; Caps the number of characters to 16
ControlSend, , t/nick{Space}, A
ControlSend, , %nick%{Enter}, A
sleep 200
Click
return
^r::Reload