Howto find entities with script and get the entityname?


#1

I don’t know if there is already script support to scan for entities and get the name from it.
If there is already script support for it. is there some very simple small basic example ?
Because with the entity name option i get closer to mabey make what i want.

Or at least try.


#2

Yes. There is. @Adrian and @Coal perform this task when you click on a plot of land on hifi://earth if the land is freely available, it grabs your account name and sends it to them so that they may give you modification rights…


#3

After reading your original request, I realize you are attempting something similar to the llSensor() in SL.

I don’t have time to investigate that, but I’m fairly certain you can do this just keep in mind that HF units are in metric units.

-cheers-


#4

I think you misunderstand it.
It’s indeed more like llSensor in SL. you scan the area and get a list of objects with the name.
The script @adrian and @coal use works pretty sure by entity click.detection.
But i need to know the location, name etc. of entitity without clicking it. becaue the script cannot click.


#5

entityList.js dos search the entities and give the entity properties.


#6

Nice, i go check that script.


#7

I tried it, but it’s not doing much. it’s not doing anything ! Unless i use the script wrong.
So that’s not helping to understand how to scan for entities around the script.


#8

This might be along the lines of what you’re looking for …

var entities,
    entity,
    properties,
    i;

entities = Entities.findEntities(MyAvatar.position, 100);
//print(JSON.stringify(entities));

for (i = 0; i < entities.length; i += 1) {
    var entity = entities[i];
    properties = Entities.getEntityProperties(entity);
    print(entity.id
        + "\n    name: " + properties.name
        + "\n    type: " + properties.type 
        + "\n    url:  " + properties.modelURL);
}