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 / Error in Read and Data???

Author
Message
Angeleyes
22
Years of Service
User Offline
Joined: 17th Mar 2003
Location:
Posted: 10th May 2003 23:44
Hi again ^_^

Just a question I am looking in to.

I have been getting this error:

"Compiler error. Too many data items at line...."

Is this a bug in DBC or somekind of limit to do with Read/Data commands in a program?

I know by counting them that the data is just the same as in all the other lines so its not any "human" error.

Ideas please!
Thanks.

Ta ta for now
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 11th May 2003 00:29
Try cutting down the amount of items in each data statements. Try to divide it over a number of statements.

i.e, instead of data 1,2,3,4,5,6,7,8,9,10,etc

data 1,2,3,4,5
data 6,7,8,9,10

Whatever I did I didn't do it!
Angeleyes
22
Years of Service
User Offline
Joined: 17th Mar 2003
Location:
Posted: 11th May 2003 17:05 Edited at: 11th May 2003 17:06
Thanks Kentaree for that, but it did not work.

The data on the line is only this:
Data 0.0, 0.0, 0.0, 200.0, 200.0, 200.0, 200.0, 200.0
That’s all, nothing else.

Its just a simple read/data loop.

It worked ok until I added some more data lines to the program and then it gave me the error.

Can anyone tell me if there is a limit to DBC and how many data statements it can hold?
I would be surprised if there was, but I cannot think of anything that would cause it to happen.
The data line shown above is just like all the others so I am stuck trying to think of what it could be.

I am just learning DB and while I don’t like asking, I really have no other choice.

So, any other suggestions?

Ta ta for now
Mary

MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 11th May 2003 17:16
Remove each of the data items (aside from the first one) and compile. If that works add a new one and recompile. Do this for each of the numbers, and then you can see which section is wrong.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Angeleyes
22
Years of Service
User Offline
Joined: 17th Mar 2003
Location:
Posted: 11th May 2003 17:43
Thank you TAToad.. ^_^

I did as you said but it made no difference.

I even deleted the line and all it did was to give me the error on the next line!

So it does look like there is some kind of limit to data within DBC.

Can you tell me if there is a “Clear” command or similar in DBC? I remember that in some basic languages you had to “clear” enough room for data statements. I know there is a DIM command but that should not be needed unless you are using arrays, and the program is not using them.

So... Perhaps Rich or someone like Lee could explain to me what is happening and why...And how to cure it!

Ta at for now
Mary

AsriCE
22
Years of Service
User Offline
Joined: 10th Jan 2003
Location: Brunei
Posted: 11th May 2003 17:52
Try to "Restore" the label of the data or try posting your code and maybe some of us can help you out.

Asri CE Crew

Anak Brunei!
Angeleyes
22
Years of Service
User Offline
Joined: 17th Mar 2003
Location:
Posted: 11th May 2003 18:16 Edited at: 11th May 2003 18:19
Sure thing...........

I cut out all the other bits of the program and have only the main bits left, so here is the code.

If you run it you will see it does not work because of the error.

So, what do you think?

Ta ta for now
Mary
PS: You can change the "gosub mattex" to "gosub matread" if you want...It still gives the error!

sicjoshsic
22
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 11th May 2003 21:39
without looking at the code or anything, to use decimals don't you have to define the data type (i think it is float, but don't quote me on that, im not too fresh on my data types)

MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 11th May 2003 22:06
Perhaps there is a limit for DB 'Classic' - it works okay with DBPro...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 11th May 2003 23:00 Edited at: 11th May 2003 23:03
Try and use an array instead of a huge amount of data statements. You could actually make a file that sets up enough assignments statements and set them to zero so it wont take you ages of typing:

open to write 1,"arraydata.dba"
write string 1,"dim matrixData(46,46)"
for x=0 to 45
for z=0 to 45
write string 1,"matrixData("+str$(x)+","+str$(z)+")"+"=0"
next z
next x

Edit: This should save a whole lot of array assignment statements to a file called arraydata.dba, which you can then edit to your liking, and cut and paste into your current program. Then you can read data from it in much the same way:

for x=0 to 45
for z=0 to 45
//assign matrix height data
next z
next x

Whatever I did I didn't do it!
Angeleyes
22
Years of Service
User Offline
Joined: 17th Mar 2003
Location:
Posted: 11th May 2003 23:08
Kentaree... I understand what your saying, and I may do that.
I do have another option left and that is to shorten the data statements by cutting out the "0" and putting in a "9" and then setting the read data section to just skip 15 "0" data statements if it comes to a 9.

This way would cut down 400 data statements to just about 15!

But, the point is I still need to know if there is a limit in DBC over data statements as the program I am using produces the data statements for me and to have to use another way (IE: Your array way) would be a major headache!

But thanks for all the help everyone. ^_^

RICH (Or Lee or anyone else who wrote DB) can you please tell me why it will not work? Is it a limit in DBC or not?

Ta ta for now
Mary

Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 11th May 2003 23:54 Edited at: 11th May 2003 23:56
whoa! ... data is ok for small amounts of built in data, but with that amount you ought to look at storing all the values in files and reading them back into your code off of the hard drive, plus that enables you write an editor to enter the data and provide error checking to save you having to search for misplaced or missing decimal points or commas, I think you might find that DB was never intended to use data statements so enthusiasticly, if you want to find if there is a limit then cut and paste lines of data and see what happens, I still have classic but it isn`t installed at the moment, to read in data from a file you just do..

open to read 1,"mydatafile"

then

read float 1,variablename

to read into a normal variable or

read float 1,variablename(i)

inside a loop to read into an array, use the open to write and write long instructions to write the file in the first place, you should find that much more flexible than your current method, all you need to do is alter your data statement generator to write to a file directly instead of make all those data statements and write them to a file, you would actualy be simplifying the code, cheers.

Mentor.

Login to post a reply

Server time is: 2025-05-17 03:47:53
Your offset time is: 2025-05-17 03:47:53