Get stuff working... mostly..

This commit is contained in:
zontreck 2024-04-10 08:02:31 -07:00
parent 5d6d24497f
commit e8185bb164

View file

@ -149,9 +149,7 @@ Sends(){
key g_kCurrentReq = NULL_KEY; key g_kCurrentReq = NULL_KEY;
DoNextRequest(){ DoNextRequest(){
if(llGetListLength(g_lReqs)==0)return; if(llGetListLength(g_lReqs)==0)return;
list lTmp = llParseString2List(llList2String(g_lReqs,0),["?"],[]); g_kCurrentReq = llHTTPRequest(API_SERVER + llList2String(g_lReqs,0), [], "");
if(g_iDEV)llSay(0, "SENDING REQUEST: "+API_SERVER+llList2String(g_lReqs,0));
g_kCurrentReq = llHTTPRequest(API_SERVER + llList2String(lTmp,0), [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], llDumpList2String(llList2List(lTmp,1,-1),"?"));
} }
list g_lReqs; list g_lReqs;
@ -164,6 +162,7 @@ checkUpdate()
} }
requestProductServer() requestProductServer()
{ {
} }
@ -288,7 +287,7 @@ default
} }
g_iChn = llRound(llFrand(8574833)); g_iChn = llRound(llFrand(8574833));
g_iLstn = llListen(g_iChn, "", llDetectedKey(0), ""); g_iLstn = llListen(g_iChn, "", llDetectedKey(0), "");
llDialog(llDetectedKey(0), "What mode do you want to set?\n\nCurrent mode: "+g_sCurrentMode, g_lModes+["-exit-"], g_iChn); llDialog(llDetectedKey(0), "What mode do you want to set?\n\nCurrent mode: "+g_sCurrentMode, g_lModes+["-exit-", "chk.update"], g_iChn);
} }
changed(integer c) changed(integer c)
@ -301,10 +300,15 @@ default
http_response(key r, integer s,list m,string b) http_response(key r, integer s,list m,string b)
{ {
if(HasDSRequest(r)!=-1) if(g_kCurrentReq == r)
{ {
DeleteDSReq(r); if(g_iDEV)
{
llSay(0, "Status Code: "+ (string)s+"\n" + b);
}
g_lReqs = llDeleteSubList(g_lReqs,0,0);
list tmp = llParseString2List(b,[";;",";"],[]); list tmp = llParseString2List(b,[";;",";"],[]);
if(llList2String(tmp,0)=="Modify_Product") if(llList2String(tmp,0)=="Modify_Product")
{ {
@ -327,6 +331,9 @@ default
llRemoveInventory(llGetScriptName()); llRemoveInventory(llGetScriptName());
} }
g_kCurrentReq = NULL_KEY;
llSleep(1);
DoNextRequest(); DoNextRequest();
} }
} }
@ -340,7 +347,13 @@ default
return; return;
} else if(m == "chk.update") } else if(m == "chk.update")
{ {
if(initial_start)
{
llRegionSayTo(i, 0, "Startup still in progress. Please wait a moment before trying again");
return;
}
checkUpdate(); checkUpdate();
return;
} }
llDialog(i, "What mode do you want to set?\n\nCurrent mode: "+m, g_lModes+["-exit-"], c); llDialog(i, "What mode do you want to set?\n\nCurrent mode: "+m, g_lModes+["-exit-"], c);
SetMode(m); SetMode(m);