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 / My code containing For-next with arrays gives error message.

Author
Message
Roses In Dreams
16
Years of Service
User Offline
Joined: 16th Jan 2008
Location: Somewhere outthere.
Posted: 3rd Feb 2008 05:08 Edited at: 3rd Feb 2008 06:11
I have read TDK's tutorials, read the helpfiles and done some minor searching. I have 20 days programming experience. And most of all, Im stuck and in need some assistance.(I hope this is enough to not get reprimanded again.)
I was practicing on printing array data using for-next when i get an error message that I don't totally understand.



this gives an error message:
NEXT only takes one parameter at line 12.

Line 12 is the:
for T=1 to 3

I wrote this next code but it only printed the first array data


For now, Im trying to find a suitable and comfortable programming style or pattern(not sure about the correct term i should be writing).
This for-next and while-endwhile using array data is quite important to me because I haven't figured an alternate code that does this job for me.

The codes above are mimic codes that give the same error.
The original code I was working on used sprites and png images. I just realized that the error was because of the for-next so i just made another code that gives the same error to shorten the code and make less hassle for people who would help me.
DB PROgrammer
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location: Nowhere But Everywhere
Posted: 3rd Feb 2008 07:36
There's nothing here? Not even a blank post


If it was illegal to be stupid we'd run out of room.
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 3rd Feb 2008 11:37
You need to put a value after next, in your case in should look like this



Surprisingly this can actually be any value (i think) such as 0 or 1 although i would recommend using T as it makes it easier to read.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 3rd Feb 2008 14:43
Quote: "NEXT only takes one parameter"


That's a big clue - as Xlaydos says, your Next line doesn't have any parameters!

A reminder from my tutorial number 2;

"This loop uses a variable to count from the first supplied number to the last - in this case from 1 to 20 using the counter variable N. You can use any variable name for the counter variable as long as the name used on the Next line and the For line are the same."

But, having said that, from the error you are getting (and assuming that the snippet you posted is the whole program), you need to upgrade your version of DBPro:

http://darkbasicpro.thegamecreators.com/?f=upgrades

TDK_Man

Roses In Dreams
16
Years of Service
User Offline
Joined: 16th Jan 2008
Location: Somewhere outthere.
Posted: 3rd Feb 2008 15:14
Thanks..I got it working now..
Programming demands too much perfection(for me)
I just missed 1 letter and then just got lost.

I already got it upgraded.(I double checked..yup..its version 6.6)

Im practicing on lecture 4 file access. I did combinations of stuff i learned previously and so far no problem. The first time i ever made my own file name "roses.dreams" and they were like DREAMS files. A new file format i made
i even made a "dreams.handsome"..HANDSOME file format..This is totally amusing me now

Ill make sure not to make the same mistake again. I'll try the "If upkey() and mouseclick()" tomorrow once I get home from school. Hopefully next week I can either get on practicing 3d or make my first "2d dumb" window or game.

thanks for the help..peace out...

before i forget..I was also praciting with the sprite commands.I haven't seen the command for changing sprite position.

move sprite 1, speed
How do i change the position?
(I wonder why i cant find a sample anywhere.Im sure there is.)
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 3rd Feb 2008 21:27
sprite sprID, xPos, yPos, imgID can be used to set the position of a sprite.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Feb 2008 04:17
Quote: "Hopefully next week I can either get on practicing 3d or make my first "2d dumb" window or game."


There's an 'Ultimate Pong' thread on the DB Classic board you might find interesting.

Everyone (including me) says you should start with Pong if you are new to programming so I've challenged everyone to come up with the ultimate 3D version. (My guess is that many of those who offer the advice have probably never written it either)!

So, the thread is for Pong written in either DBC or DBP.

TDK_Man

Login to post a reply

Server time is: 2024-09-27 10:31:42
Your offset time is: 2024-09-27 10:31:42