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 / Help with a loop DBP

Author
Message
Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 24th Oct 2006 15:20
Hi all, I just got DBP so I am experimenting with objects, the problem is I can't get this do loop to compile



What am I doing wrong?

Regards
§çà®Fãçë™
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Oct 2006 15:35 Edited at: 24th Oct 2006 15:35
loop until spacekey()=1 ?

or just

loop with the condition inside

Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 24th Oct 2006 15:52
Ok I tried:



And:



And also:



None of the above compile, I assumed that the = 1 was'nt neccesary because the argument should return !true (or 1) if no return argument is specified?

Regards
§çà®Fãçë™
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Oct 2006 15:53 Edited at: 24th Oct 2006 15:56
'do ... loop until' is basically 'repeat ... until'
Also, you can't do 'else if' in DBPro. Use nested 'if ... else ... endif' instead.



Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 24th Oct 2006 15:55
Quote: "'do ... loop until' is basically 'repeat ... until'"


Is'nt that what I was doing? do this until space is pressed?

Regards
§çà®Fãçë™
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Oct 2006 15:56
Argh, you're too quick. Take a look at my post again.

Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 24th Oct 2006 15:57
Quote: "'do ... loop until' is basically 'repeat ... until'
Also, you can't do 'else if' in DBPro. Use nested 'if ... else ... endif' instead."


Gotcha, thanks ,)

Regards
§çà®Fãçë™
Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 24th Oct 2006 15:59
Ok I see now you have to end each if argument, thanks for the help mate.

Regards
§çà®Fãçë™
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th Oct 2006 00:21
I perfer this way... you don't have to make it complicated with 100 "elses".

jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 25th Oct 2006 03:19 Edited at: 25th Oct 2006 03:41
I just use an array of scancodes and a list of constants, and then I am free to use whatever logic is appropriate...select/case works well. The constants also work well in NPC AI. The array is nice to have because you can serialize it easily and it is global by default.

Scarface
17
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 25th Oct 2006 13:51
Thanks for the help and advice guys, one problem though, the box is too large, it takes up most of the screen, even when I change the size specifications, so when I press left, it dissapears completely, what am I doing wrong?

Regards
§çà®Fãçë™
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Oct 2006 15:29
@Grog,

In this particular case, I'd agree, but your code is not functionally equivalent to the original code or mine.

@Scarface,

Try moving things in smaller steps. What's happening is that your loop is so fast that the box moves off-screen within only a few frames.

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th Oct 2006 01:31
Quote: "In this particular case, I'd agree, but your code is not functionally equivalent to the original code or mine."


That's what I love about programming... there are many, many, many ways to show the same results.

Login to post a reply

Server time is: 2024-09-25 11:30:16
Your offset time is: 2024-09-25 11:30:16