// Bromley College
// Linden Script Exhibition
// Code for Step 33 Poster
default
{
touch_start(integer total_number)
{
llSensor("", NULL_KEY, AGENT, 96, PI);
// Scan for all agents (AGENT) with any name ("") and any id (NULL_KEY) within 96 metres (the maximum scan range) in all directions (PI). If any agents are detected create an indexed list of them and raise a sensor() event.
}
sensor(integer total_number)
// The number of detected agents is passed to the script below in the parameter total_number.
{
// The following 'for' loop works through the list created by the llsensor() function and the outputs information on each detected agent in turn.
integer i;
for (i = 0; i < total_number; i++)
{
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_AWAY)
// The llGetAgentInfo()function here checks to see if the detected agent (specified by their key) is in "away" mode.
{
llSay(0, llDetectedName(i) + " is away.");
}
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_CROUCHING)
{
llSay(0, llDetectedName(i) + " is crouching");
}
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_FLYING)
{
llWhisper(0, llDetectedName(i) + " is flying.");
}
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_IN_AIR)
{
llWhisper(0, llDetectedName(i) + " is hovering.");
}
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_MOUSELOOK)
{
llWhisper(0, llDetectedName(i) + " is in mouselook.");
}
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_ON_OBJECT)
{
llWhisper(0, llDetectedName(i) + " is sitting on an object.");
}
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_TYPING)
{
llWhisper(0, llDetectedName(i) + " is typing.");
}
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_WALKING)
{
llWhisper(0, llDetectedName(i) + " is walking.");
}
}
}
}
// End of code;