[SOLVED] MsgBox not outputting anything Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
vladnex8
Posts: 2
Joined: 19 Aug 2019, 19:30

[SOLVED] MsgBox not outputting anything

19 Aug 2019, 19:40

So I need help because this code doesn't seem to work. I'm trying to compare if a number is odd or even. If it's an odd number I will add a number to it but if its even I will subtract another number. For some reason, when I try to MsgBox the result it doesn't seem to be outputting anything at all. I'm a little new to AHK so sorry if the code is not that good or if this was answered before, I didn't really know what to search.

Code: Select all

Random, vRandom, 1,9
1NUM := vRandom
Random, vRandom, 1,9
2NUM := vRandom

if (1NUM & 1)
{
P1NUM := NUM1 + NUM2
msgbox, %P1NUM%
}
else
{
P1NUM := NUM1 - NUM2
msgbox, %P1NUM%
}
Last edited by vladnex8 on 20 Aug 2019, 01:15, edited 1 time in total.
hunter99
Posts: 129
Joined: 20 Jan 2014, 17:57

Re: MsgBox not outputting anything  Topic is solved

19 Aug 2019, 20:00

HI, A little typo; your var. labels don't match. Try this, added a little id text in msgbox.

Code: Select all

Random, vRandom, 1,9
1NUM := vRandom
Random, vRandom, 1,9
2NUM := vRandom

if (1NUM & 1)
{
P1NUM := 1NUM + 2NUM
msgbox, +Box P1NUM=%P1NUM%
}
else
{
P1NUM := 1NUM - 2NUM
msgbox, -Box P1NUM=%P1NUM%
}
hunter99
vladnex8
Posts: 2
Joined: 19 Aug 2019, 19:30

Re: MsgBox not outputting anything

20 Aug 2019, 01:14

hunter99 wrote:
19 Aug 2019, 20:00
HI, A little typo; your var. labels don't match. Try this, added a little id text in msgbox.

Code: Select all

Random, vRandom, 1,9
1NUM := vRandom
Random, vRandom, 1,9
2NUM := vRandom

if (1NUM & 1)
{
P1NUM := 1NUM + 2NUM
msgbox, +Box P1NUM=%P1NUM%
}
else
{
P1NUM := 1NUM - 2NUM
msgbox, -Box P1NUM=%P1NUM%
}
hunter99
Thank you very much!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], FortniteSpanishGuy and 160 guests