Version 1.0.0.0008
This commit is contained in:
parent
281b7f6e8a
commit
b969d852f0
6 changed files with 379 additions and 121 deletions
|
@ -12,34 +12,36 @@ DecksMenu(key id){
|
|||
}
|
||||
g_iDecksChan = llRound(llFrand(5483785));
|
||||
g_iDecksListen = llListen(g_iDecksChan, "", llDetectedKey(0), "");
|
||||
llDialog(id, "[Cards Against Humanity]\n© LS Bionics 2020\n\nSelect the decks you wish to modify, when finished, select 'CONFIRM' to lock in your choices and combine the decks for use", Buttons+["CONFIRM", "LOAD"], g_iDecksChan);
|
||||
llDialog(id, "[Cards Against Humanity]\n© ZNI 2021\n\nSelect the decks you wish to modify, when finished, select 'CONFIRM' to lock in your choices and combine the decks for use", Buttons+["CONFIRM", "LOAD"], g_iDecksChan);
|
||||
}
|
||||
string cbox(integer a, string b){
|
||||
if(a)return "[X] "+b;
|
||||
else return "[ ] "+b;
|
||||
}
|
||||
|
||||
UploadCards(list lTmp){
|
||||
|
||||
while(llGetListLength(lTmp)){
|
||||
// send card back to server
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=INSERT&CARD_TEXT="+llEscapeURL(llJsonGetValue(llList2String(lTmp, 0), ["card", "text"]))+"&TABLE_ID="+(string)g_kID, "POST");
|
||||
lTmp = llDeleteSubList(lTmp, 0,0);
|
||||
}
|
||||
}
|
||||
|
||||
key g_kID;
|
||||
integer g_iDecksChan;
|
||||
integer g_iDecksListen=-1;
|
||||
UpDecks(){
|
||||
list lAct;
|
||||
integer i=0;
|
||||
integer end = llGetListLength(g_lSelectedDecks);
|
||||
for(i=0;i<end;i+=2){
|
||||
if((integer)llList2String(g_lSelectedDecks,i+1)) lAct += llList2String(g_lSelectedDecks,i);
|
||||
|
||||
}
|
||||
if(llGetListLength(lAct)==0) llMessageLinked(LINK_SET, 50, "", "1");
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=SET_OPTIONS&TABLE_ID="+(string)g_kID+"&DECK="+llEscapeURL(llStringToBase64(llDumpList2String(lAct, "~"))), "POST");
|
||||
if(llGetListLength(g_lSelectedDecks)==0) llMessageLinked(LINK_SET, 50, "", "1");
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=SET_OPTIONS&TABLE_ID="+(string)g_kID+"&DECK="+llEscapeURL(llStringToBase64(llDumpList2String(g_lSelectedDecks, "~"))), "POST");
|
||||
}
|
||||
|
||||
|
||||
|
||||
string g_sVersion = "1.0.0.0000";
|
||||
integer DEBUG = FALSE;
|
||||
integer DEBUG = TRUE;
|
||||
list g_lReqs;
|
||||
string URL = "https://api.zontreck.dev/ls_bionics";
|
||||
string URL = "https://api.zontreck.dev/zni";
|
||||
Send(string Req,string method){
|
||||
g_lReqs += [Req,method];
|
||||
Sends();
|
||||
|
@ -64,24 +66,29 @@ DoNextRequest(){
|
|||
}
|
||||
|
||||
integer g_iStarted;
|
||||
integer g_iExpectDeckLoad=0;
|
||||
integer ingredient_channel = -8392888;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry(){
|
||||
|
||||
llSetMemoryLimit(35000);
|
||||
g_kID = (key)llGetObjectDesc();
|
||||
llWhisper(0, "Decks Handler ("+(string)llGetFreeMemory()+"b)");
|
||||
llListen(ingredient_channel+1, "", "", "");
|
||||
}
|
||||
|
||||
link_message(integer s,integer n,string m,key i){
|
||||
if(n == 0){
|
||||
Send("/Get_Product_Data.php?PRODUCT=CAH_TABLE&NICKNAME=License&KEYID="+(string)i, "GET");
|
||||
} else if(n==-1)llResetScript();
|
||||
else if(n == 5){
|
||||
else if(n == -5){
|
||||
g_lSelectedDecks+=[m,1];
|
||||
UpDecks();
|
||||
} else if(n == 11){
|
||||
} else if(n == -11){
|
||||
g_iStarted=1;
|
||||
} else if(n == -12){
|
||||
UploadCards(llJson2List(m));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,6 +115,13 @@ default
|
|||
}
|
||||
}
|
||||
http_response(key r,integer s,list m, string b){
|
||||
//llOwnerSay(b);
|
||||
if(s!=200){
|
||||
llSay(0, "Error code :"+(string)s);
|
||||
g_kCurrentReq=NULL_KEY;
|
||||
Sends();
|
||||
return;
|
||||
}
|
||||
if(r == g_kCurrentReq){
|
||||
if(s!=200){
|
||||
llMessageLinked(LINK_SET, 50, "", "3");
|
||||
|
@ -135,12 +149,16 @@ default
|
|||
g_lSelectedDecks = llParseString2List(llList2String(lTmp,1),["~"],[]);
|
||||
if(llList2String(lTmp,1) == "0"){
|
||||
g_lSelectedDecks = ["OFFICIAL",1];
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=SET_OPTIONS&DECK="+llEscapeURL(llStringToBase64("OFFICIAL"))+"&TABLE_ID="+(string)g_kID,"POST");
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=SET_OPTIONS&DECK="+llEscapeURL(llStringToBase64("OFFICIAL~1"))+"&TABLE_ID="+(string)g_kID,"POST");
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=OPTIONS&TABLE_ID="+(string)g_kID, "GET");
|
||||
|
||||
} else {
|
||||
llMessageLinked(LINK_SET,1,llDumpList2String(g_lSelectedDecks,"~"),"");
|
||||
llMessageLinked(LINK_SET,999,"","");
|
||||
}
|
||||
|
||||
} else if(Script == "Set_Card_Options"){
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=OPTIONS&TABLE_ID="+(string)g_kID,"GET");
|
||||
}
|
||||
|
||||
Sends();
|
||||
|
@ -152,6 +170,12 @@ default
|
|||
llMessageLinked(LINK_SET,-2,"","");
|
||||
llSetTimerEvent(0);
|
||||
}
|
||||
Sends();
|
||||
|
||||
if(llGetTime()>=15.0 && g_iExpectDeckLoad){
|
||||
g_iExpectDeckLoad=0;
|
||||
llWhisper(0, "No nearby deck found");
|
||||
}
|
||||
}
|
||||
|
||||
listen(integer c,string n,key i,string m){
|
||||
|
@ -174,7 +198,10 @@ default
|
|||
|
||||
llSetTimerEvent(5);
|
||||
} else if(m == "LOAD"){
|
||||
llMessageLinked(LINK_SET,10,"","");
|
||||
g_iExpectDeckLoad=1;
|
||||
llResetTime();
|
||||
llSay(ingredient_channel, "scan");
|
||||
llSetTimerEvent(1);
|
||||
return;
|
||||
} else llMessageLinked(LINK_SET, 50, "", "7");
|
||||
} else {
|
||||
|
@ -183,6 +210,18 @@ default
|
|||
|
||||
|
||||
DecksMenu(i);
|
||||
} else if(c==ingredient_channel+1){
|
||||
if(m == "rezzed Deck" || m == "Deck"){
|
||||
if(g_iExpectDeckLoad){
|
||||
g_iExpectDeckLoad = 0;
|
||||
string Deck = llList2String(llGetObjectDetails(i,[OBJECT_DESC]),0);
|
||||
llWhisper(0, "Activating deck...");
|
||||
llMessageLinked(LINK_SET,-5,Deck,"");
|
||||
llRegionSayTo(i, ingredient_channel, (string)i);
|
||||
|
||||
llWhisper(0, "Deck activated!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,10 @@ s(string m){
|
|||
llInstantMessage(g_kUser,m);
|
||||
}
|
||||
list g_lCards;
|
||||
integer g_iPoints = 0;
|
||||
Cards(){
|
||||
if(!llGetAttached())return;
|
||||
llMessageLinked(LINK_SET,0,"<!c=magenta>Points: <!c=black>"+(string)g_iPoints, "fw_data : point_text");
|
||||
//if(!llGetAttached())return;
|
||||
integer x = 0;
|
||||
integer e = 10;
|
||||
integer CurCard = 1;
|
||||
|
@ -40,6 +42,7 @@ Cards(){
|
|||
CurCard++;
|
||||
}
|
||||
|
||||
|
||||
if(NCard>0){
|
||||
integer CardsToRequest = NCard;
|
||||
if(CardsToRequest>0)CardsToRequest=1;
|
||||
|
@ -69,16 +72,16 @@ POS2(){
|
|||
}
|
||||
|
||||
list g_lSelected = [];
|
||||
list g_lActualCards = [1, 23,
|
||||
2, 44,
|
||||
3, 65,
|
||||
4, 86,
|
||||
5, 107,
|
||||
6, 128,
|
||||
7, 149,
|
||||
8, 170,
|
||||
9, 191,
|
||||
10, 212
|
||||
list g_lActualCards = [1, 26,
|
||||
2, 47,
|
||||
3, 68,
|
||||
4, 89,
|
||||
5, 110,
|
||||
6, 131,
|
||||
7, 152,
|
||||
8, 173,
|
||||
9, 194,
|
||||
10, 215
|
||||
];
|
||||
|
||||
Highlight(){
|
||||
|
@ -102,6 +105,8 @@ integer g_iSelectNum=0;
|
|||
integer g_iCanSelect=0;
|
||||
integer g_iListen=-1;
|
||||
integer g_iChan;
|
||||
integer g_iUsePoint=0;
|
||||
|
||||
|
||||
ShowPrompt(){
|
||||
if(g_iListen==-1){
|
||||
|
@ -122,6 +127,8 @@ czar(string m){
|
|||
llMessageLinked(LINK_SET,0,"<!c=white>Pick ("+(string)num+")\nDraw ("+(string)num+")", "fw_data : czarcard_helpertext");
|
||||
}
|
||||
}
|
||||
|
||||
integer g_iOldSel=0;
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -137,8 +144,9 @@ default
|
|||
//g_lSelected = [5, 7, 1];
|
||||
Highlight();
|
||||
|
||||
llSetLinkColor(2, <0.078, 0.078, 0.078>, 0);
|
||||
llSetLinkColor(2, <0.078, 0.078, 0.078>, 1);
|
||||
llSetLinkColor(6, <0.078, 0.078, 0.078>, 0);
|
||||
llSetLinkColor(6, <0.078, 0.078, 0.078>, 1);
|
||||
llSetLinkColor(2, <1,1,1>,ALL_SIDES );
|
||||
}
|
||||
|
||||
on_rez(integer t){
|
||||
|
@ -171,14 +179,19 @@ default
|
|||
if(llGetListLength(g_lCards)<10 && llListFindList(g_lCards,[llJsonGetValue(m,["card"])])==-1){
|
||||
g_lCards += llJsonGetValue(m,["card"]);
|
||||
s("Added card: "+llJsonGetValue(m,["card", "text"]));
|
||||
g_iPoints = (integer)llJsonGetValue(m,["points"]);
|
||||
Cards();
|
||||
}
|
||||
}
|
||||
} else if(llJsonGetValue(m,["type"]) == "select"){
|
||||
if(g_kTable != (key)llJsonGetValue(m,["table"]))return;
|
||||
if(llJsonValueType(m,["points", (string)g_kUser])!=JSON_INVALID){
|
||||
g_iPoints=(integer)llJsonGetValue(m,["points", (string)g_kUser]);
|
||||
}
|
||||
if(llJsonGetValue(m,["czar"]) == (string)g_kUser){
|
||||
s("You are the Card Czar, hiding the HUD");
|
||||
g_iCanSelect=0;
|
||||
//g_iPoints = (integer)llJsonGetValue(m,["points"]);
|
||||
Cards();
|
||||
POS2();
|
||||
} else {
|
||||
|
@ -187,6 +200,7 @@ default
|
|||
Highlight();
|
||||
s("Select ("+(string)g_iSelectNum+") cards to submit");
|
||||
s("Card czar: secondlife:///app/agent/"+llJsonGetValue(m,["czar"])+"/about");
|
||||
//g_iPoints = (integer)llJsonGetValue(m,["points"]);
|
||||
Cards();
|
||||
g_iCanSelect=1;
|
||||
POS();
|
||||
|
@ -224,6 +238,10 @@ default
|
|||
integer x = 0;
|
||||
integer end = llGetListLength(g_lSelected);
|
||||
string sActualCardData;
|
||||
if(g_iUsePoint){
|
||||
g_iOldSel=g_iSelectNum;
|
||||
g_iSelectNum=end;
|
||||
}
|
||||
if(end == 0 || end!= g_iSelectNum){
|
||||
s("You must select "+(string)g_iSelectNum+" cards!");
|
||||
}else {
|
||||
|
@ -250,19 +268,52 @@ default
|
|||
Highlight();
|
||||
Cards();
|
||||
//llSay(0, "(DEBUG) Sending card(s) to table: "+sActualCardData);
|
||||
llRegionSayTo(g_kActualTable, hud_channel, llList2Json(JSON_OBJECT, ["type", "cards", "cards", sActualCardData]));
|
||||
POS2();
|
||||
if(!g_iUsePoint){
|
||||
llRegionSayTo(g_kActualTable, hud_channel, llList2Json(JSON_OBJECT, ["type", "cards", "cards", sActualCardData]));
|
||||
|
||||
POS2();
|
||||
}
|
||||
else{
|
||||
g_iPoints--;
|
||||
llSetLinkColor(2, <1,1,1>,ALL_SIDES );
|
||||
g_iUsePoint=0;
|
||||
llRegionSayTo(g_kActualTable, hud_channel, llList2Json(JSON_OBJECT, ["type", "use_point", "cards", sActualCardData]));
|
||||
Cards();
|
||||
g_iSelectNum=g_iOldSel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
touch_start(integer t){
|
||||
if(DEBUG)llSay(0, "TOUCHED NUMBER: "+(string)llDetectedLinkNumber(0));
|
||||
if(llGetLinkName(llDetectedLinkNumber(0)) == "Use Point"){
|
||||
// activate card selector
|
||||
if(!g_iUsePoint){
|
||||
llSetLinkColor( llDetectedLinkNumber(0), <1,0,0>,ALL_SIDES );
|
||||
if(g_iPoints >0){
|
||||
llDialog(llGetOwner(), "Select the card(s) you wish to return to the deck. You may return as many cards to the deck as you would like, you will then re-draw cards. This will cost you precisely (1) point.", ["-exit-"], -99);
|
||||
g_iUsePoint=1;
|
||||
return;
|
||||
} else {
|
||||
llDialog(llGetOwner(), "ERROR: You do not have any points to exchange!", ["-exit-"], -99);
|
||||
g_iUsePoint=0;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
llDialog(llGetOwner(), "Points will not be redeemed. Cancelling selection process", ["-exit-"],-99);
|
||||
g_iUsePoint=0;
|
||||
g_lSelected=[];
|
||||
Highlight();
|
||||
llSetLinkColor( llDetectedLinkNumber(0), <1,1,1>,ALL_SIDES );
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(g_iCanSelect){
|
||||
llMessageLinked(LINK_SET,0,llGetLinkName(llDetectedLinkNumber(0)),"fw_touchquery : "+(string)llDetectedLinkNumber(0) + ":" + (string)llDetectedTouchFace(0));
|
||||
}else s("You can't select a card right now");
|
||||
|
||||
//if(DEBUG)llSay(0, "TOUCHED NUMBER: "+(string)llDetectedLinkNumber(0));
|
||||
}
|
||||
|
||||
run_time_permissions(integer p){
|
||||
|
@ -287,7 +338,20 @@ default
|
|||
if(i=="fw_ready"){
|
||||
llMessageLinked(LINK_SET,0,"c=black", "fw_conf");
|
||||
g_lCards=[];
|
||||
/*g_lCards +=llList2Json(JSON_OBJECT, ["text", "This is test "+(string)llFrand(4382438)]);
|
||||
g_lCards +=llList2Json(JSON_OBJECT, ["text", "This is test "+(string)llFrand(4382438)]);
|
||||
g_lCards +=llList2Json(JSON_OBJECT, ["text", "This is test "+(string)llFrand(4382438)]);
|
||||
g_lCards +=llList2Json(JSON_OBJECT, ["text", "This is test "+(string)llFrand(4382438)]);
|
||||
g_lCards +=llList2Json(JSON_OBJECT, ["text", "This is test "+(string)llFrand(4382438)]);
|
||||
g_lCards +=llList2Json(JSON_OBJECT, ["text", "This is test "+(string)llFrand(4382438)]);
|
||||
g_lCards +=llList2Json(JSON_OBJECT, ["text", "This is test "+(string)llFrand(4382438)]);
|
||||
g_lCards +=llList2Json(JSON_OBJECT, ["text", "This is test "+(string)llFrand(4382438)]);
|
||||
g_lCards +=llList2Json(JSON_OBJECT, ["text", "This is test "+(string)llFrand(4382438)]);
|
||||
g_lCards +=llList2Json(JSON_OBJECT, ["text", "This is test "+(string)llFrand(4382438)]);
|
||||
|
||||
|
||||
g_iPoints++;
|
||||
g_iCanSelect=1;*/
|
||||
llListen(hud_channel, "", "", "");
|
||||
Cards();
|
||||
POS2();
|
||||
|
@ -307,6 +371,22 @@ default
|
|||
|
||||
ShowPrompt();
|
||||
|
||||
if(g_iUsePoint){
|
||||
integer CardNum = 0;
|
||||
if(rootName=="") CardNum = (integer)llGetSubString(userData, 4,-1);
|
||||
else CardNum = (integer)llList2String(llParseString2List(rootName, ["text"], []), -1);
|
||||
|
||||
if(CardNum ==0)return;
|
||||
integer cardIndex = llListFindList(g_lSelected,[CardNum]);
|
||||
if(cardIndex!=-1){
|
||||
g_lSelected = llDeleteSubList(g_lSelected, cardIndex, cardIndex);
|
||||
}else {
|
||||
g_lSelected += CardNum;
|
||||
}
|
||||
Highlight();
|
||||
return;
|
||||
}
|
||||
|
||||
if(rootName == ""){
|
||||
integer CardNum = (integer)llGetSubString(userData, 4,-1);
|
||||
if(CardNum ==0)return;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
default
|
||||
{
|
||||
state_entry(){
|
||||
llSetMemoryLimit(15000);
|
||||
llSay(0, "Table Messages ready ("+(string)llGetFreeMemory()+"b)");
|
||||
}
|
||||
link_message(integer s,integer n,string m,key i){
|
||||
|
@ -21,9 +22,9 @@ default
|
|||
} else if(val == 5){
|
||||
llWhisper(0, "Downloading list of decks...");
|
||||
} else if(val == 6){
|
||||
llSay(0, "ERROR: No valid license key has been found. Try again later, or contact LS Bionics support\n\n[Error code: "+m+"]");
|
||||
llSay(0, "ERROR: No valid license key has been found. Try again later, or contact ZNI Support\n\n[Error code: "+m+"]");
|
||||
} else if(val == 7){
|
||||
llSay(0, "ERROR WHEN TOGGLING DECK. THIS IS A BUG. REPORT IT TO LS BIONICS (L:644)");
|
||||
llSay(0, "ERROR WHEN TOGGLING DECK. THIS IS A BUG. REPORT IT TO ZNI (L:644)");
|
||||
} else if(val == 8){
|
||||
|
||||
llSay(0, "Shuffling cards for decks: "+m);
|
||||
|
@ -37,7 +38,7 @@ default
|
|||
} else if(val == 12){
|
||||
llWhisper(0, "Stand by...");
|
||||
} else if(val == 13){
|
||||
llSay(0, "First Rez! Thank you for your purchase of an LS Bionics product!\n \n[Generating License Key]");
|
||||
llSay(0, "First Rez! Thank you for your purchase of a ZNI product!\n \n[Generating License Key]");
|
||||
} else if(val == 14){
|
||||
llWhisper(0, "Loaded Settings");
|
||||
} else if(val == 15){
|
||||
|
@ -61,6 +62,12 @@ default
|
|||
} else if(val == 24){
|
||||
|
||||
llWhisper(0, "Card Czar: "+m+" more cards are required");
|
||||
} else if(val == 25){
|
||||
llWhisper(0, "Sorry! secondlife:///app/agent/"+m+"/about please join the game during the judging phase while a card is being selected.");
|
||||
} else if(val == 26){
|
||||
llWhisper(0, "Restarting round, a player left before judging could begin. All submitted cards will be reinserted into the deck and shuffled");
|
||||
} else if(val == 27){
|
||||
llDialog(i, "[ZNI]\nCards Against Humanity\n\nINSTRUCTIONS: Click the card you want to pick twice, once to select, a second time to confirm. If you have to select more than 1 card, you must select the first card first, then the second card. Once the required number of cards have been selected, the others will automatically de-rez and a new black card will be generated.\n\nPlay: "+m+" card(s)", ["-exit-"], -3999);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
72
SOURCE/LSL/Reward.lsl
Normal file
72
SOURCE/LSL/Reward.lsl
Normal file
|
@ -0,0 +1,72 @@
|
|||
|
||||
integer DEBUG = FALSE;
|
||||
list g_lReqs;
|
||||
string URL = "https://api.zontreck.dev/zni";
|
||||
Send(string Req,string method){
|
||||
g_lReqs += [Req,method];
|
||||
Sends();
|
||||
}
|
||||
Sends(){
|
||||
if(g_kCurrentReq == NULL_KEY){
|
||||
DoNextRequest();
|
||||
}
|
||||
//g_lReqs += [llHTTPRequest(URL + llList2String(lTmp,0), [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], llDumpList2String(llList2List(lTmp,1,-1), "?"))];
|
||||
}
|
||||
key g_kCurrentReq = NULL_KEY;
|
||||
DoNextRequest(){
|
||||
if(llGetListLength(g_lReqs)==0)return;
|
||||
list lTmp = llParseString2List(llList2String(g_lReqs,0),["?"],[]);
|
||||
//if(DEBUG)llSay(0, "SENDING "+llList2String(g_lReqs,1)+" REQUEST: "+URL+llList2String(g_lReqs,0));
|
||||
|
||||
string append = "";
|
||||
if(llList2String(g_lReqs,1) == "GET")append = "?"+llDumpList2String(llList2List(lTmp,1,-1),"?");
|
||||
|
||||
g_kCurrentReq = llHTTPRequest(URL + llList2String(lTmp,0) + append, [HTTP_METHOD, llList2String(g_lReqs,1), HTTP_MIMETYPE, "application/x-www-form-urlencoded"], llDumpList2String(llList2List(lTmp,1,-1),"?"));
|
||||
}
|
||||
|
||||
|
||||
key g_kID = NULL_KEY;
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSetMemoryLimit(13000);
|
||||
llWhisper(0, "Game Rewards Ready ("+(string)llGetFreeMemory()+"b Free)");
|
||||
//llMessageLinked(LINK_SET, -30, "10", llGetOwner());
|
||||
}
|
||||
|
||||
http_response(key r,integer s,list m,string b){
|
||||
//llWhisper(0, b);
|
||||
if(r==g_kCurrentReq){
|
||||
g_kCurrentReq=NULL_KEY;
|
||||
g_lReqs=llDeleteSubList(g_lReqs,0,1);
|
||||
|
||||
list lTmp = llParseString2List(b,[";;",";"],[]);
|
||||
if(llList2String(lTmp,0)=="Get_Server_URL"){
|
||||
string URL = llList2String(lTmp,2);
|
||||
llHTTPRequest(URL, [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], llList2Json(JSON_OBJECT, ["product", "Playing Card [ZNI]", "owner", g_kID]));
|
||||
llHTTPRequest(URL, [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], llList2Json(JSON_OBJECT, ["product", "Playing Card [ZNI]", "owner", g_kID]));
|
||||
llMessageLinked(LINK_SET,-2,"","");
|
||||
}
|
||||
|
||||
Sends();
|
||||
}
|
||||
}
|
||||
|
||||
link_message(integer s,integer n,string m,key i){
|
||||
if(n==-30){
|
||||
integer points=(integer)m;
|
||||
if(points>=10){
|
||||
// begin
|
||||
llWhisper(0, "Stand by... sending reward : 2 Blank Cards");
|
||||
g_kID=i;
|
||||
Send("/Get_Server_URL.php?NAME=CRAFT", "GET");
|
||||
}else{
|
||||
llSay(0, "Sorry. A reward can only be sent if you won the game with 10 or more points. Try again next time!");
|
||||
llMessageLinked(LINK_SET,-2,"","");
|
||||
}
|
||||
}else if(n==-1){
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,9 +28,10 @@ list StrideOfList(list src, integer stride, integer start, integer end)
|
|||
|
||||
GiveUserPoint(key kUser){
|
||||
// point list - user, num of points
|
||||
integer index = llListFindList(g_lPoints,[kUser]);
|
||||
integer index = llListFindList(g_lPoints,[(string)kUser]);
|
||||
if(llListFindList(Players,[kUser])==-1)return;// User may have left game, dont give point to dead users
|
||||
if(index == -1){
|
||||
g_lPoints += [kUser, 1];
|
||||
g_lPoints += [(string)kUser, 1];
|
||||
}else {
|
||||
integer curPoint = llList2Integer(g_lPoints,index+1);
|
||||
curPoint++;
|
||||
|
@ -39,6 +40,25 @@ GiveUserPoint(key kUser){
|
|||
UpScores();
|
||||
}
|
||||
|
||||
DeductPoint(key kUser){
|
||||
integer index = llListFindList(g_lPoints,[(string)kUser]);
|
||||
if(llListFindList(Players,[kUser])==-1)return;
|
||||
if(index==-1)return;
|
||||
integer points = llList2Integer(g_lPoints, index+1);
|
||||
points--;
|
||||
g_lPoints = llListReplaceList(g_lPoints,[points], index+1,index+1);
|
||||
|
||||
UpScores();
|
||||
}
|
||||
|
||||
integer GetUserPoints(key kUser)
|
||||
{
|
||||
integer index = llListFindList(g_lPoints,[(string)kUser]);
|
||||
if(llListFindList(Players,[kUser])==-1)return 0;
|
||||
if(index==-1)return 0;
|
||||
return llList2Integer(g_lPoints,index+1);
|
||||
}
|
||||
|
||||
SetupDeck(){
|
||||
string deckStr;
|
||||
list decks;
|
||||
|
@ -72,6 +92,7 @@ UpScores(){
|
|||
for(i=0;i<end;i+=2){
|
||||
sScores += llKey2Name(llList2String(g_lPoints, i))+": "+llList2String(g_lPoints,i+1)+"\n";
|
||||
}
|
||||
//llSay(0, sScores);
|
||||
llSetLinkPrimitiveParams(iScores, [PRIM_TEXT, sScores, <1,0,0>,1]);
|
||||
}
|
||||
|
||||
|
@ -79,12 +100,14 @@ list g_lJudgePile;
|
|||
integer g_iTotalJudgeUsers;
|
||||
list g_lSelectedDecks = ["OFFICIAL",1];
|
||||
|
||||
string g_sVersion = "1.0.0.0005";
|
||||
|
||||
integer g_iCzar;
|
||||
string g_sVersion = "1.0.0.0008";
|
||||
key g_kToken;
|
||||
integer DEBUG = FALSE;
|
||||
float offset;
|
||||
integer DEBUG = FALSE;
|
||||
list g_lReqs;
|
||||
string URL = "https://api.zontreck.dev/ls_bionics";
|
||||
string URL = "https://api.zontreck.dev/zni";
|
||||
Send(string Req,string method){
|
||||
g_lReqs += [Req,method];
|
||||
Sends();
|
||||
|
@ -95,8 +118,6 @@ Sends(){
|
|||
}
|
||||
//g_lReqs += [llHTTPRequest(URL + llList2String(lTmp,0), [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], llDumpList2String(llList2List(lTmp,1,-1), "?"))];
|
||||
}
|
||||
|
||||
integer g_iCzar;
|
||||
key g_kCurrentReq = NULL_KEY;
|
||||
DoNextRequest(){
|
||||
if(llGetListLength(g_lReqs)==0)return;
|
||||
|
@ -128,7 +149,7 @@ REZ(key i){
|
|||
if(g_iBlockRez)return;
|
||||
integer chan = llRound(llFrand(548937));
|
||||
|
||||
llRezObject("Cards Against Humanity HUD [LS]", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, chan);
|
||||
llRezObject("Cards Against Humanity HUD [ZNI]", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, chan);
|
||||
|
||||
g_lPending += [i, chan];
|
||||
|
||||
|
@ -158,12 +179,21 @@ Rescan(){
|
|||
//llSay(0, "Discover: Avatar ID : secondlife:///app/agent/"+(string)llGetLinkKey(i)+"/about");
|
||||
list ChairParams = llGetLinkPrimitiveParams(Chair, [PRIM_POS_LOCAL, PRIM_DESC]);
|
||||
list ChairData = llParseString2List(llList2String(ChairParams,1), ["`"],[]);
|
||||
Players += llGetLinkKey(i);
|
||||
|
||||
if(llListFindList(OldPlayers, [llGetLinkKey(i)])==-1){
|
||||
llMessageLinked(LINK_SET, 50, (string)llGetLinkKey(i), "9");
|
||||
llInstantMessage(llGetLinkKey(i), "Rezzing a HUD. Please accept attachment permissions");
|
||||
REZ(llGetLinkKey(i));
|
||||
}
|
||||
if(g_iJudging || !g_iStarted){
|
||||
llMessageLinked(LINK_SET, 50, (string)llGetLinkKey(i), "9");
|
||||
llInstantMessage(llGetLinkKey(i), "Rezzing a HUD. Please accept attachment permissions");
|
||||
REZ(llGetLinkKey(i));
|
||||
|
||||
Players += llGetLinkKey(i);
|
||||
}else{
|
||||
llMessageLinked(LINK_SET,50, (string)llGetLinkKey(i), "25");
|
||||
ToEvict += [llGetLinkKey(i)];
|
||||
//return;
|
||||
}
|
||||
}else
|
||||
Players += llGetLinkKey(i);
|
||||
llSetLinkPrimitiveParams(i, [PRIM_POS_LOCAL, llList2Vector(ChairParams,0)+<0,0,1>+(vector)llList2String(ChairData,1), PRIM_ROT_LOCAL, llEuler2Rot((vector)llList2String(ChairData,0)*DEG_TO_RAD)]);
|
||||
}
|
||||
}
|
||||
|
@ -189,15 +219,44 @@ Compare(list OldList){
|
|||
llMessageLinked(LINK_SET, 50, llList2String(OldList,i), "11");
|
||||
//llMessageLinked(LINK_SET, 50, "", "11");
|
||||
|
||||
integer pointIndex = llListFindList(g_lPoints, [llList2Key(OldList,i)]);
|
||||
integer pointIndex = llListFindList(g_lPoints, [llList2String(OldList,i)]);
|
||||
if(pointIndex!=-1){
|
||||
g_lPoints=llDeleteSubList(g_lPoints, pointIndex,pointIndex+1);
|
||||
}
|
||||
|
||||
if(!g_iJudging){
|
||||
llRegionSay(card_channel, llList2Json(JSON_OBJECT, ["type", "die", "table", g_kID]));
|
||||
llMessageLinked(LINK_SET, 50, "", "26");
|
||||
|
||||
g_iTotalJudgeUsers=0;
|
||||
|
||||
|
||||
|
||||
// "card structure in g_lJudgePile list"
|
||||
// {"user": <uuid>, "card": { "text": "data" } }
|
||||
|
||||
|
||||
if(!g_iHaiku){
|
||||
integer boot = llRound(llFrand(43857483));
|
||||
g_lPendingCards = [boot,"null|black"];
|
||||
while(llGetListLength(g_lJudgePile)){
|
||||
// send card back to server
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=INSERT&CARD_TEXT="+llEscapeURL(llJsonGetValue(llList2String(g_lJudgePile, 0), ["card", "text"]))+"&TABLE_ID="+(string)g_kID, "POST");
|
||||
g_lJudgePile = llDeleteSubList(g_lJudgePile, 0,0);
|
||||
}
|
||||
llRezObject("Playing Card [ZNI]", llGetPos(), ZERO_VECTOR,ZERO_ROTATION,boot);
|
||||
}else{
|
||||
llMessageLinked(LINK_SET, 50, "", "21");
|
||||
llSay(hud_channel, llList2Json(JSON_OBJECT, ["type", "die", "table", g_kID, "avatar", llList2Key(OldList,i)]));
|
||||
}
|
||||
}
|
||||
|
||||
llSay(hud_channel, llList2Json(JSON_OBJECT, ["type","die","table",g_kID,"avatar", llList2Key(OldList,i)]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Evict(list lLst){
|
||||
integer i=0;
|
||||
integer end = llGetListLength(lLst);
|
||||
|
@ -214,10 +273,35 @@ key g_kCurrentBlackCard;
|
|||
list g_lPendingCards;
|
||||
integer g_iHaiku;
|
||||
integer g_iCurRow=1;
|
||||
integer g_iJudging=0;
|
||||
|
||||
AddLogEntry(string from, string to, integer cost, string notes){
|
||||
Send("/Logger.php?LOG_TYPE=ADD&ORIGIN="+llEscapeURL(from)+"&DESTINATION="+llEscapeURL(to)+"&PRICE="+(string)cost+"&NOTES="+llStringToBase64(notes), "POST");
|
||||
}
|
||||
|
||||
CheckForJudging(){
|
||||
if(g_iTotalJudgeUsers == llGetListLength(Players)-1){
|
||||
g_iJudging=1;
|
||||
llSay(hud_channel, llList2Json(JSON_OBJECT, ["type", "judging", "table", g_kID]));
|
||||
llSay(0, "Card Czar: Pick the card you want!");
|
||||
llMessageLinked(LINK_SET, 27, (string)g_iSelectNum, llList2Key(Players,g_iCzar));
|
||||
// Initiate the rezzing procedure
|
||||
integer x =0;
|
||||
integer e = llGetListLength(g_lJudgePile);
|
||||
g_lJudgePile = llListRandomize(g_lJudgePile, 1);
|
||||
for(x=0;x<e;x++){
|
||||
integer bootNum = llRound(llFrand(34857483))+llRound(llFrand(45372));
|
||||
string json = llList2String(g_lJudgePile, x);
|
||||
key user = llJsonGetValue(json, ["user"]);
|
||||
g_lPendingCards += [bootNum, (string)user+"|"+llJsonGetValue(json,["text"])];
|
||||
g_lJudgePile = llDeleteSubList(g_lJudgePile,x,x);
|
||||
x=-1;
|
||||
e=llGetListLength(g_lJudgePile);
|
||||
|
||||
llRezObject("Playing Card [ZNI]", llGetPos(), ZERO_VECTOR,ZERO_ROTATION, bootNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -232,7 +316,7 @@ default
|
|||
integer end = llGetNumberOfPrims();
|
||||
for(i=0;i<=end;i++){
|
||||
string name = llGetLinkName(i);
|
||||
if(name == "Chair [LS]"){
|
||||
if(name == "Chair [ZNI]"){
|
||||
Chairs += i;
|
||||
}
|
||||
}
|
||||
|
@ -263,9 +347,17 @@ default
|
|||
|
||||
|
||||
llMessageLinked(LINK_SET, 0, "", g_kID);
|
||||
|
||||
//llMessageLinked(LINK_SET,50, llGetOwner(), "25");
|
||||
}
|
||||
|
||||
http_response(key r,integer s,list m,string b){
|
||||
if(s==499){
|
||||
g_kCurrentReq=NULL_KEY;
|
||||
llSay(0, "499 error, retry");
|
||||
Sends();
|
||||
return;
|
||||
}
|
||||
if(r==g_kCurrentReq){
|
||||
g_kCurrentReq = NULL_KEY;
|
||||
|
||||
|
@ -282,7 +374,7 @@ default
|
|||
g_kID = llGenerateKey();
|
||||
llSetObjectDesc((string)g_kID);
|
||||
llMessageLinked(LINK_SET, 50, "", "13");
|
||||
llSetObjectName("Cards Against Humanity [LS]");
|
||||
llSetObjectName("Cards Against Humanity [ZNI]");
|
||||
Send("/Put_Product_Data.php?PRODUCT=CAH_TABLE&KEYID="+(string)g_kID+"&NICKNAME=License&DATA=1", "POST");
|
||||
llResetScript();
|
||||
} else if(m == "Upgrade"){
|
||||
|
@ -316,23 +408,28 @@ default
|
|||
state active
|
||||
{
|
||||
state_entry(){
|
||||
llSay(0, "Game Table now ready ("+(string)llGetFreeMemory()+"b)");
|
||||
SetupDeck();
|
||||
g_iBlockRez=0;
|
||||
g_lPending=[];
|
||||
|
||||
llSay(card_channel, llList2Json(JSON_OBJECT, ["type", "die", "table", g_kID]));
|
||||
llListen(hud_channel, "", "", "");
|
||||
llListen(ingredient_channel+1, "", "", "");
|
||||
llListen(updater_channel, "", "", "");
|
||||
llListen(card_channel, "", "", "");/*
|
||||
integer chan = llRound(llFrand(548378));
|
||||
g_lPendingCards += [chan, "null|black"];
|
||||
llRezObject("Playing Card [LS]", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, chan);*/
|
||||
|
||||
llSay(0, "Game Table now ready ("+(string)llGetFreeMemory()+"b)");
|
||||
}
|
||||
|
||||
http_response(key r,integer s,list m,string b){
|
||||
if(s!=200){
|
||||
llSay(0, "Error code :"+(string)s);
|
||||
g_kCurrentReq=NULL_KEY;
|
||||
Sends();
|
||||
return;
|
||||
}
|
||||
if(r==g_kCurrentReq){
|
||||
g_kCurrentReq = NULL_KEY;
|
||||
g_lReqs = llDeleteSubList(g_lReqs,0,1);
|
||||
|
@ -356,7 +453,7 @@ state active
|
|||
integer num_req = (integer)llJsonGetValue(llList2String(Params,i),["num"]);
|
||||
integer rezzed = (integer)llJsonGetValue(llList2String(Params,i), ["rezzed"]);
|
||||
if(rezzed==0)
|
||||
llRegionSayTo(Sender, hud_channel, llList2Json(JSON_OBJECT, ["type", "card", "avatar", llGetOwnerKey(Sender), "card", llList2Json(JSON_OBJECT, ["text", llJsonGetValue(llList2String(Params,i), ["text"])])]));
|
||||
llRegionSayTo(Sender, hud_channel, llList2Json(JSON_OBJECT, ["type", "card", "points", GetUserPoints(llGetOwnerKey(Sender)), "avatar", llGetOwnerKey(Sender), "card", llList2Json(JSON_OBJECT, ["text", llJsonGetValue(llList2String(Params,i), ["text"])])]));
|
||||
else{
|
||||
if(color){
|
||||
g_kCurrentBlackCard = Sender;
|
||||
|
@ -374,7 +471,7 @@ state active
|
|||
key czar = llList2String(Players,g_iCzar);
|
||||
llMessageLinked(LINK_SET, 50, (string)czar, "18");
|
||||
|
||||
llRegionSay(hud_channel, llList2Json(JSON_OBJECT, ["type", "select", "czar", czar, "sel_count", num_req, "table", g_kID]));
|
||||
llRegionSay(hud_channel, llList2Json(JSON_OBJECT, ["type", "select", "czar", czar, "sel_count", num_req, "table", g_kID, "points", llList2Json(JSON_OBJECT, g_lPoints)]));
|
||||
llMessageLinked(LINK_SET, 50, card_text, "19");
|
||||
if(card_text == "Make a haiku.")g_iHaiku=1;
|
||||
|
||||
|
@ -388,14 +485,7 @@ state active
|
|||
llRegionSayTo(Sender, card_channel, llList2Json(JSON_OBJECT, ["type", "set", "card", llList2Json(JSON_OBJECT, ["text", card_text, "color", color, "num", num_req, "czar", llList2String(Players,g_iCzar), "user", llList2String(lTmp,3)])]));
|
||||
}
|
||||
}
|
||||
} else if(Script == "Modify_Card"){
|
||||
string Sender = llList2String(lTmp,6);
|
||||
string Color = llList2String(lTmp,2);
|
||||
string Text = llBase64ToString(llList2String(lTmp,3));
|
||||
integer num = llList2Integer(lTmp,4);
|
||||
string user = llList2String(lTmp,5);
|
||||
|
||||
//if(DEBUG)llSay(0, "SEARCH RESULT: "+Text);
|
||||
|
||||
} else if(Script == "No More Cards"){
|
||||
|
||||
llMessageLinked(LINK_SET, 50, "", "21");
|
||||
|
@ -404,7 +494,7 @@ state active
|
|||
integer x=0;
|
||||
integer xe = llGetListLength(g_lPoints);
|
||||
for(x=0;x<xe;x++){
|
||||
key User = llList2Key(g_lPoints,x);
|
||||
key User = llList2String(g_lPoints,x);
|
||||
integer points = llList2Integer(g_lPoints,x+1);
|
||||
if(points>iLastHigh){
|
||||
iLastHigh=points;
|
||||
|
@ -413,9 +503,10 @@ state active
|
|||
}
|
||||
|
||||
llSay(0, "WINNER IS: secondlife:///app/agent/"+(string)kLastHigh+"/about with "+(string)iLastHigh+" points total!!");
|
||||
llResetScript();
|
||||
llMessageLinked(LINK_SET, -30, (string)iLastHigh, kLastHigh);
|
||||
//llResetScript();
|
||||
} else if(Script == "Modify_Product"){
|
||||
if(llList2String(lTmp,1)=="Cards Against Humanity [LS]"){
|
||||
if(llList2String(lTmp,1)=="Cards Against Humanity [ZNI]"){
|
||||
if(g_sVersion != llList2String(lTmp,2)){
|
||||
AddLogEntry(llKey2Name(llGetOwner()), "SYSTEM", 0, "Request delivery of product update: "+llGetObjectName());
|
||||
llRegionSayTo(g_kToken,updater_channel,(string)g_kToken);
|
||||
|
@ -428,7 +519,7 @@ state active
|
|||
}
|
||||
} else if(Script == "Get_Server_URL"){
|
||||
if(llList2String(lTmp,1)=="Products"){
|
||||
llHTTPRequest(llList2String(lTmp,2), [HTTP_METHOD,"POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], llList2Json(JSON_OBJECT, ["creator", llGetInventoryCreator(llGetScriptName()), "owner", llGetOwner(), "product", "Cards Against Humanity [LS]"]));
|
||||
llHTTPRequest(llList2String(lTmp,2), [HTTP_METHOD,"POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], llList2Json(JSON_OBJECT, ["creator", llGetInventoryCreator(llGetScriptName()), "owner", llGetOwner(), "product", "Cards Against Humanity [ZNI]"]));
|
||||
state ingred;
|
||||
}
|
||||
}
|
||||
|
@ -461,26 +552,13 @@ state active
|
|||
g_lJudgePile += lCards;
|
||||
g_iTotalJudgeUsers++;
|
||||
|
||||
if(g_iTotalJudgeUsers == llGetListLength(Players)-1){
|
||||
llSay(hud_channel, llList2Json(JSON_OBJECT, ["type", "judging", "table", g_kID]));
|
||||
llSay(0, "Card Czar: Pick the card you want!");
|
||||
llDialog(llList2Key(Players,g_iCzar), "[LS Bionics]\nCards Against Humanity\n\nINSTRUCTIONS: Click the card you want to pick twice, once to select, a second time to confirm. If you have to select more than 1 card, you must select the first card first, then the second card. Once the required number of cards have been selected, the others will automatically de-rez and a new black card will be generated.\n\nPlay: "+(string)g_iSelectNum+" card(s)", ["-exit-"], -3999);
|
||||
// Initiate the rezzing procedure
|
||||
integer x =0;
|
||||
integer e = llGetListLength(g_lJudgePile);
|
||||
g_lJudgePile = llListRandomize(g_lJudgePile, 1);
|
||||
for(x=0;x<e;x++){
|
||||
integer bootNum = llRound(llFrand(34857483))+llRound(llFrand(45372));
|
||||
string json = llList2String(g_lJudgePile, x);
|
||||
key user = llJsonGetValue(json, ["user"]);
|
||||
g_lPendingCards += [bootNum, (string)user+"|"+llJsonGetValue(json,["text"])];
|
||||
g_lJudgePile = llDeleteSubList(g_lJudgePile,x,x);
|
||||
x=-1;
|
||||
e=llGetListLength(g_lJudgePile);
|
||||
|
||||
llRezObject("Playing Card [LS]", llGetPos(), ZERO_VECTOR,ZERO_ROTATION, bootNum);
|
||||
}
|
||||
}
|
||||
CheckForJudging();
|
||||
} else if(llJsonGetValue(m,["type"])=="use_point"){
|
||||
//list lCards = llJson2List(llJsonGetValue(m,["cards"]));
|
||||
llMessageLinked(LINK_SET, -12, llJsonGetValue(m,["cards"]), "");
|
||||
key user = (key)llJsonGetValue(llList2String(llJson2List(llJsonGetValue(m,["cards"])),0),["user"]);
|
||||
//UploadCards(lCards);
|
||||
DeductPoint(user);
|
||||
}
|
||||
} else if(c==card_channel){
|
||||
if(llJsonGetValue(m,["type"])=="alive"){
|
||||
|
@ -495,7 +573,7 @@ state active
|
|||
list lCmd = llParseString2List(pendingCommand, ["|"],[]);
|
||||
|
||||
g_lPendingCards = llDeleteSubList(g_lPendingCards,index,index+1);
|
||||
g_lPendingCards = llListRandomize(g_lPendingCards, 2);
|
||||
//g_lPendingCards = llListRandomize(g_lPendingCards, 2);
|
||||
|
||||
// Calculate position offset
|
||||
if(llList2String(lCmd,0) == "null"){
|
||||
|
@ -546,8 +624,6 @@ state active
|
|||
}
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE="+cmd+"&TABLE_ID="+(string)g_kID+"&COLOR="+color+"&DRAW_COUNT=1&SENDER="+(string)i+"&REZZED=1", "POST");
|
||||
|
||||
|
||||
|
||||
} else if(llJsonGetValue(m,["type"]) == "final"){
|
||||
key kUser = (key)llJsonGetValue(m,["user"]);
|
||||
GiveUserPoint(kUser);
|
||||
|
@ -555,7 +631,8 @@ state active
|
|||
g_iCurRow=1;
|
||||
|
||||
if(g_iSelectNum == 0){
|
||||
|
||||
g_iJudging=0;
|
||||
|
||||
llMessageLinked(LINK_SET, 50, (string)kUser, "23");
|
||||
|
||||
llSay(card_channel, llList2Json(JSON_OBJECT, ["type", "die", "table", g_kID]));
|
||||
|
@ -575,7 +652,7 @@ state active
|
|||
|
||||
g_lJudgePile=[];
|
||||
g_iTotalJudgeUsers=0;
|
||||
llRezObject("Playing Card [LS]", llGetPos(), ZERO_VECTOR,ZERO_ROTATION,boot);
|
||||
llRezObject("Playing Card [ZNI]", llGetPos(), ZERO_VECTOR,ZERO_ROTATION,boot);
|
||||
} else {
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=NULCARD&TABLE_ID="+(string)g_kID,"GET");
|
||||
}
|
||||
|
@ -598,25 +675,14 @@ state active
|
|||
llListenRemove(llList2Integer(g_lListener,index+2));
|
||||
g_lListener=llDeleteSubList(g_lListener,index,index+2);
|
||||
|
||||
} else if(c==ingredient_channel+1){
|
||||
if(m == "rezzed Deck" || m == "Deck"){
|
||||
if(g_iExpectDeckLoad){
|
||||
g_iExpectDeckLoad = 0;
|
||||
string Deck = llList2String(llGetObjectDetails(i,[OBJECT_DESC]),0);
|
||||
llWhisper(0, "Activating deck...");
|
||||
llMessageLinked(LINK_SET,5,Deck,"");
|
||||
llRegionSayTo(i, ingredient_channel, (string)i);
|
||||
|
||||
llWhisper(0, "Deck activated!");
|
||||
}
|
||||
}
|
||||
|
||||
} else if(c == updater_channel){
|
||||
if(m == "scan"){
|
||||
llRegionSayTo(i,c,"reply|CAH");
|
||||
} else if(m == "check"){
|
||||
llWhisper(0, "Checking for update..");
|
||||
g_kToken=i;
|
||||
Send("/Modify_Product.php?NAME="+llEscapeURL("Cards Against Humanity [LS]"), "GET");
|
||||
Send("/Modify_Product.php?NAME="+llEscapeURL("Cards Against Humanity [ZNI]"), "GET");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -635,29 +701,26 @@ state active
|
|||
}
|
||||
|
||||
timer(){
|
||||
Sends();
|
||||
|
||||
if(llGetTime()>=15.0 && g_iExpectDeckLoad){
|
||||
g_iExpectDeckLoad=0;
|
||||
llWhisper(0, "No nearby deck found");
|
||||
}
|
||||
Sends();
|
||||
}
|
||||
|
||||
|
||||
touch_start(integer t){
|
||||
string name = llGetLinkName(llDetectedLinkNumber(0));
|
||||
if(name == "START"){
|
||||
if(g_iStarted)return;
|
||||
g_iStarted=TRUE;
|
||||
llMessageLinked(LINK_SET,11,"","");
|
||||
if(!(llGetListLength(Players) > 1)){
|
||||
llSay(0, "Must have more than 1 player to start!");
|
||||
return;
|
||||
}
|
||||
// Begin the game loop
|
||||
llMessageLinked(LINK_SET,-11,"","");
|
||||
llSetTimerEvent(5);
|
||||
integer chan = llRound(llFrand(548378));
|
||||
g_lPendingCards += [chan, "null|black"];
|
||||
llRezObject("Playing Card [LS]", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, chan);
|
||||
llRezObject("Playing Card [ZNI]", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, chan);
|
||||
} else if(name == "ANIM"){
|
||||
key i = llDetectedKey(0);
|
||||
|
||||
|
@ -677,11 +740,8 @@ state active
|
|||
link_message(integer s,integer n,string m,key i){
|
||||
if(n==-2){
|
||||
llResetScript();
|
||||
} else if(n == 10){
|
||||
g_iExpectDeckLoad=1;
|
||||
llResetTime();
|
||||
llSay(ingredient_channel, "scan");
|
||||
llWhisper(0, "Scanning for a deck of cards");
|
||||
} else if(n == 999){
|
||||
SetupDeck();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ default
|
|||
llMessageLinked(LINK_SET,0,m,"fw_data : card_text");
|
||||
g_sText = m;
|
||||
g_sPath = "/confirm";
|
||||
llDialog(llGetOwner(), "Does this card look correct?\n\nIf you select yes, your card will be uploaded to the community deck for this year. If you decide you no longer wish your card to be uploaded, you will need to contact LS Bionics Support", ["Yes", "No"], g_iChan);
|
||||
llDialog(llGetOwner(), "Does this card look correct?\n\nIf you select yes, your card will be uploaded to the community deck for this year. If you decide you no longer wish your card to be uploaded, you will need to contact ZNI Support", ["Yes", "No"], g_iChan);
|
||||
} else if(g_sPath == "/num_req"){
|
||||
g_iNum = (integer)m;
|
||||
g_sPath = "/text";
|
||||
|
@ -73,11 +73,11 @@ default
|
|||
if(m == "Yes"){
|
||||
llSay(0, "Uploading card...");
|
||||
list dat = llParseString2List(llGetDate(),["-"],[]);
|
||||
llSetObjectName("CAH: "+llList2String(dat,0)+" Playing Card [LS]");
|
||||
llSetObjectName("CAH: "+llList2String(dat,0)+" Playing Card [ZNI]");
|
||||
llSetObjectDesc("Card created by: "+llKey2Name(llGetOwner()));
|
||||
g_kAuthor = llGetOwner();
|
||||
string CARD_ID = (string)llGetOwner()+"-"+(string)llGetUnixTime();
|
||||
llHTTPRequest("https://api.zontreck.dev/ls_bionics/Modify_Card.php", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], "DECK="+llList2String(dat,0)+"&CARD_TEXT="+llStringToBase64(g_sText)+"&COLOR="+(string)g_iColor+"&DRAW_COUNT="+(string)g_iNum+"&CARD_ID="+llEscapeURL(CARD_ID));
|
||||
llHTTPRequest("https://api.zontreck.dev/zni/Modify_Card.php", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], "DECK="+llList2String(dat,0)+"&CARD_TEXT="+llStringToBase64(g_sText)+"&COLOR="+(string)g_iColor+"&DRAW_COUNT="+(string)g_iNum+"&CARD_ID="+llEscapeURL(CARD_ID));
|
||||
state myCard;
|
||||
} else if(m == "No"){
|
||||
llSay(0, "Card creation cancelled! Deleting temp data");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue