Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Variables and keys for a pointer

Author
Message
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 9th Mar 2009 11:53
hi all im currently using the \"]\" key to make a variable go up starting at 0 then going 3,4,5,6 and those numbers are used to make an object point at another object but the problem is my code doesnt work and when pressing the keys it was checking if it was pressed very fast so i put in a wait command which actually freezes my program.

Anyway heres the code that i have if anyone can help me fix it, it would be greatly appreciated..

Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 9th Mar 2009 13:02
Replace your "wait 200" command with


The program will then just sit there until you release the key. In most cases, a simple press of the key shouldn't cause any noticable delay.
Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 9th Mar 2009 17:25
Try this:



it should remove any delay. (Unless I made a typo)


Whatever...
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 10th Mar 2009 00:56
will it select the next object though. when i used it befor it started at 0 i pressed "]" and it went to 3 then 4 and stopped i want it to be able to keep going until it hits 6 then it goes back to 3...
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th Mar 2009 04:12 Edited at: 10th Mar 2009 04:26
not 100% sure this is what you want, and i basically swapped ID 0 for ID 100 for simplicity's sake in the example, but is this close?



avoid wait when you can and use a timer instead. the example here is a 1/2-second step time (500ms). adjust the line:

if lastselect + 500 < timer()

however you want to increase/decrease time between steps in the cycle.

hope this helps

Virtual Nomad @ California, USA
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit
Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 10th Mar 2009 08:26
Ok then, try this:



I am thinking that the problem you have is stepping through a sequence of numbers(0,3,4,5,6,0,3...etc). Other people think that you have a timer problem.

If this code does not work for you then please give more information.


Whatever...
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th Mar 2009 09:27
i took it as he wants to start with 0 then cycle 3-6 over and over. <shrugs> i guess we'll find out soon enough.

Virtual Nomad @ California, USA
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 10th Mar 2009 11:07
thanks all to posted i ended up using a slightly modified version of dabblers last posted code and it works perfectly, now to do it in reverse...

thanks heaps

Login to post a reply

Server time is: 2024-09-28 02:27:26
Your offset time is: 2024-09-28 02:27:26