Need help (could be ahk bug) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
THEjuozasXD

Need help (could be ahk bug)

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?
dmatch
Posts: 49
Joined: 02 Oct 2013, 09:56

Re: Need help (could be ahk bug)  Topic is solved

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.
THEjuozasXD

10 Nov 2017, 12:11

Thanks didn't search where i needed :D.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5, mikeyww, RussF and 403 guests