object

Blitz3D Forums/Blitz3D Programming/object

gellyware(Posted 2004) [#1]
Hi, I was wondering if there are any tutorials anywhere on advanced uses of the type command. I was examinging some code and I find lines like this boggling:
view.View = Object.View( ID )
	If view <> Null
		view\AX = X
		view\AY = Y
		view\AW = W
		view\AH = H
		
		Return True
	EndIf


and even this

Field Owner.Window


To be more specific, It seems "object" is an undocumented blitz Command? If so how is it used? and can anyone explain how owner.window would work?


Almo(Posted 2004) [#2]
Look in the help under "Type"

Look at some of the examples, then come back for more help if those don't help.


Rogue Vector(Posted 2004) [#3]
Hi,

There are some good tutorials on undocumented commands at:
http://www.blitzcoder.com

Once there, I think the path to follow is ;
Code Database\Undocumented Commands\Object and Handle

Regards,

Rogue Vector


Ross C(Posted 2004) [#4]
Object and Handle are used to get and use the handles of that particular type object. They are used to instantly access a type object. Saves you searching through the entire type list.


big10p(Posted 2004) [#5]
'Field Owner.Window' just says that the variable called 'Owner' is a pointer to a 'Window Type'.

Just remember that the suffix '.Window' simply specifies what kind of variable 'Owner' is in exactly the same way as $ denotes a string variable, # a floating point variable, % an integer, etc.


Techlord(Posted 2004) [#6]
lucid,

Many are in favor of using Object/Handle Functions to manage types and access them instantly. However, they are not documented and probably for good reason. I would like to encourage using an array of types.
Dim objID.obj(256)
There is slightly more setup required, but, benefits are great.

You can develop a simple or complex ID management system with an array of types. The advantage of assigning your own IDs is that you has complete control over the objects at design time, unlike Handles which are assigned at runtime.

For example, I'm creating a large RPG game level with lots of triggers that activate specific events and game objects (ie, doors, platforms, etc). All triggers, doors, platforms etc have their own specific ID. Thus, I can easily assign trigger(1) to door(4), trigger(2) to platform(9) within my level editor or script.
Type obj
Field ID%
Field property1%
End Type
Dim objID.obj(256)

this.obj=New obj
this\ID%=1
this\property1%=something
objID.obj(this\ID)=this
Even if one uses Object/Handle, some form of ID management is required for complex interactivity.