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 / Delay in DBPro?

Author
Message
Person99
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Good question
Posted: 1st May 2007 08:20
Alrighty, I want to figure out how to get delay in Dbpro.

For instance, lets take a simple rotating cube script controlled with the control key.

make object box 1, 5, 5, 5

do

if controlkey()=1 then turn object left 1, 0, 0, 5
if controlkey()=0 then turn object right 1, 0, 0, 5


I was hoping that DBPro could do something like:
(NOTICE: The following is not a real command, and I know it isn't, I am using it as an example of what I had hoped DBPro would have:

make object box 1, 5, 5, 5

do

if controlkey()=1 then turn object left 1, 0, 0, 5
if controlkey()=0 then delay(2000) [turn object right 1, 0, 0, 5]

The Person99 awards go to: 1. Jack the Ripper for hardest crime scenes. 2. Peter Petrelli for most powers. 3. Superman for longest flight. 4. "The Doctor" for best time travel machine.
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 1st May 2007 11:21
if controlkey()=0 then wait 2000 : turn object right 1, 0, 0, 5

should work but this will stop everyhing else also

if you want a delay on that specific action while everything else is still running use the timer:


if controlkey()=0 then startdelay=timer():delayflag=1

if delayflag=1 and timer()=startdelay+2000 then turn object right 1,0,0,5:delayflag=0
Person99
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Good question
Posted: 2nd May 2007 07:36
Ah, that is not nearly as complicated as I thought it would be. (Then again, this is Darkbasic professional )

Thanks!

The Person99 awards go to: 1. Jack the Ripper for hardest crime scenes. 2. Peter Petrelli for most powers. 3. Superman for longest flight. 4. "The Doctor" for best time travel machine.

Login to post a reply

Server time is: 2024-09-25 21:24:59
Your offset time is: 2024-09-25 21:24:59