Version 1.0.0.0005

This commit is contained in:
Tara 2022-12-25 12:46:55 -07:00
parent b464adae4a
commit 281b7f6e8a
7 changed files with 502 additions and 71 deletions

Binary file not shown.

View file

@ -1,13 +1,13 @@
integer card_channel = -32988199;
string g_sText;
string g_sText="NA";
integer g_iStart;
key g_kTable;
integer genericListen = -1;
key g_kUser= NULL_KEY;
key g_kCzar = NULL_KEY;
integer g_iInitialized;
integer g_iConfirm;
default
{
@ -29,6 +29,8 @@ default
//llSay(0, "Card is trying to find a table");
llListen(t, "", "", "");
g_iStart=t;
//llSleep(2+llFrand(5));
llSetTimerEvent(1);
llSay(card_channel, llList2Json(JSON_OBJECT, ["type", "alive", "boot", t]));
}
}
@ -47,34 +49,43 @@ default
g_iConfirm++;
if(g_iConfirm==2){
llSay(card_channel, llList2Json(JSON_OBJECT, ["type", "final", "user", g_kUser]));
llSay(card_channel, llList2Json(JSON_OBJECT, ["type", "final", "user", g_kUser, "text", g_sText]));
}
}
}
timer(){
if(llGetTime()>=10.0){
if(llGetTime()>=10.0 && g_iInitialized){
g_iConfirm=0;
llSetColor(ZERO_VECTOR,2);
llSetTexture(TEXTURE_TRANSPARENT,2);
llSetTimerEvent(0);
}
if(!g_iInitialized && llGetTime()>=5.0){
llResetTime();
llSay(card_channel, llList2Json(JSON_OBJECT, ["type", "alive", "boot", g_iStart]));
}
}
listen(integer c,string n,key i,string m){
if(c == g_iStart){
if(llJsonGetValue(m, ["type"]) == "activate"){
llListenRemove(genericListen);
llListen(card_channel, "", i, "");
llMessageLinked(LINK_SET,0,"","fw_reset");
if(llJsonGetValue(m, ["type"]) == "activate" && !g_iInitialized){
g_kTable = (key)llJsonGetValue(m,["table"]);
llListen(card_channel, "", i, "");
llListenRemove(genericListen);
llMessageLinked(LINK_SET,0,"","fw_reset");
g_iInitialized=1;
llSetPos((vector)llJsonGetValue(m,["pos"]));
llSetRot((rotation)llJsonGetValue(m,["rot"]));
}
} else if(c == card_channel){
if(llJsonGetValue(m,["type"]) == "position"){
llSetPos((vector)llJsonGetValue(m,["pos"]));
llSetRot((rotation)llJsonGetValue(m,["rot"]));
} else if(llJsonGetValue(m,["type"]) == "rotation"){
llSetRot((rotation)llJsonGetValue(m,["rot"]));
} else if(llJsonGetValue(m,["type"]) == "set"){
} else if(llJsonGetValue(m,["type"]) == "set" && g_sText == "NA"){
string text = llJsonGetValue(m,["card", "text"]);
integer color = (integer)llJsonGetValue(m,["card","color"]);
integer num = (integer)llJsonGetValue(m,["card", "num"]);

View file

@ -30,7 +30,7 @@ UpDecks(){
if((integer)llList2String(g_lSelectedDecks,i+1)) lAct += llList2String(g_lSelectedDecks,i);
}
if(llGetListLength(lAct)==0) llWhisper(0, "You cannot have no decks selected. The official deck will be automatically used as default when no decks are selected");
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");
}
@ -100,7 +100,7 @@ default
string name = llGetLinkName(llDetectedLinkNumber(0));
if(name == "DECKS"){
if(g_iStarted){
llSay(0, "You cannot change decks while a game is in progress! Stop the game first");
llMessageLinked(LINK_SET, 50, "", "2");
return;
}
DecksMenu(llDetectedKey(0));
@ -109,6 +109,9 @@ default
}
http_response(key r,integer s,list m, string b){
if(r == g_kCurrentReq){
if(s!=200){
llMessageLinked(LINK_SET, 50, "", "3");
}
g_kCurrentReq = NULL_KEY;
g_lReqs = llDeleteSubList(g_lReqs,0,1);
@ -119,13 +122,13 @@ default
string Variable = llList2String(lTmp,1);
if(Variable == "License"){
if(llList2String(lTmp,2) == "1"){
llSay(0, "License is now activated!");
llMessageLinked(LINK_SET, 50, "", "4");
//state active;
llWhisper(0, "Downloading list of decks...");
llMessageLinked(LINK_SET, 50, "", "5");
Send("/Modify_Card.php?TYPE_OVERRIDE=OPTIONS&TABLE_ID="+(string)g_kID, "GET");
//Send("/Get_Product_Data.php?PRODUCT=CAH_TABLE&KEYID="+(string)g_kID+"&NICKNAME=Decks", "GET");
} else {
llSay(0, "ERROR: No valid license key has been found. Try again later, or contact LS Bionics support\n\n[Error code: "+llList2String(lTmp,2)+"]");
llMessageLinked(LINK_SET, 50, llList2String(lTmp,2), "6");
}
}
} else if(Script == "Card_Options"){
@ -173,7 +176,7 @@ default
} else if(m == "LOAD"){
llMessageLinked(LINK_SET,10,"","");
return;
} else llSay(0, "ERROR WHEN TOGGLING DECK. THIS IS A BUG. REPORT IT TO LS BIONICS (L:644)");
} else llMessageLinked(LINK_SET, 50, "", "7");
} else {
g_lSelectedDecks = llListReplaceList(g_lSelectedDecks, [iNewDeck], pos+1,pos+1);
}

View file

@ -7,7 +7,7 @@ integer DEBUG=FALSE;
integer card_channel = -32988199;
integer hud_channel = -328478727;
vector g_vLastPos1 = <0.02395, 0.47113, -0.15166>;
vector g_vLastPos1 = <0.00000, 0.34831, -0.10162>;
s(string m){
llInstantMessage(g_kUser,m);
@ -20,12 +20,12 @@ Cards(){
integer CurCard = 1;
integer NCard = 0;
if(DEBUG)llSay(0, "CARD LIST: "+llDumpList2String(g_lCards, " - "));
//if(DEBUG)llSay(0, "CARD LIST: "+llDumpList2String(g_lCards, " - "));
for(x=0;x<e;x++){
if(llGetListLength(g_lCards) > x){
string card_params = llList2String(g_lCards,x);
if(DEBUG)llSay(0,"Card Parameters: "+card_params);
//if(DEBUG)llSay(0,"Card Parameters: "+card_params);
llMessageLinked(LINK_SET,0,llJsonGetValue(card_params,["text"]), "fw_data : card_text"+(string)CurCard);
if(llStringLength(llJsonGetValue(card_params,["text"]))>128){
@ -69,16 +69,16 @@ POS2(){
}
list g_lSelected = [];
list g_lActualCards = [1, 2,
2, 23,
3, 44,
4, 65,
5, 86,
6, 107,
7, 128,
8, 149,
9, 170,
10, 191
list g_lActualCards = [1, 23,
2, 44,
3, 65,
4, 86,
5, 107,
6, 128,
7, 149,
8, 170,
9, 191,
10, 212
];
Highlight(){
@ -112,6 +112,16 @@ ShowPrompt(){
llDialog(g_kUser, "Do you want to submit your selected card(s)?", ["Yes", "No"], g_iChan);
}
czar(string m){
llMessageLinked(LINK_SET, 0, "<!c=white>"+llJsonGetValue(m,["card"]), "fw_data : czarcard_text");
integer num = (integer)llJsonGetValue(m,["num"]);
if(num==0){
llMessageLinked(LINK_SET,0,"<!c=white>Cards Against Humanity", "fw_data : czarcard_helpertext");
} else {
llMessageLinked(LINK_SET,0,"<!c=white>Pick ("+(string)num+")\nDraw ("+(string)num+")", "fw_data : czarcard_helpertext");
}
}
default
{
state_entry()
@ -126,6 +136,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);
}
on_rez(integer t){
@ -140,7 +153,7 @@ default
}
listen(integer c,string n,key i,string m){
if(DEBUG)llSay(0, m);
//if(DEBUG)llSay(0, m);
if(g_iStartParam == c){
// listen for the UUID of who to attach the HUD to!
if(llJsonGetValue(m,["type"])=="activate"){
@ -165,18 +178,18 @@ default
if(g_kTable != (key)llJsonGetValue(m,["table"]))return;
if(llJsonGetValue(m,["czar"]) == (string)g_kUser){
s("You are the Card Czar, hiding the HUD");
POS2();
g_iCanSelect=0;
Cards();
POS2();
} else {
g_iSelectNum = (integer)llJsonGetValue(m,["sel_count"]);
POS();
g_lSelected=[];
Highlight();
s("Select ("+(string)g_iSelectNum+") cards to submit");
s("Card czar: secondlife:///app/agent/"+llJsonGetValue(m,["czar"])+"/about");
Cards();
g_iCanSelect=1;
POS();
}
} else if(llJsonGetValue(m,["type"]) == "judging"){
if(g_kTable != (key)llJsonGetValue(m,["table"]))return;
@ -191,13 +204,15 @@ default
g_iChan=0;
}
} else if(llJsonGetValue(m,["type"])=="die"){
if(DEBUG)llSay(0, "(DEBUG)\nm: "+m+"\n-> Table: "+(string)g_kTable+"\n-> User: "+(string)g_kUser);
//if(DEBUG)llSay(0, "(DEBUG)\nm: "+m+"\n-> Table: "+(string)g_kTable+"\n-> User: "+(string)g_kUser);
if(llJsonGetValue(m,["table"])==(string)g_kTable){
if(llJsonGetValue(m,["avatar"])==(string)g_kUser || llJsonGetValue(m,["avatar"])==(string)NULL_KEY || llJsonGetValue(m,["avatar"])==""){
llSay(0, "Deactivating HUD");
state detach;
}
}
} else if(llJsonGetValue(m,["type"])=="czar"){
czar(m);
}
} else if(g_iChan == c){
if(m == "No"){
@ -247,7 +262,7 @@ default
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));
//if(DEBUG)llSay(0, "TOUCHED NUMBER: "+(string)llDetectedLinkNumber(0));
}
run_time_permissions(integer p){
@ -278,6 +293,8 @@ default
POS2();
s("HUD initialization completed");
//czar(llList2Json(JSON_OBJECT, ["card", "This is a test", "num", 4]));
}else if (i == "fw_touchreply") {
list tokens = llParseStringKeepNulls(m, [":"], []);
string boxName = llList2String(tokens, 0);

67
SOURCE/LSL/Messages.lsl Normal file
View file

@ -0,0 +1,67 @@
default
{
state_entry(){
llSay(0, "Table Messages ready ("+(string)llGetFreeMemory()+"b)");
}
link_message(integer s,integer n,string m,key i){
if(n == -1)
{
llResetScript();
} else if(n == 50){
integer val = (integer)((string)i);
if(val == 1){
llWhisper(0, "You cannot have no decks selected. The official deck will be automatically used as default when no decks are selected");
} else if(val == 2){
llSay(0, "You cannot change decks while a game is in progress! Stop the game first");
} else if(val == 3){
llSay(0, "Error received while waiting for a response from server");
} else if(val == 4){
llSay(0, "License is now activated!");
} 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+"]");
} else if(val == 7){
llSay(0, "ERROR WHEN TOGGLING DECK. THIS IS A BUG. REPORT IT TO LS BIONICS (L:644)");
} else if(val == 8){
llSay(0, "Shuffling cards for decks: "+m);
} else if(val == 9){
llWhisper(0, "secondlife:///app/agent/"+m+"/about has joined the game!");
} else if(val == 10){
llSay(0, "All players left the game. Resetting game and shuffling cards!");
} else if(val == 11){
llSay(0, "secondlife:///app/agent/"+m+"/about has left the game");
} 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]");
} else if(val == 14){
llWhisper(0, "Loaded Settings");
} else if(val == 15){
llSay(0, "Deck generated with total cards: "+m);
} else if(val == 16){
llSay(0, "A new black card has been played");
} else if(val == 17){
llSay(0, "This is a new game, assigning random card czar");
} else if(val == 18){
llSay(0, "Card Czar is: secondlife:///app/agent/"+m+"/about");
} else if(val == 19){
llSay(0, "Black Card: "+m);
} else if(val == 20){
llSay(0, "(ALERT) The Haiku card has been played. After this round the game will declare the winner(s)");
} else if(val == 21){
llSay(0, "Game over! No more black cards exist in the deck... Checking for winner...");
} else if(val == 22){
llWhisper(0, "Requesting product update delivery");
} else if(val == 23){
llWhisper(0, "secondlife:///app/agent/"+m+"/about receives a point");
} else if(val == 24){
llWhisper(0, "Card Czar: "+m+" more cards are required");
}
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -48,7 +48,7 @@ SetupDeck(){
if((integer)(llList2String(g_lSelectedDecks,i+1)))decks+=llList2String(g_lSelectedDecks,i);
}
deckStr=llDumpList2String(decks, ",");
llSay(0, "Shuffling cards for decks: "+deckStr);
llMessageLinked(LINK_SET, 50, deckStr, "8");
Send("/Modify_Card.php?TYPE_OVERRIDE=MAKE_DECK&TABLE_ID="+(string)g_kID+"&DECKS="+deckStr, "POST");
}
@ -79,7 +79,7 @@ list g_lJudgePile;
integer g_iTotalJudgeUsers;
list g_lSelectedDecks = ["OFFICIAL",1];
string g_sVersion = "1.0.0.0002";
string g_sVersion = "1.0.0.0005";
key g_kToken;
integer DEBUG = FALSE;
float offset;
@ -101,7 +101,7 @@ key g_kCurrentReq = NULL_KEY;
DoNextRequest(){
if(llGetListLength(g_lReqs)==0)return;
list lTmp = llParseString2List(llList2String(g_lReqs,0),["?"],[]);
//if(DEBUG)llSay(0, "SENDING REQUEST: "+URL+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),"?");
@ -160,7 +160,7 @@ Rescan(){
list ChairData = llParseString2List(llList2String(ChairParams,1), ["`"],[]);
Players += llGetLinkKey(i);
if(llListFindList(OldPlayers, [llGetLinkKey(i)])==-1){
llWhisper(0, "secondlife:///app/agent/"+(string)llGetLinkKey(i)+"/about has joined the game!");
llMessageLinked(LINK_SET, 50, (string)llGetLinkKey(i), "9");
llInstantMessage(llGetLinkKey(i), "Rezzing a HUD. Please accept attachment permissions");
REZ(llGetLinkKey(i));
}
@ -172,7 +172,8 @@ Rescan(){
Evict(ToEvict);
if(llGetListLength(Players)==0 && llGetListLength(OldPlayers)!=0){
llSay(0, "All players left the game. Resetting game and shuffling cards!");
llMessageLinked(LINK_SET, 50, "", "10");
llSleep(1);
llResetScript();
}
}
@ -185,7 +186,13 @@ Compare(list OldList){
integer end = llGetListLength(OldList);
for(i=0;i<end;i++){
if(llListFindList(Players,[llList2Key(OldList,i)])==-1){
llSay(0, "secondlife:///app/agent/"+llList2String(OldList,i)+"/about has left the game");
llMessageLinked(LINK_SET, 50, llList2String(OldList,i), "11");
//llMessageLinked(LINK_SET, 50, "", "11");
integer pointIndex = llListFindList(g_lPoints, [llList2Key(OldList,i)]);
if(pointIndex!=-1){
g_lPoints=llDeleteSubList(g_lPoints, pointIndex,pointIndex+1);
}
llSay(hud_channel, llList2Json(JSON_OBJECT, ["type","die","table",g_kID,"avatar", llList2Key(OldList,i)]));
}
}
@ -205,6 +212,8 @@ key g_kID;
integer g_iBlockRez = 0;
key g_kCurrentBlackCard;
list g_lPendingCards;
integer g_iHaiku;
integer g_iCurRow=1;
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");
@ -234,7 +243,7 @@ default
llSetSitText("Play!");
llWhisper(0, "Stand by...");
llMessageLinked(LINK_SET, 50, "", "12");
g_kID = (key)llGetObjectDesc();
if(g_kID == "new_lsk"){
llListen(99, "", llGetOwner(), "");
@ -272,7 +281,7 @@ default
if(m == "New"){
g_kID = llGenerateKey();
llSetObjectDesc((string)g_kID);
llSay(0, "First Rez! Thank you for your purchase of an LS Bionics product!\n \n[Generating License Key]");
llMessageLinked(LINK_SET, 50, "", "13");
llSetObjectName("Cards Against Humanity [LS]");
Send("/Put_Product_Data.php?PRODUCT=CAH_TABLE&KEYID="+(string)g_kID+"&NICKNAME=License&DATA=1", "POST");
llResetScript();
@ -285,7 +294,7 @@ default
} else if(c==ingredient_channel+1){
if(m == "rezzed CAH_TABLE" || m == "CAH_TABLE"){
llSetObjectDesc(llList2String(llGetObjectDetails(i,[OBJECT_DESC]),0));
llWhisper(0, "Loaded Settings");
llMessageLinked(LINK_SET, 50, "", "14");
llRegionSayTo(i, ingredient_channel, (string)i);
llResetScript();
}
@ -332,7 +341,7 @@ state active
//if(DEBUG)llSay(0, "HTTP REPLY: "+b);
string Script = llList2String(lTmp,0);
if(Script == "Modify_Deck"){
llSay(0, "Deck generated with total cards: "+llList2String(lTmp,3));
llMessageLinked(LINK_SET, 50, llList2String(lTmp,3), "15");
} else if(Script == "Get_Card"){
key Sender = (key)llList2String(lTmp,1);
list Params = llJson2List(llBase64ToString(llList2String(lTmp,2)));
@ -351,9 +360,9 @@ state active
else{
if(color){
g_kCurrentBlackCard = Sender;
llSay(0, "A new black card has been played");
llMessageLinked(LINK_SET, 50, "", "16");
if(g_iCzar == -1){
llSay(0, "This is a new game, assigning random card czar");
llMessageLinked(LINK_SET, 50, "", "17");
g_iCzar = llRound(llFrand(llGetListLength(Players)));
} else {
g_iCzar++;
@ -363,9 +372,17 @@ state active
}
key czar = llList2String(Players,g_iCzar);
llSay(0, "Card Czar is: secondlife:///app/agent/"+(string)czar+"/about");
llMessageLinked(LINK_SET, 50, (string)czar, "18");
llRegionSay(hud_channel, llList2Json(JSON_OBJECT, ["type", "select", "czar", czar, "sel_count", num_req, "table", g_kID]));
llMessageLinked(LINK_SET, 50, card_text, "19");
if(card_text == "Make a haiku.")g_iHaiku=1;
if(g_iHaiku){
llMessageLinked(LINK_SET, 50, "", "20");
}
llRegionSay(hud_channel, llList2Json(JSON_OBJECT, ["type", "czar", "card", card_text, "num", num_req]));
g_iSelectNum = num_req;
}
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)])]));
@ -381,7 +398,7 @@ state active
//if(DEBUG)llSay(0, "SEARCH RESULT: "+Text);
} else if(Script == "No More Cards"){
llSay(0, "Game over! No more black cards exist in the deck... Checking for winner...");
llMessageLinked(LINK_SET, 50, "", "21");
integer iLastHigh;
key kLastHigh;
integer x=0;
@ -403,7 +420,7 @@ state active
AddLogEntry(llKey2Name(llGetOwner()), "SYSTEM", 0, "Request delivery of product update: "+llGetObjectName());
llRegionSayTo(g_kToken,updater_channel,(string)g_kToken);
Send("/Get_Server_URL.php?NAME=Products","GET");
llWhisper(0, "Requesting product update delivery");
llMessageLinked(LINK_SET, 50, "", "22");
} else {
llRegionSayTo(g_kToken, updater_channel, "no_update");
llWhisper(0, "I am up to date");
@ -447,16 +464,19 @@ state active
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+" cards", ["-exit-"], -3999);
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));
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);
}
@ -467,6 +487,7 @@ state active
//llSay(0, "IN ALIVE BLOCK");
integer index = llListFindList(g_lPendingCards,[(integer)llJsonGetValue(m,["boot"])]);
if(index==-1){
//llWhisper(0, "Bootup value not found: "+llJsonGetValue(m,["boot"]));
return;
}
@ -474,23 +495,53 @@ state active
list lCmd = llParseString2List(pendingCommand, ["|"],[]);
g_lPendingCards = llDeleteSubList(g_lPendingCards,index,index+1);
g_lPendingCards = llListRandomize(g_lPendingCards, 2);
llRegionSayTo(i, (integer)llJsonGetValue(m,["boot"]), llList2Json(JSON_OBJECT, ["type", "activate", "table", g_kID]));
// Calculate position offset
llSleep(1);
if(llList2String(lCmd,0) == "null"){
offset = 0.0;
}
llRegionSayTo(i, card_channel, llList2Json(JSON_OBJECT, ["type", "position", "pos", llGetPos()+<0,offset,0.75>]));
vector relativeBase = <-0.43321, -0.44624, 0.54937>;
float addtlRowOffset = 0.3;
if(g_iSelectNum>1){
if(g_iCurRow == 1)addtlRowOffset=0;
else
addtlRowOffset = addtlRowOffset * (g_iCurRow-1);
}
else addtlRowOffset = 0;
vector relativePos = relativeBase;
relativePos.y += offset;
relativePos.x += addtlRowOffset;
relativePos = relativePos * llGetLocalRot();
relativePos += llGetPos();
//llWhisper(0, "Rez card to position for boot ("+llJsonGetValue(m,["boot"])+") : "+(string)relativePos);
llRegionSayTo(i, (integer)llJsonGetValue(m,["boot"]), llList2Json(JSON_OBJECT, ["type", "activate", "table", g_kID, "pos", relativePos, "rot", llGetRot()]));
//if(DEBUG)llSay(0, "Alive request on the Cards Channel: "+m);
string color = "1";
offset += 0.25;
if(g_iSelectNum > 1){
if(g_iCurRow >= g_iSelectNum || g_iCurRow == 4){
offset += 0.2;
g_iCurRow = 1;
} else {
g_iCurRow++;
}
} else
offset += 0.25;
string cmd= "GET_CARD";
llSleep(3);
if(llList2String(lCmd,1) != "black"){
//cmd = "SEARCH&CARD_TEXT="+llStringToBase64(llList2String(lCmd,1))+"&AVATAR="+llList2String(lCmd,0);
color="0";
llRegionSayTo(i, card_channel, llList2Json(JSON_OBJECT, ["type", "set","card", llList2Json(JSON_OBJECT, ["text", llList2String(lCmd,1), "color", 0, "num", 0, "czar", llList2String(Players, g_iCzar), "user", llList2String(lCmd,0)])]));
//Send("/Modify_Card.php?TYPE_OVERRIDE=INSERT&TABLE_ID="+(string)g_kID+"&CARD_TEXT="+llEscapeURL(llStringToBase64(llList2String(lCmd,1))), "POST");
// remove this card from judge pile
return;
}
Send("/Modify_Card.php?TYPE_OVERRIDE="+cmd+"&TABLE_ID="+(string)g_kID+"&COLOR="+color+"&DRAW_COUNT=1&SENDER="+(string)i+"&REZZED=1", "POST");
@ -501,31 +552,38 @@ state active
key kUser = (key)llJsonGetValue(m,["user"]);
GiveUserPoint(kUser);
g_iSelectNum--;
g_iCurRow=1;
if(g_iSelectNum == 0){
llWhisper(0, "secondlife:///app/agent/"+(string)kUser+"/about receives a point");
llMessageLinked(LINK_SET, 50, (string)kUser, "23");
llSay(card_channel, llList2Json(JSON_OBJECT, ["type", "die", "table", g_kID]));
// Start next round!
// Load the next black card to trigger selection mode
integer boot = llRound(llFrand(5483758));
g_lPendingCards += [boot, "null|black"];
if(!g_iHaiku){
integer boot = llRound(llFrand(5483758));
g_lPendingCards += [boot, "null|black"];
integer x =0;
integer ends = llGetListLength(g_lJudgePile);
g_iTotalJudgeUsers = 0;
for(x=0;x<ends;x++){
string card = llList2String(g_lJudgePile,x);
Send("/Modify_Card.php?TYPE_OVERRIDE=INSERT&TABLE_ID="+(string)g_kID+"&CARD_TEXT="+llEscapeURL(llStringToBase64(llJsonGetValue(card,["text"]))), "POST");
/*integer x =0;
integer ends = llGetListLength(g_lJudgePile);
g_iTotalJudgeUsers = 0;
for(x=0;x<ends;x++){
string card = llList2String(g_lJudgePile,x);
Send("/Modify_Card.php?TYPE_OVERRIDE=INSERT&TABLE_ID="+(string)g_kID+"&CARD_TEXT="+llEscapeURL(llStringToBase64(llJsonGetValue(card,["text"]))), "POST");
}*/
g_lJudgePile=[];
g_iTotalJudgeUsers=0;
llRezObject("Playing Card [LS]", llGetPos(), ZERO_VECTOR,ZERO_ROTATION,boot);
} else {
Send("/Modify_Card.php?TYPE_OVERRIDE=NULCARD&TABLE_ID="+(string)g_kID,"GET");
}
g_lJudgePile=[];
llRezObject("Playing Card [LS]", llGetPos(), ZERO_VECTOR,ZERO_ROTATION,boot);
} else {
g_iTotalJudgeUsers=0;
llRegionSayTo(i,card_channel, llList2Json(JSON_OBJECT, ["type", "die", "table", g_kID]));
llWhisper(0, "secondlife:///app/agent/"+(string)kUser+"/about was one of the selected cards and receives a point");
llWhisper(0, "Card Czar: "+(string)g_iSelectNum+" more cards are required");
llMessageLinked(LINK_SET, 50, (string)kUser, "23");
llMessageLinked(LINK_SET, 50, (string)g_iSelectNum, "24");
}
}
} else if(llListFindList(g_lListener,[c])!=-1){
@ -654,7 +712,7 @@ state ingred
}
touch_start(integer t){
llSay(0, "Cards Against Humanity Settings; Quantity: 1");
llSay(0, "Cards Against Humanity Settings\n___\nQuantity: 1");
llSay(ingredient_channel+1, "CAH_TABLE");
}
}