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 / Reading sequential data - is it possible?

Author
Message
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 22nd Feb 2007 02:29 Edited at: 22nd Feb 2007 02:39
is there any way that you can make a line of code that will read different data strings but using only one or two lines of code? f. um... ok try and explain better... um.. ok say i have:-

Datasection1
data 1,2,3,4,5,6

datasection2
data 7,8,9,10,11,12

now i know you can use the line :- Read datasection1
to read teh data section but is there a way of like using that line to read different lines eg:- read datasection(x)
so rather than have to write the same line multiple times you can just use the one line for multiple data pools?

I hope that made sense...

and i'm using DBpro if that helps

Oops did i post in the wrong area? >.< i keep doing that... oh well

I can see from your smile, you're not here for the sunset.
Veron
17
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 22nd Feb 2007 02:37
Lol, this is the newcomers board dude!

Never mind, yeah, i'm fairly sure it's possible, check the manual index for "sequential" and see what it comes up with.
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 22nd Feb 2007 03:38
Quote: "Read datasection1"


That command would create a variable called datasection1 and read the next piece of data into it.

The command you are after is RESTORE

eg:



would result in name$ being "jenny"


The word "Gullible" cannot be found in any English Dictionary.
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 22nd Feb 2007 12:01 Edited at: 22nd Feb 2007 12:03
For some reason, my coding won't allow that to happen, unless i'm doing it wrong...


dunno whats going wrong but it just won't have it ; ;

and i know my coding is a mess but i'm just trying to get the parts to work first

I can see from your smile, you're not here for the sunset.
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 22nd Feb 2007 13:08
Quote: "i know my coding is a mess but i'm just trying to get the parts to work first"


The reason you should make your code readable is to help you when debugging.
Just indenting and commenting your code is a habit you just goota get into.

As far as your code is concerned, it looks ok. I notice you load several bitmaps, but there is no set current bitmap 0 command, so this may cause a problem. Put the command SET CURRENT BITMAP 0 just after the line 'Delete Bitmap 6'.
Also, after the line 'Rem Make Level 1' you should have the command RESTORE LevelData1.


The word "Gullible" cannot be found in any English Dictionary.
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 22nd Feb 2007 14:27 Edited at: 22nd Feb 2007 14:35
Thing is i want this bit of code:-


to be able to read all three of the different data sections rather than have to do the above section for each and every data block. I have tried the "Restore leveldatax" thing but in using the
Read leveldata$
when it comes to the : if leveldata$=1
it won't take it and i don't know how to get around it...

I can see from your smile, you're not here for the sunset.
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 22nd Feb 2007 14:56
do something like:




The word "Gullible" cannot be found in any English Dictionary.
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 22nd Feb 2007 15:02
Forgive my ignorance but i have no idea how the CASE commands work.

I can see from your smile, you're not here for the sunset.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 22nd Feb 2007 22:18
Just a few (hopefully helpful) tips:

Quote: "Read leveldata$
when it comes to the : if leveldata$=1
it won't take it and i don't know how to get around it..."


You should have:

if leveldata$="1"

because 1 is a number and your variable is a string.

Quote: "Forgive my ignorance but i have no idea how the CASE commands work."


Read the help files! It's pretty straight forward really.

Looking at your first code snippet, I suggest you copy all your media files into the same folder as your source to avoid all those lengthy paths.

color backdrop rgb(0,0,0)

You have a wasted calculation there. Use color backdrop 0 instead.

Put all of your media loding code into a procedure such as 'LoadMedia' and use Gosub LoadMedia. Repeat this with all the other tasks your program does. You won't believe how much easier programming becomes if you start doing this sooner rather than later!

The same goes for (as Flashing Blade says), indenting your code.

More info on layout: http://forum.thegamecreators.com/?m=forum_view&t=96075&b=7

TDK_Man

Login to post a reply

Server time is: 2024-09-25 17:29:40
Your offset time is: 2024-09-25 17:29:40