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.

Author
Message
minkus
21
Years of Service
User Offline
Joined: 18th Jan 2003
Location: My House
Posted: 3rd Feb 2003 06:06
how does the code "data" and "read" work
i have db-not dbp
The World has no meaning - but gaming does!
PiratSS
21
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 3rd Feb 2003 06:28
ok, let's say you want to make a level.

but you don't want to use a level editor.

so, you would then have to make a field, and there would be different things on it.

so we make

data 0,0,0,0,0
data 0,0,0,0,0
data 0,0,0,0,0
data 0,0,0,0,0

that would give us 5x5 field with nothing on it.
then we decide to make borders for our level

data 1,1,1,1,1
data 1,0,0,0,1
data 1,0,0,0,1
data 1,0,0,0,1
data 1,1,1,1,1

the last thing is to read our level

for x=1 to 5

Specs: Dual Amd Athlon 2Ghz(1Ghz x 2), 40GB 15000 Rpm SCSI Hard Drive, 640 Mb 266Mhz DDR, 12x8x32 CDRW, ATI Rage Fury Pro 32Mb SD Video, 17' Monitor
PiratSS
21
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 3rd Feb 2003 06:29
sorry, I cut it out by mistake.

for x=1 to 5
for y=1 to 5
read a
if a=1 then...
next y
next x

and so on, with a you get different values from the field. hope it helps.

Specs: Dual Amd Athlon 2Ghz(1Ghz x 2), 40GB 15000 Rpm SCSI Hard Drive, 640 Mb 266Mhz DDR, 12x8x32 CDRW, ATI Rage Fury Pro 32Mb SD Video, 17' Monitor
kfoong
21
Years of Service
User Offline
Joined: 28th Jan 2003
Location: Australia
Posted: 4th Feb 2003 12:08
is there a limit you can input data?

--------
I HAVE NO IDEA HOW TO PROGRAM DARK BASIC!
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 4th Feb 2003 15:29
Yea- you cant put a certain amount of variables in one DATA statement, just make more then one and your all set.

RPGamer

Current - RPG: Eternal Destiny : Help Wanted!
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
kfoong
21
Years of Service
User Offline
Joined: 28th Jan 2003
Location: Australia
Posted: 4th Feb 2003 23:22
what does that mean?

--------
I HAVE NO IDEA HOW TO PROGRAM DARK BASIC!
Garfield1983
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location:
Posted: 5th Feb 2003 01:16
I think I understand what you mean, but could you post some example code as I'm not sure how the 'If a=1 Then..' part works.

Do you place say a cube or other 3D object there if a=1 (as a wall), and simply a texture or something if a=0 (as the floor texture)?

Thanks=)
kfoong
21
Years of Service
User Offline
Joined: 28th Jan 2003
Location: Australia
Posted: 5th Feb 2003 08:10
i meant in what rpgamer said. So is there any limit to the data we can put into the DATA thing?

--------
I HAVE NO IDEA HOW TO PROGRAM DARK BASIC!
minkus
21
Years of Service
User Offline
Joined: 18th Jan 2003
Location: My House
Posted: 6th Feb 2003 18:08
I don't think so... i tried it out, but there is a limit to amt of characters on one line - at least in db.

The World has no meaning - but gaming does!
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 7th Feb 2003 04:04
Yea there is a limet. When you compile MAT_EDIT code you get an error of too much data in a data statement

RPGamer

Current - RPG: Eternal Destiny : Help Wanted!
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 7th Feb 2003 05:03
well the data can't go over 255 characters per line in db regular...
Shadow
21
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 8th Feb 2003 21:48
could you not just write more lines
i.e.
Data 1,2
does the same as
Data 1
Data 2
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 8th Feb 2003 22:30
well shadow, not really. That would change your level from

1,1,1,1
1,0,0,1
1,0,0,1
1,1,1,1

to

1,1
1,1
1,0
0,1
1,0
0,1
1,1
1,1

and thats the diference between a 4x4 level and a 2x8 level
kfoong
21
Years of Service
User Offline
Joined: 28th Jan 2003
Location: Australia
Posted: 8th Feb 2003 23:40
ive tested it out DBC has a limit of 32 inputs does anyone know the limit for DBP?

--------
I HAVE NO IDEA HOW TO PROGRAM DARK BASIC!
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 9th Feb 2003 00:54
QuothTheRaven, not quite (hey, that's good, wonder why Mr E.A. Poe didn't use that line?). When you use the READ command, you get the next data item in the list, it doesn't matter if they are on separate lines or what.

If you did this,
1,1,1,1
1,0,0,1
1,0,0,1
1,1,1,1

and read

for i=0 to 3
for j=0 to 3
read level(j,i)
next j
next i

you put the first statement 1 into level(0,0)
1 into level(1,0)
1 into level(2,0)
1 into level(3,0)
then next i, next line of the data statement.
1 into level(0,1)
0 into level(1,1)
0 into level(2,1)
...
etc.

However it works the same way using

1,1
1,1
1,0
0,1
1,0
0,1
1,1
1,1

for i=0 to 3
for j=0 to 3
read level(j,i)
next j
next i

you put the first statement 1 into level(0,0)
1 into level(1,0)
next line of the data statement, but not next i
1 into level(2,0)
1 into level(3,0)
then next i, next line of the data statement.
1 into level(0,1)
0 into level(1,1)
next line of the data statement
0 into level(2,1)
...
etc

It doesn't matter how you arrange the data statements, as long as you read them in the right order.

data 1,1,1,1
data 1
data 0,0,1,1,0,0,1
data 1,1,1
data 1

would probably work, but is slightly less helpful when looking at the code.

Once I was but the learner,
now, I am the Master.

Login to post a reply

Server time is: 2024-09-19 02:28:11
Your offset time is: 2024-09-19 02:28:11