EntityName$ behavior

Blitz3D Forums/Blitz3D Beginners Area/EntityName$ behavior

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.....

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)

Ok, I'll use that! Thanks Skid...

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

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.

Footballs are not spheres!!!



Oh yes they are :)