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
Big Arth
23
Years of Service
User Offline
Joined: 28th Jan 2003
Location:
Posted: 15th Aug 2003 09:27
how in the world can i use an array inside of a type? it's not something i can work around, so what the hell do i do?
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 15th Aug 2003 11:21 Edited at: 15th Aug 2003 11:22
You could use a linked-list system, or use memory, with the starting address held in a variable in the type


Logo design by Indi
Its better than a poke in the eye...
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Aug 2003 14:53
If you tell us what you are trying to do, we may be able to tell you how to work around it
adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 15th Aug 2003 15:43
I think it's what I was after, in a similar post.

type myType
stuff$ as string
arr(10) as integer
endtype

The compiler complains, returning the rather concise error of "Arrays not allowed in types", or something similar.

I opened the case to my PC today and thought, my exhaust fan sucks.
Beta1
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location:
Posted: 15th Aug 2003 16:17
No but you can do:

type myType
stuff$ as string
arr as integer
endtype

DIM something(10) AS myType

If that helps

Big Arth
23
Years of Service
User Offline
Joined: 28th Jan 2003
Location:
Posted: 15th Aug 2003 17:33
@MrTAToad

do you have an example i could look at which uses your method?

MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 15th Aug 2003 17:37
Ummm, not at the moment - I just thought about it at the time.
I might be able to do something this evening, unless IanM gets it done first.


Logo design by Indi
Its better than a poke in the eye...
Attreid
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 15th Aug 2003 17:53
here's something very very easy

"He will come...the voice from the outer world,
bringing the holy war, the Jihad, which will cleanse the Universe and bring us out of darkness."
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 15th Aug 2003 18:28 Edited at: 15th Aug 2003 18:29
I was think more along the lines of :



This wont actually work as it uses one of my plug-ins and I've got the command and/or parameters wrong. However, it shows how to effectively create arrays within types, in this case 16 lots of 256 bytes (in this example 16 strings each up to a maximum of 255 characters).

I'll work out something that works when I get home...


Logo design by Indi
Its better than a poke in the eye...
Dreamora
23
Years of Service
User Offline
Joined: 20th Sep 2002
Location: Switzerland
Posted: 16th Aug 2003 08:14 Edited at: 16th Aug 2003 08:18
beta1 you have exactly not understood what he wants to do ...


MrTAToad: Linked List would be nice but since they forgot to implement real pointers, the compiler will bring some failures if you have something like

Type LinListType
Var as Integer
next as LinListType
EndType

Type MyType
bla$ as String
subentries as LinListType
EndType


because you can't type reference the LinListType so he gets this nearly forgot QBasic Circle problems *quite bad since for usefull pathfinding and things like that you need structures like binary trees and heaps / fibonacci-heaps which can't be done*

I still hope they implement real pointers so I won't have to go over PB anymore for things that are normal and standard in up-to-date programming language and that are elementary in a game programming language ...

MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 16th Aug 2003 10:37
For LinkList, I use allocated memory & my LinkList plug-in...
Its slightly more complicated but you can do things like that.


Logo design by Indi
Its better than a poke in the eye...
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Aug 2003 17:31
@dreamflower
All of those kind of structures can be done now ... without pointers. My own pathfinding code uses a binary heap for example (binary heaps were invented for basic).

All of the rest of these structures can easily be duplicated with arrays, using the array index number instead of a pointer. You may also need to provide an array manager to replace the standard use of the memory manager though, but that's easy enough to do.

Login to post a reply

Server time is: 2026-07-22 14:00:01
Your offset time is: 2026-07-22 14:00:01