Useful use for a=b regarding entities

Blitz3D Forums/Blitz3D Programming/Useful use for a=b regarding entities

Ross C(Posted 2003) [#1]
Hey, it's prob not a new thing but for ppl who aren't aware.

if i say

a=createsphere()

a=b


a and b both point to the created sphere. Now i can say:

moveentity a,0,0,1
moveentity b,0,0,1


both of these will move the one sphere. And if i say free entity b, a is no longer a handle to that entity.

As i say, probably not a new discovery but i can think of some uses for it :)


Koriolis(Posted 2003) [#2]
It's only based on the fact that a is simple integer variable (handles are just plain integers you know).
So yes it's really no new.
But if you think of some interesting uses, let us know :)


Ross C(Posted 2003) [#3]
Sure will, i just need to try 'em out first :D


Al Mackey(Posted 2003) [#4]
This is very useful for shortcuts when you have complex data structures.

For example, instead of this:
x# = EntityX(Body\LeftArm\Hand\Thumb\Entity, 1)
y# = EntityY(Body\LeftArm\Hand\Thumb\Entity, 1)
z# = EntityZ(Body\LeftArm\Hand\Thumb\Entity, 1)

You can simply write this:
e = Body\LeftArm\Hand\Thumb\Entity
x# = EntityX(e, 1)
y# = EntityY(e, 1)
z# = EntityZ(e, 1)


Ross C(Posted 2003) [#5]
Yeah, that's the sort of thing i was looking at :)