plunking data

Blitz3D Forums/Blitz3D Programming/plunking data

Rook Zimbabwe(Posted 2004) [#1]
OK I can make a databank of 10 by 10 and I can read the databank... how to I write to the databank??? poke???

Look I got a gameboard 10,10.

restore gameboard

.gameboard
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,1,2,0,0,0,0
Data 0,0,0,0,2,1,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0

I mean I can read it to set up the gameboard and the pieces (1=red 2=blue) but HOW can I update the array???


N(Posted 2004) [#2]
If I'm not mistaken, a 'databank', as you put it, is static information. Just a big listing of constants in a specified order, so to speak, if I'm right.


Rook Zimbabwe(Posted 2004) [#3]
Thats exactly what I was asking... I wish there was some way to write data to a location in the databank... I mean you can read x,y,z but only poke A...

Maybe its a feature request?

OR maybe I just need to figure out how to take the static array and read it in to a dim...

I may have been thinking about htis backwards!
;]

rook


N(Posted 2004) [#4]
Where there's a will there's a way, so to speak ;)

Any anyway, it wouldn't be too hard if you know how many rows and columns a data statement has.


mrtricks(Posted 2004) [#5]
What you propose is achievable with only a little coding.

A databank is like a 1-dimensional array, just imagine:
DIM databank(1, n)

The n can be any number of bytes, but the 1 can only be 1. So if you want to read that out as if it were a 2 dimensional (or 3, or 4d) array, you just have to know how many elements to a row, how many rows etc. Then write a formula that converts that to the 1d array.

For example:
If you have an array(6,15)

The databank is 6x15 elements (let's assume each element is only one byte), so you create a bank with that many bytes.

When you want to read or write to x, y and you need to know which byte of the bank to affect:
byte = (y*6) + x

And if each element is more than one byte, just multiply by that amount.

You can go further and have arrays which have different amounts of elements on each row - you just have to store that information (maybe as the first element on each row).

Having said all this... is there a reason you want to use a bank instead of an array in this instance?


Rook Zimbabwe(Posted 2004) [#6]
I am having trouble setting the pieces on the gameboard... othello type game...


Kanati(Posted 2004) [#7]
byte = (y*6) + x


Ah, the good old "poke a character into the screen memory" formula for the vic20 and c64. Least that's probably the last time *I* ever used it. :)


Rook Zimbabwe(Posted 2004) [#8]
Atari 800 for me... seriously though... manipulating arrays seems a bit pokey look atthis code here:


while I can get it to wite the piece on the screen I cannot get it to read the array to put the initial pieces OR update the array... All I get is

ILLEGAL TYPE CONVERSION

I don't think this is a feature... I think this is something that may need to be addressed! Though I do realize I am possibly doing something wrong.

Possibly... maybe probably!

I wish I could see a lottle window where I could view th array in its whole!


mrtricks(Posted 2004) [#9]
Ah, the good old "poke a character into the screen memory" formula for the vic20 and c64. Least that's probably the last time *I* ever used it. :)

*You* can kiss my shiny metal ass. :)


WolRon(Posted 2004) [#10]
I wish I could see a lottle window where I could view th array in its whole!
If that's what you want then WRITE IT.

Rook, I regrettably haven't had much time to help you out lately but BRIEFLY overlooking what you are doing, it appears to me that you are making this way more complicated than what it is.

Othello is a 2D game, so why don't you start by writing a 2D game. Skip the 3D for the time being so that you don't have to worry about that for now. Get the GAME working first, then add 3D later. Trust me, it will be a lot easier to convert it to 3D later than it is from scratch.

You are trying to tackle more things at once than are necessary. Take it in steps.

And I HIGHLY doubt that you need to use banks for your Othello game. Arrays should be all that you need (and should make it simpler). I have yet to even use a bank myself.


Dreamora(Posted 2004) [#11]
little bug or uselessness:
Select entity 
					Case entity
					xx=EntityX(entity)
					zz=EntityZ(entity) 
					Default 
					pp=0
				End Select

where is the use of select entity case entity as it might never be something else than entity?


the illegal type conversion might come from the fact that you define the type after you have first declared a variable ( array ) of it's type.

btw:
you should avoid spaghetticoding (using goto)... now it is the best time to learn it :)
a simple if hat <> 0 would have done it