[Opensim-dev] ScriptEvents Module
Diva Canto
diva at metaverseink.com
Mon Nov 19 01:28:35 UTC 2012
Hi,
I am working on a module that passes interesting scene events up to the
scripts in a manner that's very easy to act upon. An example is attached
at the end of this message.
Question: What other events would people like to grab? The idea is to
have the module do all the complicated logic, and pass only simple facts
to the scripts.
state_entry()
{
llSay(0, "Script running");
modSendCommand("Script Events", "subscribe|AvatarArrived",
llGetKey());
modSendCommand("Script Events", "subscribe|LastAvatarLeft",
llGetKey());
}
link_message(integer sender_num, integer num, string message, key id)
{
list parts = llParseString2List(message, ["|"], []);
if (llGetListLength(parts) >= 2) {
if (llList2String(parts, 1) == "AvatarArrived") {
// message is: event|AvatarArrived|True or False <--
LocalTeleport or HG Teleport
if (llGetListLength(parts) >= 3) {
if (llList2String(parts, 2) == "True") {
llInstantMessage(id, "Welcome to the Gateway!
Choose your destination by walking into one of the teleporters.");
llRegionSay(region_channel, "ports foreign");
} else {
llInstantMessage(id, "Welcome to the Virtual
Lab's Gateway! Choose your local destination by walking into one of the
teleporters.");
llRegionSay(region_channel, "ports local");
}
} else {
llSay(0, "Malformed message " + message + " " +
(string)llGetListLength(parts));
}
play_music();
} else if (llList2String(parts, 1) == "LastAvatarLeft") {
// message is: event|LastAvatarLeft
llRegionSay(region_channel, "ports reset");
}
}
}
More information about the Opensim-dev
mailing list