inconsistency in key remapping (im ne w)

Ask gaming related questions (AHK v1.1 and older)
beginnerAHKuser123
Posts: 1
Joined: 05 Apr 2024, 09:49

inconsistency in key remapping (im ne w)

05 Apr 2024, 09:52

Code: Select all

'::toggle_1 := !toggle_1

#if WinActive("Roblox") && (toggle_1)
  *g::send 9
  *y::send 0
  *j::send -
  *h::send =


#if 

[::ExitApp
for some reason the h part isnt working everything else works, thank u guys
gregster
Posts: 9037
Joined: 30 Sep 2013, 06:48

Re: inconsistency in key remapping (im ne w)

05 Apr 2024, 11:19

Since = is an assignment operator of AHK v1's deprecated but still usable legacy syntax and Send could also be a variable name 🤷‍♂️, you have to solve the resulting ambiguity of this line by either using send `=, send {=} or send {text}=. Or see the code box below. ;)
(A similar problem would arise for :=, though. At least in AHK v1.)

Memo:
https://www.autohotkey.com/docs/v1/lib/SetEnv.htm#Remarks wrote:The memory occupied by a large variable can be freed by setting it equal to nothing, e.g. Var =
(The variable doesn't have to be "large", obviously, to use this.)


This is one of the rarer cases where the often optional comma after a command actually makes sense and avoids ambiguity. This also works:

Code: Select all

Send, =
https://www.autohotkey.com/docs/v1/Language.htm#commands wrote:The comma separating the command name from its parameters is optional, except in the following cases:

* When it's necessary to prevent the line from being interpreted as a legacy assignment or assignment expression.

Code: Select all

MsgBox, := This would be an assignment without the comma.
[...]

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 48 guests