EntityName$ behavior

Blitz3D Forums/Blitz3D Beginners Area/EntityName$ behavior

gpete(Posted 2003) [#1]
I'm new to Blitz3d and I found something interesting with NameEntity & EntityName$. I have the objects, (trees & a building) set for CameraPick and it works well with the mouse. In the case of the trees which are randomly placed,
the EntityName$ returned is a eight-digit number(eg. 59992311). The building which I named "Chalet" using NameEntity also comes up as an eight-digit number!! It doesn't use the name which was specifically assigned to it. Any ideas? Sometimes I wish the manual was more detailed! thanks.....


skidracer(Posted 2003) [#2]
The value returned by CameraPick is the entity handle, to find out that entity's name you then need to call EntityName with this handle ie:

entity=CameraPick(cam,MouseX(),MouseY())
If entity<>0 name$=EntityName(entity)


gpete(Posted 2003) [#3]
Ok, I'll use that! Thanks Skid...

I have to admit this handle issue is something I don't
understand yet.


simonh(Posted 2003) [#4]
A handle is just something that lets you reference something such as an entity throughout your program.

E.g.

football=CreateSphere() ; football is the handle
EntityColor football,255,0,0 ; make football red!

Without the entity handle, you would not be able to make the football red.

CreateSphere()
EntityColor ????,255,0,0 ; change the color of what??

In terms of whats going on behind the scenes a handle is just an integer that references a part of the computer memory that allows us to access the entity.


WolRon(Posted 2003) [#5]
Footballs are not spheres!!!


simonh(Posted 2003) [#6]


Oh yes they are :)