Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 mousewhere?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
winterfish




PostPosted: Tue Jan 13, 2009 7:19 pm   Post subject: mousewhere?

I'm having problems with using mousewhere. For a part of my program I am able to click on something, but when I get to the next part, I can't click a second time. I think it has something to do with clearing the data in mousewhere, because I've checked to see why it's not working and it shows that it already equals to 1.

Here's the code:

Quote:

loop
mousewhere (x, y, button)
exit when button = 1
end loop

if button = 1 and x > 25 and x < 175 and y > 205 and y < 355 then
Pic.Draw (sun, 25, 205, picCopy)
sunStore := sunStore + 1
if button1 = 1 and x > 25 and x < 175 and y > 25 and y < 175 then
sunStore := sunStore + 1
Pic.Draw (sun, 25, 25, picCopy)
delay (1000)
Pic.Draw (questionMark, 25, 25, picCopy)
else
end if

else
end if
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Tue Jan 13, 2009 8:19 pm   Post subject: Re: mousewhere?

it isn't working because you only call mousewhere for one click. mousewhere does not continue to look at where your mouse is if you don't call it. you need to have the mousewhere and the location checks in the same loop
winterfish




PostPosted: Tue Jan 13, 2009 9:39 pm   Post subject: Re: mousewhere?

I think I understand... So, I put everything in a loop and it doesn't still doesn't work. After the first click, when I click a second time nothing happens, but the program is still running. And when I pause the program it stops at the mousewhere (x, y, button) part. Here's what I did.

code:

loop

loop
mousewhere (x, y, button)
exit when button = 1
end loop

if button = 1 and x > 25 and x < 175 and y > 205 and y < 355 then
Pic.Draw (sun, 25, 205, picCopy)
sunStore := sunStore + 1
if button1 = 1 and x > 25 and x < 175 and y > 25 and y < 175 then
sunStore := sunStore + 1
Pic.Draw (sun, 25, 25, picCopy)
delay (1000)
Pic.Draw (questionMark, 25, 25, picCopy)
else
end if

else
end if

end loop
Parker




PostPosted: Wed Jan 14, 2009 8:39 am   Post subject: RE:mousewhere?

Im not sure what else you are trying to accomplish after that loop, but I am guessing this is some sort of menu. You have your current loop exit as soon as the mouse is clicked, therefore stopping you from clicking your mouse again. Without knowing what this part of the code this is I can't really provide many more suggestions.
TheGuardian001




PostPosted: Wed Jan 14, 2009 8:46 am   Post subject: Re: mousewhere?

just as a side note, the loop around mousewhere is effectively useless.
The major problem however, is that the mouse checking for the second button is inside of the first button, meaning that the user needs to get the mouse to the second button in a fraction of a second. fix your if structure.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: