Game Programming and Development Tools

Help with types – rnagene

RNAGENE
Junior Member

Posts: 8
From: United States
Registered: 02-28-2007
I have BB2D which comes with nothing in the documentation in TCP UDP and a lack of a good example for types. I wanted to know how to delete an element from a type array. Here is the code:

[
Entries% = 10
Type array
Field name$, value#, age%
End Type

; Create type content
Dim this.array(Entries%)
For i% = 1 To Entries%
this(i) = New array
this(i)\name$ = "Andres #" + i%
this(i)\value# = Rnd(0, 1)
this(i)\age% = Rand(10, 20)
Next

; Access the type
For i% = 1 To Entries%
Print this(i)\name$ + " is " + this(i)\age% + " years young and his value is: " + this(i)\value#
Next
WaitKey
[/code]

Thanks in Advance

steve_ancell

Member

Posts: 37
From: Brighton, East Sussex, Southern England, United Kingdom.
Registered: 09-16-2006
delete this(i) should do it.

[edit] Actually I forget the above solution, I just tried it and it MAVs out. I will play around with it to find out another solution. [/edit]
------------------
It's nice to be important, but it's more important to be nice !

[This message has been edited by steve_ancell (edited February 28, 2007).]

RNAGENE
Junior Member

Posts: 8
From: United States
Registered: 02-28-2007
I'm using a simple input command such as:

num=input("Number to Delete: ")
if num>0 and <= entries then delete this(num)

and it gives me an error.

[This message has been edited by rnagene (edited February 28, 2007).]

steve_ancell

Member

Posts: 37
From: Brighton, East Sussex, Southern England, United Kingdom.
Registered: 09-16-2006
Yeah, I think you're right, it definaletly MAVs out, I see if I can find another solution.

------------------
It's nice to be important, but it's more important to be nice !

steve_ancell

Member

Posts: 37
From: Brighton, East Sussex, Southern England, United Kingdom.
Registered: 09-16-2006
I'm not actually sure but I think Blitz sees it as trying to actually delete the array, but not the Type instance.

------------------
It's nice to be important, but it's more important to be nice !

RNAGENE
Junior Member

Posts: 8
From: United States
Registered: 02-28-2007
Krylar would know.
I'll have to wait for his holiness to come down from the mountain for this.
Blitz3Dman would also know but since devcrunch closed I cannot find him.
steve_ancell

Member

Posts: 37
From: Brighton, East Sussex, Southern England, United Kingdom.
Registered: 09-16-2006
Have a dabble on this site www.socoder.co.nr . Some of the members there might be able to help.

------------------
It's nice to be important, but it's more important to be nice !

RNAGENE
Junior Member

Posts: 8
From: United States
Registered: 02-28-2007
This looks the same as this site.

Thanks for the link. I'll go register there.