Saturday 8 August 2009

Improved Code : Second Life ... Attached Sensor Script... with HTTP Request to the Sensor...

string url = "http://apps.prendingerlab.net/virtual_social_network/virtual_mobile_social.php?";
string requestid = "";
string listAgents = "";


callWS(string source, string target)
{
// Call the server
requestid = llHTTPRequest(url + "enc_source_avatar=" + source + "&enc_target_avatar=" + target, [HTTP_METHOD,"GET"] , "");
//llSay(0,url + "enc_source_avatar=" + source + "&enc_target_avatar=" + target);
}

default
{

attach(key attached)
{
if (attached == NULL_KEY)
{
llSetTimerEvent(0);
llSetObjectName("SensorMSN");
llSay(0, llGetObjectName());
}
else
{
llSetTimerEvent(1);
llSetObjectName("Sensor on " + llKey2Name(llGetOwner()));
llSay(0, llGetObjectName());
}
}

timer()
{
llSensor("", NULL_KEY, AGENT, 10, PI);
}


sensor(integer total_number) // total_number is the number of avatars detected.
{
//llSay(0, "detected = " + (string)total_number);
integer i;
listAgents = "";
for (i = 0; i <>
{
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_SCRIPTED)
{
//llSay(0, llKey2Name(llGetOwner()) + " is close to " + llDetectedName(i));
//callWS(llKey2Name(llGetOwner()), llDetectedName(i));
//enc_source_avatar=fawad&enc_target_avatar=fawad
listAgents = llDetectedName(i) + "," + listAgents;
}
}
callWS(llKey2Name(llGetOwner()), listAgents);
}
// if nobody is within 10 meters, say so.
no_sensor() {
//llSay(0, "Nobody is around.");
}

}

Thursday 6 August 2009

Second Life ... Attached Sensor Script... with HTTP Request to the Sensor...

string url = "http://apps.prendingerlab.net/virtual_social_network/virtual_mobile_social.php?";
string requestid = "";


callWS(string source, string target)
{
// Call the server
requestid = llHTTPRequest(url + "enc_source_avatar=" + source + "&enc_target_avatar=" + target, [HTTP_METHOD,"GET"] , "");
}

default
{

attach(key attached)
{
if (attached == NULL_KEY)
{
llSetTimerEvent(0);
llSetObjectName("SensorMSN");
llSay(0, llGetObjectName());
}
else
{
llSetTimerEvent(1);
llSetObjectName("Sensor on " + llKey2Name(llGetOwner()));
llSay(0, llGetObjectName());
}
}

timer()
{
llSensor("", NULL_KEY, AGENT, 10, PI);
}


sensor(integer total_number) // total_number is the number of avatars detected.
{
llSay(0, "detected = " + (string)total_number);
integer i;
for (i = 0; i <>
{
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_SCRIPTED)
{
//llSay(0, llKey2Name(llGetOwner()) + " is close to " + llDetectedName(i));
callWS(llKey2Name(llGetOwner()), llDetectedName(i));
//enc_source_avatar=fawad&enc_target_avatar=fawad
}
}
}
// if nobody is within 10 meters, say so.
no_sensor() {
llSay(0, "Nobody is around.");
}

}

Wednesday 5 August 2009

Second Life ... Attached Sensor Script...

default
{

attach(key attached)
{
if (attached == NULL_KEY)
{
llSetTimerEvent(0);
llSetObjectName("SensorMSN");
llSay(0, llGetObjectName());
}
else
{
llSetTimerEvent(1);
llSetObjectName("Sensor on " + llKey2Name(llGetOwner()));
llSay(0, llGetObjectName());
}
}

timer()
{
llSensor("", NULL_KEY, AGENT, 10, PI);
}


sensor(integer total_number) // total_number is the number of avatars detected.
{
llSay(0, "detected = " + (string)total_number);
integer i;
for (i = 0; i <>
{
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_SCRIPTED)
{
llSay(0, llKey2Name(llGetOwner()) + " is close to " + llDetectedName(i));
}
//llSay(0, llGetObjectName() + " is close to " + llDetectedName(i));
//if ( llGetSubString( llDetectedName(i), 0, 8) == "Sensor on")
//{
// llSay(0, llGetObjectName() + " is close to " + llDetectedName(i));
//}
}
}
// if nobody is within 10 meters, say so.
no_sensor() {
llSay(0, "Nobody is around.");
}

}

Azure OpenAI Architecture Patterns & Deployment Patterns

Sharing some useful links that will help customers architect Azure OpenAI solution using the best practices: (1) Azure OpenAI Landing Zone r...