Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nedd some help with arrays and types..
#1
Okey, I'll try to explain this en english Smile

Here's an example:

TYPE Values
X AS SINGLE
END TYPE

DIM SHARED Player(2) AS Values

As it looks now i got Player(1).X, Player(2).X and so on..

But if i want something like this:

Player(1).Col(1), Player(2).Col(1)
Player(1).Col(2), Player(2).Col(2)

I want the variable col not to hold one value, but i want it ti be a array that can hold two values..
So not just Player(1).Col and Player(2).Col, i want Col to hold two values..

How do i declare something like that?

Thx alot!
ttp://hem.passagen.se/qb.basta
Reply
#2
I'm not sure , but try this :

TYPE Values
col(2) as single
END TYPE


But I repeat that I'm not sure ...
have the simplest tastes of the World : I satisfy myself with the best !

http://ToufQb.free.fr
Reply
#3
arg

Sorry ... i'm wrong
have the simplest tastes of the World : I satisfy myself with the best !

http://ToufQb.free.fr
Reply
#4
Sorry, it's not possible to take a type element and use it as an array in QB... it would be nice though.
size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Reply
#5
It is possible in PDS (QB 7.1) and VBDOS, but not in QB4.5 and below.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#6
you can still do it in qb. this is what you do:

1) make a type
2) make a large array of that type
3) make two more integer arrays of the same size for each unique object that you want to have that type for (item, object, unit..).

Ok, now each itme, object, unit, etc... is in an array, and has an index. You use that index to look up the number in the first array and the number in the second array.
The first number would give you the start position of the array in (2), and the second would give either the amount of things in (2) that tie up to your first object, or the end position.
So, you go from the start to end position, and that gives you a type array for any object. Easy, eh? :lol:
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)