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 / Would someone please Proof this

Author
Message
alynneswoff
12
Years of Service
User Offline
Joined: 24th Sep 2013
Location:
Posted: 7th Oct 2013 19:39
I have reasd over and over and over and cant find the reson why the loop at the bottom is out of place and besides that the collsion boxes dont work. we were given a little bit of code and told to elaborate.
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 7th Oct 2013 22:06
What is this if I may ask?
There are a bunch of for loops around the section tagged "CONTROL INPUT" that are invalid (even the compiler picks up on this). The syntax for a for loop is:
FOR variable = <startValue> TO <stopValue> [STEP <stepValue>]

The variable must be just that, a single variable. The parts withing <> brackets are expressions, that is anything from a numeric constant to a variable to an expression like a + 12.5 / (4 * int(myVar# * 0.2)).
The part within square brackets is optional; if omitted the default step value is +1, which means that for each loop cycle the variable is increased by one. For that reason it should also be clear to see that it must be a variable - the value of a constant or an expression cannot be changed in any sensible way


There may be other errors as well, I don't have time to check that right now but I can return to look at it later if no-one else beats me to it.


"Why do programmers get Halloween and Christmas mixed up?"
Battoad
AGK Developer
19
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 7th Oct 2013 22:11 Edited at: 7th Oct 2013 22:18
You get a loop error because of an uncompleted If ....Endif just after REM CONTROL INPUT

There is not an Endif after next t



Your next piece of similar code also ends with "end" instead of endif.



Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Oct 2013 05:14 Edited at: 8th Oct 2013 05:19
Indent your code properly and you should find nesting errors very easily.

What is this suppose to do? Is the code missing something?


And what is this?


That's an invalid statement and you've done it multiple times. Oh I just noticed Rudolpho pointed this one out.



This code will now compile, assuming the corrections I made are what you originally intended. I had to change your variable Step s Hit to StepHit because the forum was flagging it as a bad word.


Login to post a reply

Server time is: 2026-07-07 11:20:59
Your offset time is: 2026-07-07 11:20:59