Jump to content

Sensor Script Not working - Help


Wandering Soulstar
 Share

You are about to reply to a thread that has been inactive for 4424 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I set up the following code to determine if the 'owners' were at home, if not a message would go out so that doors left open could close, lights get turned off, etc. But it seems not to be working, at least today. Anyone see anything wrong with it?

 

default
{
	state_entry()
	{
		//Start Sensor
		llSensorRepeat("", NULL_KEY, AGENT, 90, PI, 300.0);
		
	}//End state_entry

	sensor(integer total_number)
	{
		integer i = 0;
		integer found = FALSE;
		gOwnerStatus = ABSENT;

		while (found == FALSE && i < total_number)
		{
			string name = llDetectedName(i);
			if (name == RES_1 || name == RES_2)
			{
				found = TRUE;
				gOwnerStatus = AT_HOME;
			}
			i++;
		}
		llShout(USER_SENSOR_CH, gOwnerStatus);
	}

}//End Default

 

Link to comment
Share on other sites

Assuming that your variables USER_SENSOR_CH,  RES_1 and RES_2 are global and have been given values, it ought to work.  However, you probably want to have a companion no_sensor event that sets gOwnerStatus = ABSENT and sends that message to your listening scripts.  After all, the sensor event will only be triggered if the script detects someone.  If there's nobody there to detect, your script won't send any message at all.  You also might want to consider using llRegionSay or llRegionSayTo instead of llShout, but that's a nuance that shouldn't affect how this part of the script behaves. 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4424 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...