fix(settings.lsl): fix: #3 - finish implementing basic settings module
Signed-off-by: zontreck <tarapiccari@gmail.com>
This commit is contained in:
parent
fb91a6ea18
commit
9eb015e440
1 changed files with 26 additions and 11 deletions
|
@ -4,9 +4,28 @@
|
|||
#include "../external/AriasCreations/Common.lsl"
|
||||
#include "../external/AriasCreations/Helpers.lsl"
|
||||
|
||||
reqAllSettings(){
|
||||
|
||||
DEBUG_FUNC(true, "req_all_settings", []);
|
||||
// List Found Keys
|
||||
list lKeys = llLinksetDataFindKeys("nusetting.", 0, 0);
|
||||
integer i = 0;
|
||||
integer end = llGetListLength(lKeys);
|
||||
for(i=0;i<end; i++) {
|
||||
sKey = llList2String(lKeys, i);
|
||||
ReadSetting(llGetSubString(sKey, 9, -1));
|
||||
}
|
||||
|
||||
DEBUG_FUNC(false, "req_all_settings", []);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry() {
|
||||
llSetTimerEvent(5); // TODO: Change this to schedule with the TaskScheduler module for a callback
|
||||
// After expiration of timer, send all settings
|
||||
}
|
||||
|
||||
changed(integer iChange) {
|
||||
if(iChange & CHANGED_OWNER) {
|
||||
llLinksetDataDeleteFound("nusetting.", "");
|
||||
|
@ -14,6 +33,12 @@ default
|
|||
}
|
||||
}
|
||||
|
||||
timer() {
|
||||
llSetTimerEvent(0);
|
||||
|
||||
reqAllSettings();
|
||||
}
|
||||
|
||||
link_message(integer iSender, integer iNum, string sMsg, key kID)
|
||||
{
|
||||
DEBUG_FUNC(true, "link_message", [iNum, sMsg, kID]);
|
||||
|
@ -24,17 +49,7 @@ default
|
|||
} else if(llJsonGetValue(sMsg, ["op"]) == OP_SETTINGS_READ) {
|
||||
string sKey = llJsonGetValue(sMsg, ["key"]);
|
||||
if(sKey == "ALL") {
|
||||
DEBUG_FUNC(true, "req_all_settings", []);
|
||||
// List Found Keys
|
||||
list lKeys = llLinksetDataFindKeys("nusetting.", 0, 0);
|
||||
integer i = 0;
|
||||
integer end = llGetListLength(lKeys);
|
||||
for(i=0;i<end; i++) {
|
||||
sKey = llList2String(lKeys, i);
|
||||
ReadSetting(llGetSubString(sKey, 9, -1));
|
||||
}
|
||||
|
||||
DEBUG_FUNC(false, "req_all_settings", []);
|
||||
reqAllSettings();
|
||||
}
|
||||
ReadSetting(sKey);
|
||||
} else if(llJsonGetValue(sMsg, ["op"]) == OP_SETTINGS_DELETE) {
|
||||
|
|
Loading…
Reference in a new issue