AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

While/Keystate statement........Need Help

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
jl34567



Joined: 03 Jan 2010
Posts: 262

PostPosted: Sun Jan 10, 2010 5:15 am    Post subject: While/Keystate statement........Need Help Reply with quote

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
View user's profile Send private message AIM Address
Jex



Joined: 01 Aug 2008
Posts: 101

PostPosted: Sun Jan 10, 2010 5:31 am    Post subject: Reply with quote

check your variable names...
_________________
Woot.

Please read forum etiquette
Back to top
View user's profile Send private message
jl34567



Joined: 03 Jan 2010
Posts: 262

PostPosted: Sun Jan 10, 2010 5:51 am    Post subject: Reply with quote

I changed it at least 5 times.....I know at least once it was right! I'll try and report back.
Back to top
View user's profile Send private message AIM Address
None



Joined: 28 Nov 2009
Posts: 3086

PostPosted: Sun Jan 10, 2010 6:05 am    Post subject: Reply with quote

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
View user's profile Send private message
Jex



Joined: 01 Aug 2008
Posts: 101

PostPosted: Sun Jan 10, 2010 7:55 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group