Get stall scripts functional
This commit is contained in:
parent
b6a59a6673
commit
cf5144befb
4 changed files with 204 additions and 81 deletions
|
@ -1,10 +1,6 @@
|
|||
|
||||
MainMenu(key kAv)
|
||||
{
|
||||
list lAppend = [];
|
||||
// Check against ZNI Support roster
|
||||
UtilsMenu(key kAv) {
|
||||
list lAppend = ["Reboot", "main.."];
|
||||
integer iAdmin=0;
|
||||
string sAppend;
|
||||
string sTag = llList2String(llGetObjectDetails(kAv,[OBJECT_GROUP_TAG]),0);
|
||||
if(llListFindList(g_lSupport, [(string)kAv])!=-1 || llListFindList(g_lAdminTag, [sTag])!=-1){
|
||||
if(g_kLeasedTo!=NULL)lAppend += ["PermaLease"];
|
||||
|
@ -13,12 +9,33 @@ MainMenu(key kAv)
|
|||
lAppend += ["Import", "Export", "MemStick"];
|
||||
}
|
||||
|
||||
if(g_kLeasedTo == NULL) {
|
||||
|
||||
}else if(g_kLeasedTo == kAv || iAdmin || g_kOwner == kAv) {
|
||||
lAppend += [Checkbox(bool(g_iMask & MASK_LOGO), "Logo"), Checkbox(bool(g_iMask & MASK_CUSTOM_TEXT_COLOR), "CustomTxt"), "SetTxtC", Checkbox(bool(g_iMask & MASK_WHITEFRAME), "White Frame"), "*RESET*"];
|
||||
}
|
||||
|
||||
string sAppend = "\nUtility Menu";
|
||||
|
||||
Menu(g_kAuthorized, MAIN_MENU_TEXT+sAppend, lAppend, "menu~utils");
|
||||
}
|
||||
MainMenu(key kAv)
|
||||
{
|
||||
list lAppend = ["Utils.."];
|
||||
// Check against ZNI Support roster
|
||||
integer iAdmin=0;
|
||||
string sAppend;
|
||||
string sTag = llList2String(llGetObjectDetails(kAv,[OBJECT_GROUP_TAG]),0);
|
||||
if(llListFindList(g_lSupport, [(string)kAv])!=-1 || llListFindList(g_lAdminTag, [sTag])!=-1){
|
||||
iAdmin=1;
|
||||
}
|
||||
|
||||
if(llListFindList(g_lManagerTag, [sTag])!=-1)iAdmin=1;
|
||||
|
||||
if(g_kLeasedTo == NULL){
|
||||
lAppend += ["Lease"];
|
||||
}else if(g_kLeasedTo == kAv || iAdmin || g_kOwner == kAv){
|
||||
lAppend += ["End Lease", sSetor((g_iFlags&4)," ", "Renew"), "Set Picture", "Set Owner", sSetor ((g_iFlags & 2),"TransferLease", " "), "Set Name", Checkbox(bool(g_iMask & MASK_WHITEFRAME), "White Frame"), Checkbox(bool(g_iMask & MASK_LOGO), "Logo"), Checkbox(bool(g_iMask & MASK_CUSTOM_TEXT_COLOR), "CustomTxt"), "SetTxtC", "*RESET*"];
|
||||
lAppend += ["End Lease", sSetor((g_iFlags&4), " ", "Renew"), "Set Picture", "Set Owner", sSetor ((g_iFlags & 2),"TransferLease", " "), "Set Name"];
|
||||
|
||||
sAppend += "\n* CustomTxt, and SetTxtC relate to custom text colors.";
|
||||
}
|
||||
|
@ -146,6 +163,83 @@ DeletePayload()
|
|||
|
||||
|
||||
RestoreFromKVP()
|
||||
{
|
||||
g_kLeasedTo = llLinksetDataRead("lease");
|
||||
if(g_kLeasedTo == "")
|
||||
{
|
||||
g_kLeasedTo=NULL;
|
||||
llMessageLinked(LINK_SET, 0, "No Restore Info", "fw_data");
|
||||
llSleep(6);
|
||||
g_iHaveKVP=1;
|
||||
|
||||
|
||||
#if DEVELOPER == 0
|
||||
llMessageLinked(LINK_SET, 0, "<!c=green>Vacant - Available","fw_data");
|
||||
#else
|
||||
llMessageLinked(LINK_SET,0,(string)llGetFreeMemory()+" bytes free", "fw_data");
|
||||
#endif
|
||||
return;
|
||||
|
||||
}
|
||||
g_kTexture = llLinksetDataRead("texture");
|
||||
g_iExpireAt = (integer)llLinksetDataRead("expire");
|
||||
g_kOwner = llLinksetDataRead("owner");
|
||||
g_iMask = (integer)llLinksetDataRead("mask");
|
||||
|
||||
|
||||
g_iNotification = (integer)llLinksetDataRead("notif");
|
||||
g_sPreferredName = llLinksetDataRead("name");
|
||||
g_kTransferID = llLinksetDataRead("transfer");
|
||||
g_iTransferTimeout = (integer)llLinksetDataRead("transfer_expire");
|
||||
g_vCustomColorText = (vector)llLinksetDataRead("customtxtcolor");
|
||||
|
||||
|
||||
integer iChange=0;
|
||||
|
||||
if(!g_iHaveKVP)
|
||||
g_iState = mask(SET, g_iState, STATE_REBOOT_PENDING);
|
||||
|
||||
g_iHaveKVP=1;
|
||||
|
||||
|
||||
if(g_kLeasedTo == NULL_KEY){
|
||||
DeletePayload();
|
||||
llSleep(10);
|
||||
llResetScript();
|
||||
return;
|
||||
}
|
||||
|
||||
if(g_kTexture == ""){
|
||||
g_kTexture = NULL_KEY;
|
||||
iChange++;
|
||||
}
|
||||
if(g_kTransferID == ""){
|
||||
g_kTransferID=NULL_KEY;
|
||||
g_iTransferTimeout=0;
|
||||
iChange++;
|
||||
}
|
||||
|
||||
if(llStringLength(g_kOwner) != 36){
|
||||
if(g_kOwner == ""){
|
||||
g_kOwner = NULL_KEY;
|
||||
iChange++;
|
||||
}
|
||||
}
|
||||
|
||||
if(iChange){
|
||||
SavePayload();
|
||||
}
|
||||
|
||||
llMessageLinked(LINK_SET, 0, "<!c=red>Restored Information", "fw_data");
|
||||
llSleep(10);
|
||||
|
||||
llSetTimerEvent(5);
|
||||
//state rebootfast;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PartialRestoreKVP()
|
||||
{
|
||||
g_kLeasedTo = llLinksetDataRead("lease");
|
||||
if(g_kLeasedTo==""){
|
||||
|
|
|
@ -30,7 +30,7 @@ integer LINK_MENU_TIMEOUT = 330;
|
|||
|
||||
string g_sDate;
|
||||
|
||||
list MAIN_MENU_BUTTONS = ["Reboot"];
|
||||
list MAIN_MENU_BUTTONS = [];
|
||||
string MAIN_MENU_TEXT = "";
|
||||
string IMPORT_MENU_TEXT = "";
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ default
|
|||
{
|
||||
state_entry()
|
||||
{
|
||||
THIRTY_DAYS=ONE_DAY*30;
|
||||
if(llGetObjectDesc() == "" || llGetObjectDesc() == "(No Description)")
|
||||
{
|
||||
llSetObjectDesc((string)llGenerateKey());
|
||||
|
@ -25,6 +24,7 @@ default
|
|||
NO_TEXTURE = "";
|
||||
}
|
||||
|
||||
|
||||
listen(integer c,string n,key i,string m)
|
||||
{
|
||||
//llSay(0, m);
|
||||
|
@ -58,6 +58,7 @@ default
|
|||
g_iBoot=1;
|
||||
}
|
||||
}
|
||||
|
||||
link_message(integer s,integer n,string m,key i){
|
||||
if(i == "fw_ready")
|
||||
{
|
||||
|
@ -78,12 +79,12 @@ default
|
|||
#endif
|
||||
//llSetTimerEvent(1);
|
||||
}
|
||||
|
||||
if(n == 0x004f) {
|
||||
API_SERVER = DecipherService(m,"api");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
timer()
|
||||
{
|
||||
if(g_iState & STATE_REBOOT_FAST)
|
||||
|
@ -101,6 +102,7 @@ default
|
|||
state boot;
|
||||
}
|
||||
}
|
||||
|
||||
changed(integer t){
|
||||
if(t&CHANGED_REGION_START){
|
||||
state reboot;
|
||||
|
@ -111,6 +113,7 @@ default
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
state off{
|
||||
state_entry(){
|
||||
llMessageLinked(LINK_SET, 0, "<!c=red>Currently Offline", "fw_data");
|
||||
|
@ -124,6 +127,7 @@ state off{
|
|||
state reboot;
|
||||
}
|
||||
}
|
||||
|
||||
state reboot
|
||||
{
|
||||
state_entry(){
|
||||
|
@ -131,6 +135,7 @@ state reboot
|
|||
}
|
||||
}
|
||||
state boot{
|
||||
|
||||
state_entry()
|
||||
{
|
||||
if(g_iHaveKVP)RestoreFromKVP(); // solve some issues related to the bitmasks
|
||||
|
@ -203,6 +208,8 @@ state boot{
|
|||
} else llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
money( key id, integer amount )
|
||||
{
|
||||
integer days = amount/g_iPricePerDay;
|
||||
|
@ -234,6 +241,7 @@ state boot{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
state_exit()
|
||||
{
|
||||
g_iState = mask(UNSET, g_iState, STATE_REBOOT_PENDING);
|
||||
|
@ -298,6 +306,7 @@ state boot{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
changed(integer t){
|
||||
if(t&CHANGED_REGION_START){
|
||||
state reboot;
|
||||
|
@ -327,48 +336,49 @@ state boot{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
on_rez(integer i){
|
||||
state reboot;
|
||||
}
|
||||
touch_start(integer i)
|
||||
{
|
||||
if(!g_iHaveKVP){
|
||||
llRegionSayTo(llDetectedKey(0), 0, "/!\\ WARNING: The board is not done loading yet, please be patient");
|
||||
return;
|
||||
}
|
||||
if(g_kTexture!=NULL && g_kLeasedTo == NULL){
|
||||
if(llSameGroup(llDetectedKey(0))){
|
||||
|
||||
g_kLeasedTo = llDetectedKey(0);
|
||||
state reboot;
|
||||
return;
|
||||
}else{
|
||||
llSay(0, "Group tag is required to lease");
|
||||
llResetScript(); // refuse to lease
|
||||
}
|
||||
}
|
||||
|
||||
if(g_kTransferID!=NULL && g_kTransferID == llDetectedKey(0)){
|
||||
g_kLeasedTo = llDetectedKey(0);
|
||||
llWhisper(0, "Transfer Completed");
|
||||
g_kTransferID=NULL;
|
||||
g_iTransferTimeout = 0;
|
||||
g_sPreferredName="";
|
||||
SavePayload();
|
||||
llSleep(10);
|
||||
|
||||
g_iState = mask(SET, g_iState, STATE_REBOOT_PENDING);
|
||||
|
||||
return;
|
||||
}
|
||||
llRegionSay(70, llDumpList2String(["checkgroup", "menu", llDetectedKey(0)], "%"));
|
||||
}
|
||||
|
||||
touch_end(integer n) {
|
||||
if(llDetectedTouchPos(0) == ZERO_VECTOR) {
|
||||
// Dragged off
|
||||
if(g_lSupport == [])
|
||||
checkSupport();
|
||||
} else {
|
||||
|
||||
if(!g_iHaveKVP){
|
||||
llRegionSayTo(llDetectedKey(0), 0, "/!\\ WARNING: The board is not done loading yet, please be patient");
|
||||
return;
|
||||
}
|
||||
if(g_kTexture!=NULL && g_kLeasedTo == NULL){
|
||||
if(llSameGroup(llDetectedKey(0))){
|
||||
|
||||
g_kLeasedTo = llDetectedKey(0);
|
||||
state reboot;
|
||||
return;
|
||||
}else{
|
||||
llSay(0, "Group tag is required to lease");
|
||||
llResetScript(); // refuse to lease
|
||||
}
|
||||
}
|
||||
|
||||
if(g_kTransferID!=NULL && g_kTransferID == llDetectedKey(0)){
|
||||
g_kLeasedTo = llDetectedKey(0);
|
||||
llWhisper(0, "Transfer Completed");
|
||||
g_kTransferID=NULL;
|
||||
g_iTransferTimeout = 0;
|
||||
g_sPreferredName="";
|
||||
SavePayload();
|
||||
llSleep(10);
|
||||
|
||||
g_iState = mask(SET, g_iState, STATE_REBOOT_PENDING);
|
||||
|
||||
return;
|
||||
}
|
||||
llRegionSay(70, llDumpList2String(["checkgroup", "menu", llDetectedKey(0)], "%"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -422,6 +432,7 @@ state boot{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
dataserver(key kID, string sData)
|
||||
{
|
||||
if(HasDSRequest(kID) != -1)
|
||||
|
@ -464,6 +475,7 @@ state boot{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
http_response(key k,integer s,list m,string b){
|
||||
if(HasDSRequest(k)!=-1){
|
||||
list lMeta = GetMetaList(k);
|
||||
|
@ -471,10 +483,9 @@ state boot{
|
|||
|
||||
list lPar = llParseStringKeepNulls(b,[";;"],[]);
|
||||
if(llList2String(lPar,0)=="GetSupport"){
|
||||
g_lSupport = StrideOfList(llParseString2List(llList2String(lPar,1), ["~"],[]), 2, 0, -1);
|
||||
g_lSupport = llParseString2List(llList2String(lPar,1), ["~"],[]);
|
||||
llMessageLinked(LINK_SET, 0x1D, llList2Json(JSON_ARRAY, g_lSupport), "");
|
||||
|
||||
llWhisper(0, "Obtained support representative list");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -490,7 +501,7 @@ state boot{
|
|||
|
||||
g_iNotification = iNotification;
|
||||
llSetTimerEvent(5);
|
||||
} else if(n == 0x004f) {
|
||||
} else if(n == 0x004f){
|
||||
API_SERVER = DecipherService(m,"api");
|
||||
} else if(n == 0x3E)
|
||||
{
|
||||
|
|
|
@ -21,10 +21,9 @@ default
|
|||
g_iAuthorized=1;
|
||||
g_kAuthorized=i;
|
||||
|
||||
RestoreFromKVP();
|
||||
PartialRestoreKVP();
|
||||
MainMenu(i);
|
||||
}else if(n == 0x004f) {
|
||||
API_SERVER = DecipherService(m,"api");
|
||||
|
||||
} else if(n == 0x1D)
|
||||
{
|
||||
g_lSupport = llJson2List(m);
|
||||
|
@ -37,24 +36,21 @@ default
|
|||
}
|
||||
} else if(n == LINK_MENU_RETURN)
|
||||
{
|
||||
list returnMenu = llParseString2List(m,["|"],[]);
|
||||
string sIdent = llList2String(returnMenu,0);
|
||||
string sButton = llList2String(returnMenu,1);
|
||||
string sIdent = llJsonGetValue(m, ["id"]);
|
||||
string sExtra = llJsonGetValue(m, ["extra"]);
|
||||
string sButton = llJsonGetValue(m,["reply"]);
|
||||
|
||||
|
||||
switch(sIdent)
|
||||
{
|
||||
case "menu~main":{
|
||||
switch(sButton){
|
||||
case "Import":{
|
||||
GetArbitraryData(i, IMPORT_MENU_TEXT, "main~import");
|
||||
case "Utils..": {
|
||||
UtilsMenu(i);
|
||||
break;
|
||||
}
|
||||
case "-exit-":{
|
||||
llInstantMessage(i, "Menu Closed!");
|
||||
llMessageLinked(LINK_THIS, LINK_MENU_REMOVE, "", i);
|
||||
break;
|
||||
}
|
||||
case "Export":{
|
||||
llWhisper(5, llList2Json(JSON_OBJECT,["cmd","set_memstick","leasee",g_kLeasedTo,"expire_time",g_iExpireAt,"texture",g_kTexture,"owner",g_kOwner]));
|
||||
break;
|
||||
}
|
||||
case "Lease":{
|
||||
|
@ -100,15 +96,6 @@ default
|
|||
}
|
||||
break;
|
||||
}
|
||||
case "PermaLease":{
|
||||
llMessageLinked(LINK_SET, 0x3E, llList2Json(JSON_OBJECT, ["op", "perma"]), "");
|
||||
break;
|
||||
}
|
||||
case "*RESET*":{
|
||||
llMessageLinked(LINK_SET, 0x3E, llList2Json(JSON_OBJECT, ["op", "reset"]), "");
|
||||
llResetScript();
|
||||
break;
|
||||
}
|
||||
case "TimeRemain":{
|
||||
if(g_iExpireAt == -1){
|
||||
llSay(0, "No Expiration is set");
|
||||
|
@ -130,10 +117,6 @@ default
|
|||
GetArbitraryData(i, HEADER+"What is the owner's secondlife name?", "main~owner");
|
||||
break;
|
||||
}
|
||||
case "MemStick":{
|
||||
llGiveInventory(i,"Stall Board Flash Drive [ZNI]");
|
||||
break;
|
||||
}
|
||||
case "TransferLease":{
|
||||
GetArbitraryData(i, HEADER+"Enter the username of the person you want to transfer this lease to", "main~leasetrans");
|
||||
break;
|
||||
|
@ -142,6 +125,50 @@ default
|
|||
GetArbitraryData(i, HEADER+"Enter the name you want displayed on the panel. This is useful when Unicode is showing as question marks. Please only input ASCII.\n \n* To clear the current preference, submit the leave the box empty and hit submit.", "main~name");
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
MainMenu(i);
|
||||
llSay(0, "Button : "+sButton+" not implemented");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "menu~utils": {
|
||||
switch(sButton) {
|
||||
|
||||
case "-exit-":{
|
||||
llInstantMessage(i, "Menu Closed!");
|
||||
break;
|
||||
}
|
||||
case "Import":{
|
||||
GetArbitraryData(i, IMPORT_MENU_TEXT, "main~import");
|
||||
break;
|
||||
}
|
||||
case "Reboot":{
|
||||
llMessageLinked(LINK_SET, 0x3E, llList2Json(JSON_OBJECT, ["op", "reboot"]), i);
|
||||
break;
|
||||
}
|
||||
case "PermaLease":{
|
||||
llMessageLinked(LINK_SET, 0x3E, llList2Json(JSON_OBJECT, ["op", "perma"]), i);
|
||||
break;
|
||||
}
|
||||
case "*RESET*":{
|
||||
llMessageLinked(LINK_SET, 0x3E, llList2Json(JSON_OBJECT, ["op", "reset"]), i);
|
||||
llResetScript();
|
||||
break;
|
||||
}
|
||||
case "main..": {
|
||||
MainMenu(i);
|
||||
break;
|
||||
}
|
||||
case "MemStick":{
|
||||
llGiveInventory(i,"Stall Board Flash Drive [ZNI]");
|
||||
break;
|
||||
}
|
||||
case "Export":{
|
||||
llWhisper(5, llList2Json(JSON_OBJECT,["cmd","set_memstick","leasee",g_kLeasedTo,"expire_time",g_iExpireAt,"texture",g_kTexture,"owner",g_kOwner]));
|
||||
break;
|
||||
}
|
||||
case Checkbox(bool(g_iMask & MASK_WHITEFRAME), "White Frame"):{
|
||||
g_iMask = mask(TOGGLE, g_iMask, MASK_WHITEFRAME);
|
||||
|
||||
|
@ -151,10 +178,6 @@ default
|
|||
|
||||
break;
|
||||
}
|
||||
case "Reboot":{
|
||||
llMessageLinked(LINK_SET, 0x3E, llList2Json(JSON_OBJECT, ["op", "reboot"]), "");
|
||||
break;
|
||||
}
|
||||
case Checkbox(bool(g_iMask & MASK_LOGO),"Logo"):{
|
||||
g_iMask = mask(TOGGLE, g_iMask, MASK_LOGO);
|
||||
|
||||
|
@ -178,11 +201,6 @@ default
|
|||
Menu(i, "Pick a color, or enter a custom one", ["colormenu"], "CTxt");
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
MainMenu(i);
|
||||
llSay(0, "Button : "+sButton+" not implemented");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue