Like the manual says c_scan modifies YOU to the pointer to the closest detected entity, and using event_detect all detected entities can be enumerated.
1) Imagine a function SCAN_ENTITIES;
2) In that function you call numberOfEntities = C_SCAN..., gives you the number of detected entities at all the time;
3) Turn the entity detectable using my.enable_detect = on, and call the event that will trigger the detection process, f.e. my.event = SCAN_ENTITIES_EVENT;
4) And now the event funtion (SCAN_ENTITIES_EVENT()):
Code:
if(scanEntityID >= numberOfEntities)
{
return;
}
if(event_type == event_detect)
{
TEMP_SCANNED_ENTITY = you;
scan_array_list[scanEntityID] = you;
scan_array_list[scanEntityID] = handle(TEMP_SCANNED_ENTITY);
scanEntityID += 1;
}
This way you save all detected entities in the handle array list.
5) Dont forget to turn the entities you want to be detected using my.enable_detect = on;
6) Now, when you need to acess those detected entities, just use the handle:
Code:
while (i < numberOfEntities)
{
if (scan_array_list[i])
{
you = ptr_for_handle(scan_array_list[i]);
}
}