/source/eggdrop/motd.lsl |
@@ -5,7 +5,7 @@ |
// A MOTD module for Corrade Eggdrop. |
// |
/////////////////////////////////////////////////////////////////////////// |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -32,7 +32,7 @@ |
} while(llGetListLength(k) != 0); |
return llDumpList2String(data, "&"); |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -44,7 +44,7 @@ |
return <x, y, 0>; |
return wasCirclePoint(radius); |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -68,7 +68,7 @@ |
} while(i != ""); |
return o; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -107,7 +107,7 @@ |
// postcondition: length(s) = 0 |
return l + m; |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -136,7 +136,7 @@ |
} while(l != []); |
return llDumpList2String(v, ","); |
} |
|
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
@@ -160,7 +160,7 @@ |
) |
); |
} |
|
|
// configuration data |
string configuration = ""; |
// callback URL |
@@ -171,7 +171,7 @@ |
string group = ""; |
string data = ""; |
string jump_state = ""; |
|
|
default { |
state_entry() { |
llOwnerSay("[MOTD] Starting module..."); |
@@ -202,7 +202,7 @@ |
llSetTimerEvent(0); |
} |
} |
|
|
state url { |
state_entry() { |
// DEBUG |
@@ -224,7 +224,7 @@ |
state set; |
if(jump_state == "listen_group") |
state listen_group; |
|
|
// DEBUG |
llOwnerSay("[MOTD] Jump table corrupted, please contact creator..."); |
llResetScript(); |
@@ -240,11 +240,11 @@ |
} |
} |
} |
|
|
state create_database { |
state_entry() { |
// DEBUG |
llOwnerSay("[MOTD] Creating database."); |
llOwnerSay("[MOTD] Creating database: " + wasKeyValueGet("motd table", configuration)); |
llInstantMessage( |
wasKeyValueGet( |
"corrade", |
@@ -283,7 +283,12 @@ |
llOwnerSay("[MOTD] Unable modify database: " + |
wasURLUnescape( |
wasKeyValueGet("error", body) |
) + |
" " + |
wasURLUnescape( |
wasKeyValueGet("data", body) |
) |
|
); |
llResetScript(); |
} |
@@ -308,8 +313,8 @@ |
llSetTimerEvent(0); |
} |
} |
|
|
|
|
state listen_group { |
state_entry() { |
// DEBUG |
@@ -319,7 +324,7 @@ |
// We only care about notifications now. |
if(id != "notification") |
return; |
|
|
// Get the group. |
group = wasURLUnescape( |
wasKeyValueGet( |
@@ -327,7 +332,7 @@ |
message |
) |
); |
|
|
// Retrieve the membership notification. |
if(wasKeyValueGet("type", message) == "membership" && |
wasKeyValueGet("action", message) == "joined") { |
@@ -346,11 +351,11 @@ |
jump_state = "greet"; |
state url; |
} |
|
|
// This script only processes group notifications. |
if(wasKeyValueGet("type", message) != "group") |
return; |
|
|
// Get the sent message. |
data = wasURLUnescape( |
wasKeyValueGet( |
@@ -358,30 +363,30 @@ |
message |
) |
); |
|
|
// Check if this is an eggdrop command. |
if(llGetSubString(data, 0, 0) != |
wasKeyValueGet("command", configuration)) |
return; |
|
|
// Check if the command matches the current module. |
list command = llParseString2List(data, [" "], []); |
if(llList2String(command, 0) != |
wasKeyValueGet("command", configuration) + "motd") |
return; |
|
|
// Remove command. |
command = llDeleteSubList(command, 0, 0); |
|
|
// Dump the rest of the message. |
data = llDumpList2String(command, " "); |
|
|
// Get the sent message. |
if(data == "") { |
jump_state = "get"; |
state url; |
} |
|
|
jump_state = "set"; |
state url; |
} |
@@ -396,7 +401,7 @@ |
} |
} |
} |
|
|
state greet { |
state_entry() { |
// DEBUG |
@@ -451,7 +456,7 @@ |
); |
state listen_group; |
} |
|
|
data = llDumpList2String( |
llDeleteSubList( |
wasCSVToList( |
@@ -464,10 +469,10 @@ |
), |
"" |
); |
|
|
if(data == "") |
state listen_group; |
|
|
data = "Hello " + firstname + " " + lastname + "!" + " " + data; |
state tell; |
} |
@@ -489,7 +494,7 @@ |
llSetTimerEvent(0); |
} |
} |
|
|
state get { |
state_entry() { |
// DEBUG |
@@ -521,7 +526,12 @@ |
wasListToCSV( |
[ |
"group", |
wasURLEscape(group) |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
) |
] |
) |
), |
@@ -544,7 +554,7 @@ |
); |
state listen_group; |
} |
|
|
data = llDumpList2String( |
llDeleteSubList( |
wasCSVToList( |
@@ -557,12 +567,12 @@ |
), |
"" |
); |
|
|
if(data == "") { |
data = "Sorry, no MOTD is currently set."; |
state tell; |
} |
|
|
state tell; |
} |
timer() { |
@@ -583,7 +593,7 @@ |
llSetTimerEvent(0); |
} |
} |
|
|
state set { |
state_entry() { |
// DEBUG |
@@ -615,7 +625,12 @@ |
wasListToCSV( |
[ |
"name", |
wasURLEscape(group), |
wasURLEscape( |
wasKeyValueGet( |
"group", |
configuration |
) |
), |
"data", |
wasURLEscape(data) |
] |
@@ -661,7 +676,7 @@ |
llSetTimerEvent(0); |
} |
} |
|
|
state tell { |
state_entry() { |
// DEBUG |