LSL Code - "unknown" script for JohnsonBot AI systems - Sub Controller and Wearables
Well, someone asked about how to make sub controller and wearables answer something when the AIs don't come up with an answer - and it's already in there! The unknown|RESPONSE SRD will provide RESPONSE if the AI can't come up with something in a certain amount of time. Had a look at it and the 40 sec default delay and the code itself could be slightly improved... so here it is! You can replace the unknown script in the AI prim with this, just remove original, make a full perm script and stick this in, and you don't even have to rez it to do that.
// deals with stimuli that lead to no response from AI
float DELAY = 15.;
integer AIREQ = 1000;
integer RETURN = 999;
integer CMD = 998;
key ID;
default
{
state_entry()
{
}
link_message(integer link, integer n, string text, key id)
{ // llOwnerSay((string)n+" "+text);
if(n == CMD)
{ if(text == "aireset")
{ llOwnerSay("Unknown handler reset");
llResetScript();
}
}
else if(n == AIREQ)
{ if(id != llGetOwnerKey(id)) return;
ID = llGetOwnerKey(id); llSetTimerEvent(DELAY);
// llOwnerSay((string)ID); //debug
}
else if(n == RETURN) llSetTimerEvent(0.);
}
timer()
{ llMessageLinked(LINK_THIS,RETURN,"",ID); // timeout after 40 sec should be enough
}
}
float DELAY = 15.;
integer AIREQ = 1000;
integer RETURN = 999;
integer CMD = 998;
key ID;
default
{
state_entry()
{
}
link_message(integer link, integer n, string text, key id)
{ // llOwnerSay((string)n+" "+text);
if(n == CMD)
{ if(text == "aireset")
{ llOwnerSay("Unknown handler reset");
llResetScript();
}
}
else if(n == AIREQ)
{ if(id != llGetOwnerKey(id)) return;
ID = llGetOwnerKey(id); llSetTimerEvent(DELAY);
// llOwnerSay((string)ID); //debug
}
else if(n == RETURN) llSetTimerEvent(0.);
}
timer()
{ llMessageLinked(LINK_THIS,RETURN,"",ID); // timeout after 40 sec should be enough
}
}
If you want the bikini it is available here at Amazon.

Comments
Post a Comment