Adding to a variable and then assigning that variable to another variable results in nothing

Solved!
scriptState := true

clearYCounter := 0

calculateY := 0

f3::
  {
    SetControlDelay, -1
    while (scriptState) {
      
      clearYCounter := %clearYCounter% + 1
      
      calculateY := %clearYCounter%
        
      Msgbox, Calculate %calculateY%
        
      Msgbox, Other %clearYCounter%
      
    }
  }
return 

f4::
  {
    scriptState := !scriptState
  }
return

^f4:: ; That is ctrl F2
  {
    ExitApp
  }
return 

When I make it so that clearYCounter is just turned into itself (clearYCounter := %clearYCounter%), then the message box shows it as 0, however, when I add the + 1 to the variable equation, the message box for Calculate shows nothing (I assume nil or null?), yet the Other message box works, showing 0.

I can't comprehend why the code breaks when I am just adding 1 to a 0.

clearYCounter ++1 also does not work.

Posted Oct 11, 2019, 12:25 AM UTC

03
calculateY = %clearYCounter%
or
calculateY := clearYCounter

https://www.autohotkey.com/docs/Variables.htm#Intro

CopyOfVar = %Var% ; With the = operator, percent signs are required to retrieve a variable's contents.

CopyOfVar := Var ; Unlike its counterpart in the previous section, percent signs are not used with the := operator.

2
GroggyOtter•

Unlike its counterpart in the previous section, percent signs are not used with the := operator.

start := "Hello "
end := "World"
test := "start"
MsgBox, % %test% end
ExitApp
1
NymphantTreeOP•

Oh right.

Thanks for increasing my IQ by 1.

0