User Tools

Site Tools


scripting_the_radar
Advertisement

Scripting The Radar

The Firestorm radar can send information to scripted objects and/or attachements.

If you open the People panel (via the button, or the top menu bar → Comm → People, then click the Gear icon, you can enable:

  • Report Enter Alerts to Scripts
  • Report Exit Alerts to Scripts

Tthese options are also in PreferencesChat -> Radar.

If either (or both) of these are enabled, the radar will send an avatar UUID to scripts, on chat channel -777777777, when an avatar enters the region you are currently in. If both options are enabled, then the behavior expands to include full radar range, 4096m.

The format of the string sent by the radar is:

number times called, avatar delta, [comma separated list of avatar UUIDs]
  • avatar delta indicates a change in the number of avatars with respect to the prior report - so 1 means an avatar entered the region, while -1 means one left.

Sample output (names and UUIDs replaced for obvious reasons):

[18:41] Avatar1 left the region.
[18:41] Test Radar: 10,-1,00000000-0000-0000-0000-000000000000
[18:41] Avatar2 entered the region (48.59 m).
[18:41] Test Radar: 11,1,00000000-0000-0000-0000-000000000000

It is also possible to have the radar output the current list of avatar by playing a very specific sound, the one with UUID: 76c78607-93f9-f55a-5238-e19b1a181389

Below is a very basic script that:

  • sets a listen on the radar chat channel, -777777777
  • listens for output on that channel, and reports anything received to the owner of the object containing the script
  • outputs the list of avatars in a region after a teleport
  • outputs the list of avatars in a region when the object is touched.

NOTE: when you use the sound trigger, the delta will report the total number of avatars, since the trigger does a full scan.

default
{
    state_entry()
    { 
        llListen(-777777777,"",NULL_KEY,"");
    }

    listen(integer channel, string name, key id, string message)
    {
        llOwnerSay(message);
    }

    changed(integer what)
    {
        if(what & CHANGED_REGION)
        {
            llTriggerSound("76c78607-93f9-f55a-5238-e19b1a181389", 1.0);
        }
    }
    
    touch_start(integer num_detected)
    {
        llTriggerSound("76c78607-93f9-f55a-5238-e19b1a181389", 1.0);
    }
}
scripting_the_radar.txt · Last modified: 2015/07/09 21:20 by miro.collas