| View previous topic :: View next topic |
| Author |
Message |
jl34567
Joined: 03 Jan 2010 Posts: 262
|
Posted: Sun Jan 10, 2010 5:15 am Post subject: While/Keystate statement........Need Help |
|
|
| Code: | while statetrb=U
{
MsgBox, %staterb%
GetKeyState, staterb, Rbutton
sleep,100
MsgBox, In the while
MsgBox, %staterb%
} |
My Message Boxes are returning U and D as is expected, but the D doesn't break me out of the loop. |
|
| Back to top |
|
 |
Jex
Joined: 01 Aug 2008 Posts: 101
|
|
| Back to top |
|
 |
jl34567
Joined: 03 Jan 2010 Posts: 262
|
Posted: Sun Jan 10, 2010 5:51 am Post subject: |
|
|
| I changed it at least 5 times.....I know at least once it was right! I'll try and report back. |
|
| Back to top |
|
 |
None
Joined: 28 Nov 2009 Posts: 3086
|
Posted: Sun Jan 10, 2010 6:05 am Post subject: |
|
|
| Code: | staterb=1 ;preset value
#Persistent ; to keep it around so I could Check it's values
while staterb ; 1 is true 0 is false
{
MsgBox, %staterb%
staterb:=!GetKeyState("Rbutton") ;changed type outputs 1 or 0 the ! inverts the value
sleep,100
MsgBox, In the while
MsgBox, %staterb%
} |
I'm more comfortable with this type of GetKeyState |
|
| Back to top |
|
 |
Jex
Joined: 01 Aug 2008 Posts: 101
|
Posted: Sun Jan 10, 2010 7:55 am Post subject: |
|
|
i havn't used the while loop yet, but if we look at your code there was one thing that i noticed.
| Code: | while statetrb=U ;here, you use 'statetrb' and not staterb
{
MsgBox, %staterb%
GetKeyState, staterb, Rbutton
sleep,100
MsgBox, In the while
MsgBox, %staterb%
} |
changing statetrb to staterb, i think, will fix it. _________________ Woot.
Please read forum etiquette |
|
| Back to top |
|
 |
|