Add some more changes
This commit is contained in:
parent
97f0e4a475
commit
b464adae4a
5 changed files with 456 additions and 97 deletions
|
@ -1,6 +1,7 @@
|
|||
|
||||
integer card_channel = -32988199;
|
||||
|
||||
string g_sText;
|
||||
integer g_iStart;
|
||||
key g_kTable;
|
||||
integer genericListen = -1;
|
||||
|
@ -35,6 +36,7 @@ default
|
|||
touch_start(integer t){
|
||||
if(llDetectedKey(0) == g_kCzar){
|
||||
if(!g_iConfirm){
|
||||
llWhisper(0, g_sText);
|
||||
llSay(0, "Touch this card again to confirm you want to select this card as winner for this round!");
|
||||
llSetColor(<0,1,0>,2);
|
||||
llSetTexture(TEXTURE_BLANK, 2);
|
||||
|
@ -90,7 +92,10 @@ default
|
|||
llSetLinkColor(LINK_ROOT, <1,1,1>,0);
|
||||
llMessageLinked(LINK_SET,0,"c=black", "fw_conf");
|
||||
}
|
||||
|
||||
g_sText=text;
|
||||
if(llStringLength(text)>128){
|
||||
llSay(0, text);
|
||||
}
|
||||
llMessageLinked(LINK_SET,0,text, "fw_data : card_text");
|
||||
|
||||
if(num > 1){
|
||||
|
|
27
SOURCE/LSL/Deck.lsl
Normal file
27
SOURCE/LSL/Deck.lsl
Normal file
|
@ -0,0 +1,27 @@
|
|||
|
||||
integer ingredient_channel = -8392888;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(ingredient_channel, "", "", "");
|
||||
llSetText("Deck of Cards\n-----\nQuantity: 1", <0,1,0>,1);
|
||||
}
|
||||
|
||||
touch_start(integer t){
|
||||
llSay(0, llGetObjectDesc()+" Deck of Cards; Quantity: 1");
|
||||
}
|
||||
|
||||
on_rez(integer t){
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
listen(integer c,string n,key i,string m){
|
||||
if(m == "scan"){
|
||||
llSay(c+1, "Deck");
|
||||
}else if(m == (string)llGetKey()){
|
||||
llDie();
|
||||
}
|
||||
}
|
||||
}
|
186
SOURCE/LSL/DeckHandler.lsl
Normal file
186
SOURCE/LSL/DeckHandler.lsl
Normal file
|
@ -0,0 +1,186 @@
|
|||
list g_lSelectedDecks= ["OFFICIAL",1];
|
||||
DecksMenu(key id){
|
||||
integer i=0;
|
||||
list Buttons = [];
|
||||
string Prompt;
|
||||
integer end = llGetListLength(g_lSelectedDecks);
|
||||
for(i=0;i<end;i+=2){
|
||||
Buttons+=cbox((integer)llList2String(g_lSelectedDecks,i+1), llList2String(g_lSelectedDecks,i));
|
||||
}
|
||||
if(g_iDecksListen!=-1){
|
||||
llListenRemove(g_iDecksListen);
|
||||
}
|
||||
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);
|
||||
}
|
||||
string cbox(integer a, string b){
|
||||
if(a)return "[X] "+b;
|
||||
else return "[ ] "+b;
|
||||
}
|
||||
|
||||
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) llWhisper(0, "You cannot have no decks selected. The official deck will be automatically used as default when no decks are selected");
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=SET_OPTIONS&TABLE_ID="+(string)g_kID+"&DECK="+llEscapeURL(llStringToBase64(llDumpList2String(lAct, "~"))), "POST");
|
||||
}
|
||||
|
||||
|
||||
|
||||
string g_sVersion = "1.0.0.0000";
|
||||
integer DEBUG = FALSE;
|
||||
list g_lReqs;
|
||||
string URL = "https://api.zontreck.dev/ls_bionics";
|
||||
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 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),"?"));
|
||||
}
|
||||
|
||||
integer g_iStarted;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry(){
|
||||
|
||||
g_kID = (key)llGetObjectDesc();
|
||||
llWhisper(0, "Decks Handler ("+(string)llGetFreeMemory()+"b)");
|
||||
}
|
||||
|
||||
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){
|
||||
g_lSelectedDecks+=[m,1];
|
||||
UpDecks();
|
||||
} else if(n == 11){
|
||||
g_iStarted=1;
|
||||
}
|
||||
}
|
||||
|
||||
on_rez(integer t){
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
changed(integer c){
|
||||
if(c&CHANGED_REGION_START)llResetScript();
|
||||
|
||||
if(c&CHANGED_OWNER)llResetScript();
|
||||
|
||||
}
|
||||
|
||||
touch_start(integer t){
|
||||
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");
|
||||
return;
|
||||
}
|
||||
DecksMenu(llDetectedKey(0));
|
||||
|
||||
}
|
||||
}
|
||||
http_response(key r,integer s,list m, string b){
|
||||
if(r == g_kCurrentReq){
|
||||
g_kCurrentReq = NULL_KEY;
|
||||
g_lReqs = llDeleteSubList(g_lReqs,0,1);
|
||||
|
||||
list lTmp = llParseString2List(b,[";;",";"],[]);
|
||||
string Script = llList2String(lTmp,0);
|
||||
if(Script == "Get_Product_Data")
|
||||
{
|
||||
string Variable = llList2String(lTmp,1);
|
||||
if(Variable == "License"){
|
||||
if(llList2String(lTmp,2) == "1"){
|
||||
llSay(0, "License is now activated!");
|
||||
//state active;
|
||||
llWhisper(0, "Downloading list of decks...");
|
||||
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)+"]");
|
||||
}
|
||||
}
|
||||
} else if(Script == "Card_Options"){
|
||||
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=OPTIONS&TABLE_ID="+(string)g_kID, "GET");
|
||||
} else {
|
||||
llMessageLinked(LINK_SET,1,llDumpList2String(g_lSelectedDecks,"~"),"");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Sends();
|
||||
}
|
||||
}
|
||||
|
||||
timer(){
|
||||
if(llGetListLength(g_lSelectedDecks)==0){
|
||||
llMessageLinked(LINK_SET,-2,"","");
|
||||
llSetTimerEvent(0);
|
||||
}
|
||||
}
|
||||
|
||||
listen(integer c,string n,key i,string m){
|
||||
if(c == g_iDecksChan){
|
||||
list lPar = llParseString2List(m,["[", "] "], []);
|
||||
integer iNewDeck = 0;
|
||||
if(llList2String(lPar,0)=="X"){
|
||||
//Disable the deck
|
||||
iNewDeck = 0;
|
||||
} else {
|
||||
iNewDeck = 1;
|
||||
}
|
||||
|
||||
integer pos = llListFindList(g_lSelectedDecks,[llList2String(lPar,1)]);
|
||||
if(pos==-1){
|
||||
if(m == "CONFIRM"){
|
||||
llListenRemove(g_iDecksListen);
|
||||
g_iDecksListen=-1;
|
||||
UpDecks();
|
||||
|
||||
llSetTimerEvent(5);
|
||||
} 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 {
|
||||
g_lSelectedDecks = llListReplaceList(g_lSelectedDecks, [iNewDeck], pos+1,pos+1);
|
||||
}
|
||||
|
||||
|
||||
DecksMenu(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -7,12 +7,14 @@ integer DEBUG=FALSE;
|
|||
integer card_channel = -32988199;
|
||||
integer hud_channel = -328478727;
|
||||
|
||||
vector g_vLastPos1 = <0.02395, 0.47113, -0.15166>;
|
||||
|
||||
s(string m){
|
||||
llInstantMessage(g_kUser,m);
|
||||
}
|
||||
list g_lCards;
|
||||
Cards(){
|
||||
if(!llGetAttached())return;
|
||||
integer x = 0;
|
||||
integer e = 10;
|
||||
integer CurCard = 1;
|
||||
|
@ -25,6 +27,10 @@ Cards(){
|
|||
string card_params = llList2String(g_lCards,x);
|
||||
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){
|
||||
s("Card "+(string)x+": "+llJsonGetValue(card_params,["text"]));
|
||||
}
|
||||
} else {
|
||||
NCard++;
|
||||
llMessageLinked(LINK_SET,0,"", "fw_data : card_text"+(string)CurCard);
|
||||
|
@ -48,7 +54,7 @@ integer g_iVis=0;
|
|||
POS(){
|
||||
if(!llGetAttached())return;
|
||||
g_iVis=1;
|
||||
vector local = <0.02395, 0.47113, -0.15166>;
|
||||
vector local = g_vLastPos1;
|
||||
llSetPrimitiveParams([PRIM_POS_LOCAL, local]);
|
||||
}
|
||||
|
||||
|
@ -56,39 +62,40 @@ POS2(){
|
|||
if(!llGetAttached())return;
|
||||
g_iVis=0;
|
||||
vector local = <0.02395, 1.77734, -0.15166>;
|
||||
llSetPrimitiveParams([PRIM_POS_LOCAL, local]);
|
||||
if(llVecDist(llGetLocalPos(),local)>1){
|
||||
g_vLastPos1 = llGetLocalPos();
|
||||
llSetPrimitiveParams([PRIM_POS_LOCAL, local]);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
];
|
||||
|
||||
Highlight(){
|
||||
integer i=1;
|
||||
integer end = 10;
|
||||
for(i=1;i<=end;i++){
|
||||
if(llListFindList(g_lSelected,[i])==-1){
|
||||
integer x=0;
|
||||
integer end2 = llGetNumberOfPrims();
|
||||
for(x=1;x<=end2;x++){
|
||||
string LinkName = llGetLinkName(x);
|
||||
if(LinkName=="Card"+(string)i){
|
||||
llSetLinkColor(x, <1,1,1>, 2);
|
||||
jump stopFor;
|
||||
}
|
||||
}
|
||||
@stopFor;
|
||||
integer i=0;
|
||||
integer end = llGetListLength(g_lActualCards);
|
||||
for(i=0;i<end;i+=2){
|
||||
if(llListFindList(g_lSelected,[llList2Integer(g_lActualCards,i)])==-1){
|
||||
//llSay(0, "number : "+(string)llList2Integer(g_lActualCards,i)+" not found in selected card list.");
|
||||
llSetLinkColor(llList2Integer(g_lActualCards, i+1), <1,1,1>, 2);
|
||||
//llSay(0, "set "+llList2String(g_lActualCards,i+1)+" to white on face 2");
|
||||
} else {
|
||||
integer x = 0;
|
||||
integer end2 = llGetNumberOfPrims();
|
||||
for(x=1;x<=end2;x++){
|
||||
string LinkName = llGetLinkName(x);
|
||||
if(LinkName == "Card"+(string)i){
|
||||
llSetLinkColor(x,<0,1,0>,2);
|
||||
jump stopFor2;
|
||||
}
|
||||
}
|
||||
@stopFor2;
|
||||
//llSay(0, "number : "+(string)llList2Integer(g_lActualCards,i)+" found in selected card list.");
|
||||
llSetLinkColor(llList2Integer(g_lActualCards,i+1), <0,1,0>, 2);
|
||||
//llSay(0, "set "+llList2String(g_lActualCards,i+1)+" to green on face 2");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
integer g_iSelectNum=0;
|
||||
|
@ -117,6 +124,7 @@ default
|
|||
g_kUser=llGetOwner();
|
||||
g_kTable = llGetOwner();
|
||||
|
||||
//g_lSelected = [5, 7, 1];
|
||||
Highlight();
|
||||
}
|
||||
|
||||
|
@ -238,6 +246,8 @@ default
|
|||
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){
|
||||
|
|
|
@ -5,8 +5,27 @@ integer updater_channel = 15418070;
|
|||
integer card_channel = -32988199;
|
||||
integer hud_channel = -328478727;
|
||||
|
||||
integer g_iSelectNum;
|
||||
list g_lPoints;
|
||||
integer g_iStarted;
|
||||
integer g_iExpectDeckLoad;
|
||||
|
||||
list StrideOfList(list src, integer stride, integer start, integer end)
|
||||
{
|
||||
list l = [];
|
||||
integer ll = llGetListLength(src);
|
||||
if(start < 0)start += ll;
|
||||
if(end < 0)end += ll;
|
||||
if(end < start) return llList2List(src, start, start);
|
||||
while(start <= end)
|
||||
{
|
||||
l += llList2List(src, start, start);
|
||||
start += stride;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
GiveUserPoint(key kUser){
|
||||
// point list - user, num of points
|
||||
integer index = llListFindList(g_lPoints,[kUser]);
|
||||
|
@ -20,6 +39,20 @@ GiveUserPoint(key kUser){
|
|||
UpScores();
|
||||
}
|
||||
|
||||
SetupDeck(){
|
||||
string deckStr;
|
||||
list decks;
|
||||
integer i=0;
|
||||
integer end = llGetListLength(g_lSelectedDecks);
|
||||
for(i=0;i<end;i+=2){
|
||||
if((integer)(llList2String(g_lSelectedDecks,i+1)))decks+=llList2String(g_lSelectedDecks,i);
|
||||
}
|
||||
deckStr=llDumpList2String(decks, ",");
|
||||
llSay(0, "Shuffling cards for decks: "+deckStr);
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=MAKE_DECK&TABLE_ID="+(string)g_kID+"&DECKS="+deckStr, "POST");
|
||||
}
|
||||
|
||||
|
||||
UpScores(){
|
||||
|
||||
integer i=0;
|
||||
|
@ -44,8 +77,9 @@ UpScores(){
|
|||
|
||||
list g_lJudgePile;
|
||||
integer g_iTotalJudgeUsers;
|
||||
list g_lSelectedDecks = ["OFFICIAL",1];
|
||||
|
||||
string g_sVersion = "1.0.0.0000";
|
||||
string g_sVersion = "1.0.0.0002";
|
||||
key g_kToken;
|
||||
integer DEBUG = FALSE;
|
||||
float offset;
|
||||
|
@ -67,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 REQUEST: "+URL+llList2String(g_lReqs,0));
|
||||
|
||||
string append = "";
|
||||
if(llList2String(g_lReqs,1) == "GET")append = "?"+llDumpList2String(llList2List(lTmp,1,-1),"?");
|
||||
|
@ -172,10 +206,14 @@ integer g_iBlockRez = 0;
|
|||
key g_kCurrentBlackCard;
|
||||
list g_lPendingCards;
|
||||
|
||||
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");
|
||||
}
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llMessageLinked(LINK_SET,-1,"","");
|
||||
llSitTarget(ZERO_VECTOR,ZERO_ROTATION);
|
||||
Chairs=[];
|
||||
UpScores();
|
||||
|
@ -199,11 +237,15 @@ default
|
|||
llWhisper(0, "Stand by...");
|
||||
g_kID = (key)llGetObjectDesc();
|
||||
if(g_kID == "new_lsk"){
|
||||
g_kID = llGenerateKey();
|
||||
llListen(99, "", llGetOwner(), "");
|
||||
llDialog(llGetOwner(), "Is this a new table or a upgraded one?", ["New", "Upgrade"], 99);
|
||||
|
||||
/*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]");
|
||||
llSetObjectName("Cards Against Humanity [LS]");
|
||||
Send("/Put_Product_Data.php?PRODUCT=CAH_TABLE&KEYID="+(string)g_kID+"&NICKNAME=License&DATA=1","POST");
|
||||
return;*/
|
||||
return;
|
||||
}
|
||||
llWhisper(card_channel, llList2Json(JSON_OBJECT, ["type", "die", "table", g_kID]));
|
||||
|
@ -211,7 +253,7 @@ default
|
|||
Evict(Players);
|
||||
|
||||
|
||||
state license_check;
|
||||
llMessageLinked(LINK_SET, 0, "", g_kID);
|
||||
}
|
||||
|
||||
http_response(key r,integer s,list m,string b){
|
||||
|
@ -225,61 +267,55 @@ default
|
|||
}
|
||||
}
|
||||
|
||||
listen(integer c,string n,key i,string m){
|
||||
if(c==99){
|
||||
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]");
|
||||
llSetObjectName("Cards Against Humanity [LS]");
|
||||
Send("/Put_Product_Data.php?PRODUCT=CAH_TABLE&KEYID="+(string)g_kID+"&NICKNAME=License&DATA=1", "POST");
|
||||
llResetScript();
|
||||
} else if(m == "Upgrade"){
|
||||
llListen(ingredient_channel+1, "", "", "");
|
||||
llSay(ingredient_channel, "scan");
|
||||
llWhisper(0, "Scanning for settings");
|
||||
return;
|
||||
}
|
||||
} 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");
|
||||
llRegionSayTo(i, ingredient_channel, (string)i);
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
on_rez(integer t){
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
link_message(integer s,integer n,string m,key i){
|
||||
if(n==1){
|
||||
g_lSelectedDecks = llParseString2List(m,["~"],[]);
|
||||
state active;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state license_check
|
||||
{
|
||||
state_entry(){
|
||||
//llSay(0, "Checking for a game license... Please hold on awhile while I process your request");
|
||||
Send("/Get_Product_Data.php?PRODUCT=CAH_TABLE&KEYID="+(string)g_kID+"&NICKNAME=License", "GET");
|
||||
}
|
||||
|
||||
http_response(key r,integer s,list m, string b){
|
||||
if(r == g_kCurrentReq){
|
||||
g_kCurrentReq = NULL_KEY;
|
||||
g_lReqs = llDeleteSubList(g_lReqs,0,1);
|
||||
|
||||
list lTmp = llParseString2List(b,[";;",";"],[]);
|
||||
string Script = llList2String(lTmp,0);
|
||||
if(Script == "Get_Product_Data")
|
||||
{
|
||||
string Variable = llList2String(lTmp,1);
|
||||
if(llList2String(lTmp,2) == "1"){
|
||||
//llSay(0, "License is now activated!");
|
||||
state active;
|
||||
} 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)+"]");
|
||||
}
|
||||
}
|
||||
|
||||
Sends();
|
||||
}
|
||||
}
|
||||
|
||||
on_rez(integer t){
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
changed(integer t){
|
||||
if(t&CHANGED_REGION_START){
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
}
|
||||
state active
|
||||
{
|
||||
state_entry(){
|
||||
llSay(0, "Game Table now ready");
|
||||
llSay(0, "Shuffling cards...");
|
||||
Send("/Modify_Card.php?TYPE_OVERRIDE=MAKE_DECK&TABLE_ID="+(string)g_kID, "POST");
|
||||
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"];
|
||||
|
@ -293,14 +329,14 @@ state active
|
|||
g_lReqs = llDeleteSubList(g_lReqs,0,1);
|
||||
|
||||
list lTmp = llParseString2List(b,[";;",";"],[]);
|
||||
if(DEBUG)llSay(0, "HTTP REPLY: "+b);
|
||||
//if(DEBUG)llSay(0, "HTTP REPLY: "+b);
|
||||
string Script = llList2String(lTmp,0);
|
||||
if(Script == "Modify_Deck"){
|
||||
llSay(0, "Deck generated!");
|
||||
llSay(0, "Deck generated with total cards: "+llList2String(lTmp,3));
|
||||
} else if(Script == "Get_Card"){
|
||||
key Sender = (key)llList2String(lTmp,1);
|
||||
list Params = llJson2List(llBase64ToString(llList2String(lTmp,2)));
|
||||
if(DEBUG)llSay(0, "PARAMETER LIST: "+llList2CSV(Params));
|
||||
//if(DEBUG)llSay(0, "PARAMETER LIST: "+llList2CSV(Params));
|
||||
|
||||
//llParseString2List(llBase64ToString(llList2String(lTmp,2)), ["|"],[]);
|
||||
integer i=0;
|
||||
|
@ -330,6 +366,7 @@ state active
|
|||
llSay(0, "Card Czar is: secondlife:///app/agent/"+(string)czar+"/about");
|
||||
|
||||
llRegionSay(hud_channel, llList2Json(JSON_OBJECT, ["type", "select", "czar", czar, "sel_count", num_req, "table", g_kID]));
|
||||
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)])]));
|
||||
}
|
||||
|
@ -341,7 +378,7 @@ state active
|
|||
integer num = llList2Integer(lTmp,4);
|
||||
string user = llList2String(lTmp,5);
|
||||
|
||||
if(DEBUG)llSay(0, "SEARCH RESULT: "+Text);
|
||||
//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...");
|
||||
|
@ -360,6 +397,23 @@ state active
|
|||
|
||||
llSay(0, "WINNER IS: secondlife:///app/agent/"+(string)kLastHigh+"/about with "+(string)iLastHigh+" points total!!");
|
||||
llResetScript();
|
||||
} else if(Script == "Modify_Product"){
|
||||
if(llList2String(lTmp,1)=="Cards Against Humanity [LS]"){
|
||||
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);
|
||||
Send("/Get_Server_URL.php?NAME=Products","GET");
|
||||
llWhisper(0, "Requesting product update delivery");
|
||||
} else {
|
||||
llRegionSayTo(g_kToken, updater_channel, "no_update");
|
||||
llWhisper(0, "I am up to date");
|
||||
}
|
||||
}
|
||||
} 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]"]));
|
||||
state ingred;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -368,9 +422,7 @@ state active
|
|||
}
|
||||
|
||||
listen(integer c,string n,key i, string m){
|
||||
if(DEBUG){
|
||||
llSay(0, "LISTEN: "+llDumpList2String([c,n,i,m], " - "));
|
||||
}
|
||||
//if(DEBUG) llSay(0, "LISTEN: "+llDumpList2String([c,n,i,m], " - "));
|
||||
if(c==hud_channel){
|
||||
if(llJsonGetValue(m,["type"])=="card_request"){
|
||||
integer card_count = (integer)llJsonGetValue(m,["count"]);
|
||||
|
@ -380,7 +432,7 @@ state active
|
|||
if(index==-1)return;
|
||||
else {
|
||||
// Boot the HUD
|
||||
if(DEBUG)llSay(0, "Sending HUD Activation signal");
|
||||
//if(DEBUG)llSay(0, "Sending HUD Activation signal");
|
||||
index--;
|
||||
|
||||
|
||||
|
@ -395,6 +447,7 @@ 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);
|
||||
// Initiate the rezzing procedure
|
||||
integer x =0;
|
||||
integer e = llGetListLength(g_lJudgePile);
|
||||
|
@ -429,7 +482,7 @@ state active
|
|||
offset = 0.0;
|
||||
}
|
||||
llRegionSayTo(i, card_channel, llList2Json(JSON_OBJECT, ["type", "position", "pos", llGetPos()+<0,offset,0.75>]));
|
||||
if(DEBUG)llSay(0, "Alive request on the Cards Channel: "+m);
|
||||
//if(DEBUG)llSay(0, "Alive request on the Cards Channel: "+m);
|
||||
|
||||
string color = "1";
|
||||
offset += 0.25;
|
||||
|
@ -447,24 +500,33 @@ state active
|
|||
} else if(llJsonGetValue(m,["type"]) == "final"){
|
||||
key kUser = (key)llJsonGetValue(m,["user"]);
|
||||
GiveUserPoint(kUser);
|
||||
llWhisper(0, "secondlife:///app/agent/"+(string)kUser+"/about won the round and gets the point.");
|
||||
g_iSelectNum--;
|
||||
|
||||
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_iSelectNum == 0){
|
||||
|
||||
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="+llStringToBase64(llJsonGetValue(card,["text"])), "POST");
|
||||
llWhisper(0, "secondlife:///app/agent/"+(string)kUser+"/about receives a point");
|
||||
|
||||
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"];
|
||||
|
||||
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=[];
|
||||
llRezObject("Playing Card [LS]", llGetPos(), ZERO_VECTOR,ZERO_ROTATION,boot);
|
||||
} else {
|
||||
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");
|
||||
}
|
||||
|
||||
g_lJudgePile=[];
|
||||
llRezObject("Playing Card [LS]", llGetPos(), ZERO_VECTOR,ZERO_ROTATION,boot);
|
||||
}
|
||||
} else if(llListFindList(g_lListener,[c])!=-1){
|
||||
integer index = llListFindList(g_lListener,[c]);
|
||||
|
@ -478,7 +540,28 @@ 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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
changed(integer t){
|
||||
|
@ -495,6 +578,11 @@ state active
|
|||
|
||||
timer(){
|
||||
Sends();
|
||||
|
||||
if(llGetTime()>=15.0 && g_iExpectDeckLoad){
|
||||
g_iExpectDeckLoad=0;
|
||||
llWhisper(0, "No nearby deck found");
|
||||
}
|
||||
}
|
||||
|
||||
touch_start(integer t){
|
||||
|
@ -502,6 +590,7 @@ state active
|
|||
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;
|
||||
|
@ -526,4 +615,46 @@ 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state ingred
|
||||
{
|
||||
state_entry(){
|
||||
llSetTimerEvent(0);
|
||||
llListen(ingredient_channel, "", "", "");
|
||||
llSetText("Cards Against Humanity Settings\n----\nQuantity: 1", <0,1,0>,1);
|
||||
}
|
||||
on_rez(integer t){
|
||||
llListen(ingredient_channel, "", "", "");
|
||||
}
|
||||
|
||||
changed(integer c){
|
||||
if(c&CHANGED_REGION_START){
|
||||
llListen(ingredient_channel, "", "", "");
|
||||
}
|
||||
}
|
||||
|
||||
listen(integer c,string n,key i,string m){
|
||||
if(m == "scan"){
|
||||
llRegionSayTo(i,ingredient_channel+1, "CAH_TABLE");
|
||||
}else if(m == (string)llGetKey()){
|
||||
llDie();
|
||||
}
|
||||
}
|
||||
|
||||
touch_start(integer t){
|
||||
llSay(0, "Cards Against Humanity Settings; Quantity: 1");
|
||||
llSay(ingredient_channel+1, "CAH_TABLE");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue