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 / memblocks, arrays, and saving information

Author
Message
Sleet
21
Years of Service
User Offline
Joined: 3rd Aug 2003
Location:
Posted: 11th Nov 2003 12:35
At least to someone as new as I am it seems that arrays and memblocks are basicaly the same things other than that you can't use a program to fill an array.

eg. If I want to make a matrix and store the heights of all the points on the matrix you can't do that with an array right?

Anyways, that is basicaly what I am trying to do. Store the height of every single point on a matrix using a memblock. I'm running into some problems but that's probably just because I'm dumb.

My real problem is: If I create a random terrain that I like and turn all the heights of every point into data in a memblock how do I save it to my hard drive so I can use the same map every time I run the program?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 11th Nov 2003 16:31
You can use a 2D array:

Dim Terrain(10,10)

That would give you a 10 x 10 array, which you can load and save:

SAVE ARRAY
LOAD ARRAY

Remember, you'll need to have (matrix cells x + 1), (matrix cells z + 1) elements in your array, as each cell has 4 nodes.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
Sleet
21
Years of Service
User Offline
Joined: 3rd Aug 2003
Location:
Posted: 12th Nov 2003 01:29
I'll dink around with it but I need for you to pretend that I'm an idiot (even though that's really close to the truth). What is a node? and what is a (matrix cells z/x + 1) element?

I also haven't found out yet how to put "new" information into an array. As far as I can tell all the information that can go into an array is information in a data line and data lines don't like variables.
Sleet
21
Years of Service
User Offline
Joined: 3rd Aug 2003
Location:
Posted: 12th Nov 2003 11:35
anyone know anything about this stuff? I've tried everything I can think of with arrays and no matter what I try my terrain that I try loading using the array numbers always is perfectly flat (no the original was not flat) I should probably add a snippet and will if anyone wants it, but what I could use is some advice that I can understand. I don't know anything about this stuff.
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 12th Nov 2003 14:15
I have attached some code that does what you want (click the source button under this post).

p166mmx @ 233 : 256mb : sb 128pci : sis onboard
Sleet
21
Years of Service
User Offline
Joined: 3rd Aug 2003
Location:
Posted: 13th Nov 2003 00:05
Thank you very very much. But there is one thing I am still puzzled about. Why is it that I can't understand half of your code and neither can my computer? (is it possible that I have a hecka old version of DB?) Like the parts with the < >. I've never seen those before. And why do you use phrases like "local z as intiger"? For one my DB program won't recognize them and secondly all variables in a function are already local.

Anyways, I was able to understand your code enough to get it to work and I finaly got done what I've been trying to do for the last couple days. I wasn't saving and loading the arrays right but the smallest most annoying thing I was missing was "update matrix 1"

Thanks again
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Nov 2003 14:54
It's because you're using DBC and the_winch is using DBPro The ideas are the same either way though.

Login to post a reply

Server time is: 2024-09-21 09:26:37
Your offset time is: 2024-09-21 09:26:37