it turned blue! (the word object that is...)

Blitz3D Forums/Blitz3D Programming/it turned blue! (the word object that is...)

Rook Zimbabwe(Posted 2005) [#1]
I am happily typing and trying the new methods suggested to me to return a handle from a type without having to run throught the entire list of types... no luck yet but I have just had an idea that would work...

ANYway...

I used the word "OBJECT" in my code and it turned BLUE like it was Blitz3D code word.

I use the standard Blitz 3D IDE. I go to the command reference. OBJECT is not listed in the 2D set or the 3D set... What gives?

RZ


Rob Farley(Posted 2005) [#2]
http://www.google.co.uk/search?hl=en&q=object+handle+site%3Ahttp%3A%2F%2Fwww.blitzbasic.com&btnG=Google+Search&meta=


Picklesworth(Posted 2005) [#3]
Object is a keyword used to retrieve a particular type instance using its Handle.

Very quick example:

b\Parent = Handle(t.MyType)
t.MyType = Object.MyType(b\Parent)


WolRon(Posted 2005) [#4]
I used the word "OBJECT" in my code and it turned BLUE like it was Blitz3D code word.
Your Blitz install is corrupted. Format your harddrive and get a fresh cup of coffee...


Rook Zimbabwe(Posted 2005) [#5]
wolron is evil ;)

ohhhhhhhh I have been wondering about how to retrieve a particular type instance without chugging through the whole list...

Am still learning muchly about types... Hope what I know (the thimblefull that it is...) isn't different when I get enough to upgrade to BMax...

RZ


Picklesworth(Posted 2005) [#6]
Actually, Object and handle are useful in very rare situations.
What you can do instead, which is more versatile, is the following primitive example:
Type MyTypeA
Field Parent.MyTypeB
Field SomethingA$
End Type

Type MyTypeB
Field Child.MyTypeA
Field SomethingB$
End Type


Then later, let's say an instance of MyTypeA is created, with an instance of MyTypeB in its Parent field. (We will assume, to save me 15 letters of typing which I have already spent writing this explanation... That MyTypeB has already been created with "I'm b.MyTypeB" in its SomethingB$ field, and that MyTypeA has the value "I'm a.MyTypeA" in its SomethingA$ Field.)
;Could be this
a.MyTypeA = New MyTypeA
a\Parent = b.MyTypeB

;Example of creating a New type immeadiately as a Type's field
b\Child.MyTypeA = New MyTypeA
b\Child\Parent.MyTypeB = b.MyTypeB


Now, these types can access eachother's values very quickly like so:
If Not a\Parent\SomethingB$ = "I'm b.MyTypeB" Then Print("Picklesworth is a daft fool")


These ideas can also be applied to Arrays, or any other kind of variable for that matter (eg: You could have a Global variable that is a Type instance).
Dim a.MyTypeA(5)
Dim b.MyTypeB(5)

For n = 0 To 5
  a.MyTypeA(n) = New MyTypeA
  b.MyTypeB(n) = New MyTypeB
Next
;Now we can access these types directly and instantlywith a single number
Print a.MyTypeA(2)\SomethingA$ ;Access the Something field of MyTypeA number 2 (well, actually 3, but meh).


Also, a type instance can have a field linking to a Type of its own Type class... Just in case you were wondering :)




Somebody please do something... I seem to be on an endless rampage of helpfulness.


D4NM4N(Posted 2005) [#7]
please.... carry on ;)