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.

DarkBASIC Professional Discussion / Help i dont know wats wrong 8-O

Author
Message
Lowky12
15
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: On The Moon
Posted: 22nd Jan 2011 14:00 Edited at: 22nd Jan 2011 21:32
Help i don't know wats wrong whit this code




IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Jan 2011 21:35
None of your IF statements are closed with ENDIF. As it's not obvious where any of them can go, I'll leave it to you to fix.

IF without ELSE


IF with ELSE


=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 22nd Jan 2011 21:47
The bit where it says



is prolly going to cause problems as well.

Blobby 101
20
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 22nd Jan 2011 22:15
Ian M is rightm that's a big error, but =PRoF=, that is a perfectly acceptable (and if anything, faster alternative to INC timer1 (Unless you were talking about the variable name timer1, but i don't think that would cause problems)

=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 22nd Jan 2011 22:31
@Blobby 101:
I was refering to the bit where with no exit condition, it would just inc timer1 indefinately and not execute any of the if commands anyway.

Blobby 101
20
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 22nd Jan 2011 22:56
Oh right, I see xD Missed the obvious a bit there didn't I? xD

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 23rd Jan 2011 18:07 Edited at: 23rd Jan 2011 18:11
Besides what IanM and Proof mentioned this part is silly to me:



There's no need to GOSUB to a line that's a couple of lines down with no code in between the GOSUB and the label (and no return).

Also at the end of the LOAD IMAGE commands the texture flag is either a 0 or a 1 not 1, 2, 3, 4. And there is no file extension in the filename. Darkbasic needs to know what the extension is before it knows how to load the image properly so add .png .jpg or .bmp (whichever the file is). Since you're a newbie I'm betting their .jpg. You really should use .png. Jpgs don't keep exactly the same colors you create them with and they don't allow you to use transparencies like .png.

What you have:


What it should be:


Lowky12
15
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: On The Moon
Posted: 24th Jan 2011 11:04 Edited at: 24th Jan 2011 15:24
Quote: "Besides what IanM and Proof mentioned this part is silly to me:






There's no need to GOSUB to a line that's a couple of lines down with no code in between the GOSUB and the label (and no return)."

its for later when I add more

and i still dosent work





Blobby 101
20
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 24th Jan 2011 17:45
endif is all one word

JosephB
19
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 24th Jan 2011 19:02
Lowky12,

There are several things wrong with your code. If you try to follow it one instruction at a time starting at the "do/loop" section, you will discover that you never exit the loop to perform any of the "if" statements. Also, you are missing a sync command to show the results. I recommend breaking it into separate "if" statements to better understand what each instruction is asking your computer to perform. Nothing will happen between timer1 =>600 and <=1000. Following is some suggested code (I "REMed" out your "paste" commands and added "text" commands to show what was happening with the timer1) to follow:

Lowky12
15
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: On The Moon
Posted: 7th Mar 2011 03:17
delayed thanks

sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 8th Mar 2011 01:36
You might try reading the help abit.




Life is not fair, so deal with it.
http://www.gusroundtable.com/

Login to post a reply

Server time is: 2026-07-14 22:23:21
Your offset time is: 2026-07-14 22:23:21