Hello,
I am trying to make (a touchable or walkable) prim that will change the EEP for the agent interacting with it.
I tried this script but it does simply nothing.
Does anyone has a working script or a suggestion, please?
string daycycle_a = "3545d068-b539-4f55-9687-2d33e1762eb4";
string daycycle_b = "19d7a2a7-e10a-451f-9064-0e2f426f21f1";
integer transition = 1;
integer switch;
default
{
state_entry()
{
llSay(PUBLIC_CHANNEL, "Touch to see osReplaceAgentEnvironment usage.");
llSay(PUBLIC_CHANNEL, "Transition: " + (string)transition + " second(s).");
}
touch_start(integer number)
{
key agentKey = llDetectedKey(0);
if (llGetAgentSize(agentKey) != ZERO_VECTOR)
{
integer result;
if (switch = !switch)
{
result = osReplaceAgentEnvironment(agentKey, transition, daycycle_a);
llRegionSayTo(agentKey, PUBLIC_CHANNEL, "daycycle_a: " + daycycle_a);
}
else
{
result = osReplaceAgentEnvironment(agentKey, transition, daycycle_b);
llRegionSayTo(agentKey, PUBLIC_CHANNEL, "daycycle_b: " + daycycle_b);
}
if (daycycle_a == "" || daycycle_a == NULL_KEY || daycycle_b == "" || daycycle_b == "")
{
llRegionSayTo(agentKey, PUBLIC_CHANNEL, "The normal environment for the parcel or region has been selected.");
}
if (result > 0)
{
llRegionSayTo(agentKey, PUBLIC_CHANNEL, "Agent environment replaced with success!");
}
else if (result < 0)
{
llRegionSayTo(agentKey, PUBLIC_CHANNEL, "Agent environment replaced without success!");
}
}
else
{
llInstantMessage(agentKey, "You need to be in the same region to use this function ...");
}
}
}