Line 4: That’s what the
~ does. When you put the RButton on the end, you make it a single~line key remap, and none of the code below it is associated with it.
Line 5 - It never executes. Because of what you did on line 4, this is stranded code that is not associated with anything.
Line 7 - The
#If directive is how you make hotkeys/remaps conditional, so read about it and look at the examples. You can’t put key remaps inside of regular blocks of code like what you showed. The
while has no effect on it.
Line 13 - That’s not how it works. Again, hotkeys are made conditional using the
#If directive.
Lines 17 and 19 - Where you put the Random commands, they will not be random each time but will have the same values the whole time the script is running. Is that what you want?
Line 18 - Regular single-letter key names are not to be included in braces except for a specific reason. From the
Send documentation:
The characters
{} are used to enclose
key names and other options, and to send special characters literally. For example,
{Tab} is
Tab and
{!} is a literal exclamation mark.
[v1.1.27+]: Enclosing a plain ASCII letter (a-z or A-Z) in braces forces it to be sent as the corresponding virtual keycode, even if the character does not exist on the current keyboard layout. In other words,
Send a produces the letter "a" while
Send {a} may or may not produce "a", depending on the keyboard layout. For details, see the
remarks below.