Page 1 of 1

### Need help (could be ahk bug)  Topic is solved

Posted: 10 Nov 2017, 09:21

Code: Select all

``````    if (x1 != 1) {
x = 5
}
x1 = 1
wheelup::
x += 1
if (x > 5) {
x = 1
}
loop {
if (a%x% = 1) {
sendinput %x%
break
}
x += 1
if (x > 5) {
x = 1
}
}
return

wheeldown::
x -= 1
if (x <= 0) {
x = 5
}
loop {
if (a%x% = 1) {
sendinput %x%
break
}
x -= 1
if (x > 5) {
x = 1
}
}
return
``````
Every variable is defined later on so don't worry about that my problem is when i try to change a1:

Code: Select all

``````numpad1::
if (a1 != 1) {
a1 = 1
} else {
a1 = 0
}``````
and the code goes through again a few times it retrieves the following message:
The following variable name contains an illegal character:
a-1
any help?

### Re: Need help (could be ahk bug)

Posted: 10 Nov 2017, 11:42

Code: Select all

``````loop {
if (a%x% = 1) {
sendinput %x%
break
}
x -= 1
if (x > 5) {
x = 1
}
}``````
Appears there is nothing in this loop to stop x from becoming negative (-1). So you tried to create a variable named "a-1" and "-" is an illegal character in a variable name.

Posted: 10 Nov 2017, 12:11
Thanks didn't search where i needed .