object command ?

BlitzMax Forums/BlitzMax Beginners Area/object command ?

ckob(Posted 2005) [#1]
well I cant find any documentation in blitz3d for it but some of the code im porting uses the object command like the following:

Anon.AnonInst = Object.AnonInst(Int(Split$(Params$, 1, ",")))

I cant seem to figure out what Object is and what it would translate to in bmax any help would be great.


ckob(Posted 2005) [#2]
could still use some help on this one.


Azathoth(Posted 2005) [#3]
Object is the base type, all other types inherit from it.


Bot Builder(Posted 2005) [#4]
Yeah. Everything but numbers, which sucks because that screws up fake overloading.


ckob(Posted 2005) [#5]
ok so what would I do in order to port that bit over to bmax?


Dreamora(Posted 2005) [#6]
What is this code meant to do at all, as it isn't B3D / BB+ code...


Perturbatio(Posted 2005) [#7]
the object command returns the object associated with a handle (retrieved with the handle command). They are undocumented but have become commonly used.


Yan(Posted 2005) [#8]
I should probably apologise for this in advance...



ckob(Posted 2005) [#9]
at risk of sounding stupid could you explain that ^^ ?


Dreamora(Posted 2005) [#10]
ah that kind of stuff ...

ok objects are by ref in BM. For their "int handles" you can convert them into byteptr for example and get the object of that later again.


ckob(Posted 2005) [#11]
TwoEyedPete Im afraid I dont quite understand exactly what your trying to tell me with that code example could you explain it or comment it please?


ckob(Posted 2005) [#12]
ok so after emailing blitz research they were kind enough to give me a work around:
Extern
Function bbHandleToObject:Object( handle )
Function bbHandleFromObject( obj:Object )
End Extern

Type MyType
Field x=1234
End Type

Local t:MyType=New MyType

Local h=bbHandleFromObject( t )

Local p:MyType=MyType( bbHandleToObject(h) )

Print p.x


Now Ive encorperated that into my code and it works but I need to do the following:

Blitz3d
Actor.ActorInstance = Object.ActorInstance(Int(SafeSplit$(Params$, 1, ",")))

now in Blitzmax I have this:
Actor:bbActorInstance = bbActorInstance(bbHandleToObject(A))

but I cannot figure out how to still use
Int(SafeSplit$(Params$, 1, ","))

Any suggestions would be great thanks


Yan(Posted 2005) [#13]
Eh?...I could have sworn I'd replied to this thread ages ago??? 8o/

I don't really understand what you're asking?

You should be able to just use the same code...
Actor:bbActorInstance = bbActorInstance(bbHandleToObject(Int(SafeSplit$(Params$, 1, ","))))



ckob(Posted 2005) [#14]
well I'll give it a shot but im not sure.

Ok looks like it might have worked... thanks


Yan(Posted 2005) [#15]
Don't forget to release your handles.