DarkBASIC / Mouse Click "Buffer" Clear Help needed |
| Author | Message | ||
|
DemonHill
User Joined: Thu Mar 20th 2008 Location: Cyberspace |
I have a simple menu selection with a next event key However as I click my button it seems to fill up a buffer and even if I release quickly the next events are triggered. The waitbtn method I found in thsi forum doesn't seem to help. Session numbers are incremented on completion of the session with in the qualifying gosub statements... Any one can help me ? + Code Snippet |
||
| Back to top |
|||
|
DemonHill
User Joined: Thu Mar 20th 2008 Location: Cyberspace |
|
||
| Back to top |
|||
|
Latch
User Joined: Sun Jul 23rd 2006 Location: Cyberspace |
|
||
| Back to top |
|||
|
TheComet
User ![]() Joined: Thu Oct 18th 2007 Location: Conker rulz! |
Can you explain & to me again? If I take 80&55, then it AND's the bits together, right? 0101'0000 0011'0111 -------------- 0001'0000 So the result would be 16? Why use it with your code? Thanks, TheComet ![]() Make the paths of your enemies easier with WaypointPro! |
||
| Back to top |
|||
|
OBese87
User Joined: Fri Jun 30th 2006 Location: On Toast |
@Comet since left mouse click is 1 Latch's code will only return 1 if the left mouse button is clicked. The other buttons are ignored. You could change the 1 to 2 and then it would control the right button. "With game, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright |
||
| Back to top |
|||
|
TheComet
User ![]() Joined: Thu Oct 18th 2007 Location: Conker rulz! |
So, is + Code Snippet faster than + Code Snippet ? TheComet ![]() Make the paths of your enemies easier with WaypointPro! |
||
| Back to top |
|||
|
Google Ad
AdBot Joined: Aug 26th 2002 Location: Everywhere |
|||
| Back to top |
|||
|
Caleb1994
User Joined: Fri Oct 10th 2008 Location: The Internet you idiot! |
Quote: "0101'0000
0011'0111 -------------- 0001'0000 " With this is mind. Mouseclick() can either be 0 or 1. in other words: 00000000 or 10000000 and 1 is: 10000000 it all depends on which is faster & or =. and since with = db has to figure out if it's a boolean test or a assignment operator & should be faster. so here is what db does with = first it figures out what is (bool test or assignment) next it tests for your condition. and with & gets the & and value checks if it's greater then 0 just from that it should be faster to use the & New Site! Check it out \/ |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
|
||
| Back to top |
|||
|
Caleb1994
User Joined: Fri Oct 10th 2008 Location: The Internet you idiot! |
Quote: "Actually, 10000000 in binary is 128 - not 1!
" really? how so? i thought it went like this: 1 = 10000000 2 = 01000000 3 = 11000000 4 = 00100000 5 = 10100000 6 = 01100000 7 = 11100000 8 = 00010000 and so on? am i wrong? Wait! I just realized I have it backwords 1 = 00000001 2 = 00000010 3 = 00000011 4 = 00000100 5 = 00000101 6 = 00000110 7 = 00000111 8 = 00001000 hahaha ok got it New Site! Check it out \/ |
||
| Back to top |
|||
|
TheComet
User ![]() Joined: Thu Oct 18th 2007 Location: Conker rulz! |
In binary, you read from right to left. 0 = 0000'0000 1 = 0000'0001 2 = 0000'0010 3 = 0000'0011 4 = 0000'0100 5 = 0000'0101 6 = 0000'0110 7 = 0000'0111 8 = 0000'1000 TheComet ![]() Make the paths of your enemies easier with WaypointPro! |
||
| Back to top |
|||
|
Caleb1994
User Joined: Fri Oct 10th 2008 Location: The Internet you idiot! |
I just edited that but i just hadn't refreshed in 20 minutes sorry didn't see your post comet New Site! Check it out \/ |
||
| Back to top |
|||
|
Latch
User Joined: Sun Jul 23rd 2006 Location: Cyberspace |
@TheComet Quote: "So, is
if mouseclick()&1 faster than if mouseclick() ?" They are different. If mouseclick()&1 is only testing for a click value of 1 (left click). If mousclick() is testing for any mouse click value. In terms of speed, because you aren't doing the additional & operation, If mouseclick() should be faster. Quote: "Why use it with your code?"
Like Obese87 was saying, you use & in this case to filter out only the results you want bit wise. I wasn't interested in any mouse value except 1. So instead ofif mouseclick()=1 then nmc=1 I can just nmc=mouseclick() & 1 to filter the values of mouseclick() to just 1. Enjoy your day. |
||
| Back to top |
|||
You must be logged-in to post messages to this forum. You can register an account for free. Or click here to login.
Forum Search
Enter a word or phrase to search our Forum for:
|
|






