Forcing a value into an object holder

BlitzPlus Forums/BlitzPlus Programming/Forcing a value into an object holder

Mr Brine(Posted 2003) [#1]
Howdy!

Heres my dilema:


type GameObject

field x, y

end type

global gameobj.GameObject = new GameObject

debuglog int(gameobj)


debuglog displays a value ie "1243456", if you dont create a new game object debuglog displays "0", so Im assuming int(type) returns a handle (pointer) to that object. But Ive got a problem, so Im hoping sombody can help. I want to know if I can force a value in to gameobj. The following lines of code cause me compalation errors:

gameobj = 123456
gameobj = gameobj(123456)
gameobj = int(123456)

and basicly Im all out of ideas, any help greatly appriated! (im currently using blitz 2d, but Ive got blitz + as well)

ta

Mr Brine


Ross C(Posted 2003) [#2]
Hey, that line i belive

gameobj = gameobj(123456)

will make blitz use an array. so that'll prob give you an error. Can i ask why you are wanting to put a number into the handle?


Mr Brine(Posted 2003) [#3]
basicly I want to store object pointers (using the int(gameobj) line to get the pointer) in a memory bank and then retrieve that value from the memory bank and force the value into a null object holder, the number '123456' is an example of a pointer value, and the line 'gameobj=gameobj(123456)' was meant to read 'gameobj = gameobject(123456)' a bit of typo on my part, but its irrelivant any way cause it didnt work!!

hope this helps clarify the situatuion

Mr Brine

PS Oh yeah the overall reason I wanna do this is for my game, to help the general overall efficiency of the system.


morduun(Posted 2003) [#4]
myHandle = Handle(gameObj)

myObject.GameObject = Object.GameObject(myHandle)


Mr Brine(Posted 2003) [#5]
Hey this looks good! Thanks for the help!!! :-)

Mr Brine