All I want the script to do is send a random line from the text file, by pressing F3 once. The text file contains of text like:
G 6:
start new func(125
G 7:
start new func(130
The thing is, the script should pickup "two lines", lines like:
G 6:
start new func(125
So that G 6 and start new func are basically together, and not only G 6:.
Here's my current script:
Code: Select all
list =
(
)
; FileRead, list, % E:\Decom\monsters.txt ; <<<< in order to load the list from a file instead
o := (obj:=StrSplit(list, "`n")).clone()
l := length := obj.length()
F3::
(l or (o:=obj.clone(), l:=length))
random, r, 1, % l ; generates a random number between 1 and the current length of the array of words
SendInput % obj.removeAt(r) ; remove the word from the given random position in the array returning it
--l
return
F4:: ; press control+r to reload
Reload
return
As always, it would be cool if someone helps me out.