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 Discussion / Can't believe this

Author
Message
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 8th Dec 2008 13:03
I got a nestling error trying to get this done where am I going wrong?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 8th Dec 2008 14:40
Pay more attention to your indentation. It'll make things easier to find. Your _Input procedure looks like one of the culprits (I didn't go over all of the code in depth). If your intention was to have the Endif before the sync close the if block, you're still missing and Endif for the If cammode = 0 block:



Enjoy your day.
steve paul thomas
16
Years of Service
User Offline
Joined: 4th Nov 2008
Location: United Kingdom
Posted: 8th Dec 2008 14:53 Edited at: 10th Dec 2008 10:27
I've had a look at your code and it was hard to follow. So I did the following:

1) Spaced it out a bit
2) Added indentation for the IF statements.

This makes finding problems a lot easier. If you want any advice on indenting your code, then take a look at Obese87's :

Tutorial: How To Write Well Presented And Efficient Code (Second Edition)

Try the attached code. I couldn't test it as I don't have the .X files, but I think the code should run now.

You will have to make some modifications to the code to suit whatever it is you are doing, but I think it should run properly now.

I don't Adam and believe it!

Attachments

Login to view attachments
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 9th Dec 2008 12:11
Thanks guys thanks latch and steve paul thomas but I am still getting problems I get it to run but can get everything to separate so I can get the player to get in and out of the aircraft or the hovercraft, also when I do testbox.x just means for you to made or get a box model and use them for the player, aircraft and hovercraft models, also had to change the player object from player to object1 as it won't read the player label
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 9th Dec 2008 19:53


Did you intend to rem out the subroutine label? That is definitely a problem since you didn't rem out the return at the bottom.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
steve paul thomas
16
Years of Service
User Offline
Joined: 4th Nov 2008
Location: United Kingdom
Posted: 10th Dec 2008 02:03
@vampyre

You don't have to take this advice, but personally if I was faced with code that was faulty and I couldn't track down the problem(s)..I would do this...

1) I would start a new source file, call it something like test2.dba or something.

2) Copy over the code that you know works properly (if you can be sure it does)

3) Re-write the code that obviously isn't working as you intended.

This might seem obvious, and my intention is certainly not to patronise, but if you don't already - try this method:

Write some code, test run it, go back to the code, make corrections, run it again, write some more code...

How much code you write before you test is down to your own discretion. As a general guide, go with each time you've added something significant, e.g. a new movement for your vehicle, or a special camera mode.

Since DB just needs to interpret your code, this process shouldn't be tedious. I've found although it might slow the development a bit, it helps ensure you nip the problems in the bud, before your code becomes too complicated to track down the misbehaving code.

Also! Stick with using indentation. I used to be lazy with mine and didn't bother to indent properly, but like Latch said - its invaluable for spotting silly mistakes (like not closing if statements or not closing a loop, etc).

I don't Adam and believe it!
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 10th Dec 2008 05:51
OK steve paul thomas thanks for the advice and BN2 Productions

Login to post a reply

Server time is: 2025-06-07 20:55:24
Your offset time is: 2025-06-07 20:55:24