The string definitions need to occur up front. They will be empty the first time you invoke the hotkey the way you’ve shown it.
Code: Select all
startingNum := 1
string1 =You lose no hit points{!}
string2 =You lose 50 hit points{!}
string3 =You lose 100 hit points{!}
Gui, Add, Text, x80 w100 vstartingNum, % "Number: " startingNum
Gui, Add, Button, xm yp+30 w200 gAddButton, Click here to add 1 to the number
Gui, Show
return
:T:wol::
Random, Var,1,3
send, % string%Var%
Send, {ENTER}
if (Var != 1) {
RegExMatch(string%Var%, "\d+", Num)
startingNum -= Num
GuiControl,, startingNum, % "Number: " startingNum
}
return
AddButton:
GuiControl,, startingNum, % "Number: " ++StartingNum
return
GuiClose:
ExitApp