
-----------------------------------
winterfish
Tue Jan 13, 2009 7:19 pm

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:


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


-----------------------------------
TheGuardian001
Tue Jan 13, 2009 8:19 pm

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
Tue Jan 13, 2009 9:39 pm

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.


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
Wed Jan 14, 2009 8:39 am

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
Wed Jan 14, 2009 8:46 am

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.
