Fix some bugs, add more things

This commit is contained in:
Tara 2022-12-25 12:36:43 -07:00
parent e2327132d8
commit 7229f3381e
2 changed files with 67 additions and 0 deletions

View file

@ -5,6 +5,18 @@ integer updater_channel = 15418070;
integer card_channel = -32988199;
integer hud_channel = -328478727;
list g_lPoints;
GiveUserPoint(key kUser){
// point list - user, num of points
integer index = llListFindList(g_lPoints,[kUser]);
if(index == -1){
g_lPoints += [kUser, 1];
}else {
integer curPoint = llList2Integer(g_lPoints,index+1);
curPoint++;
g_lPoints=llListReplaceList(g_lPoints,[curPoint], index+1,index+1);
}
}
string g_sVersion = "1.0.0.0000";
key g_kToken;
integer DEBUG = FALSE;
@ -239,6 +251,7 @@ state active
integer chan = llRound(llFrand(548378));
g_lPendingCards += [chan, "null|black"];
llRezObject("Playing Card [LS]", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, chan);*/
llSitTarget(<0,0,1>, ZERO_ROTATION);
}
http_response(key r,integer s,list m,string b){
@ -330,6 +343,14 @@ state active
if(DEBUG)llSay(0, "Alive request on the Cards Channel: "+m);
Send("/Modify_Card.php?TYPE_OVERRIDE=GET_CARD&TABLE_ID="+(string)g_kID+"&COLOR=1&DRAW_COUNT=1&SENDER="+(string)i+"&REZZED=1", "POST");
} 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.");
llSay(card_channel, llList2Json(JSON_OBJECT, ["type", "die", "table", g_kID]));
// Start next round!
// Load the next black card to trigger selection mode
}
} else if(llListFindList(g_lListener,[c])!=-1){
integer index = llListFindList(g_lListener,[c]);
@ -369,6 +390,14 @@ state active
integer chan = llRound(llFrand(548378));
g_lPendingCards += [chan, "null|black"];
llRezObject("Playing Card [LS]", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, chan);
} else if(name == "ANIM"){
key i = llDetectedKey(0);
integer rnd = llRound(llFrand(5843758));
g_lListener += [i,rnd,llListen(rnd,"",i,"")];
llDialog(i, "Are you male or female?", ["Female", "Male"], rnd);
llRequestPermissions(i, PERMISSION_TRIGGER_ANIMATION);
}
}
}

View file

@ -3,7 +3,11 @@ integer card_channel = -32988199;
integer g_iStart;
key g_kTable;
integer genericListen = -1;
key g_kUser= NULL_KEY;
key g_kCzar = NULL_KEY;
integer g_iConfirm;
default
{
state_entry()
@ -11,6 +15,7 @@ default
llMessageLinked(LINK_SET,0,"","fw_reset");
llSetLinkColor(LINK_ROOT, <1,1,1>,1);
llSetLinkColor(LINK_ROOT, <1,1,1>,0);
genericListen = llListen(card_channel, "", "", "");
llWhisper(0, "You must not rez this card by itself!");
}
@ -18,6 +23,8 @@ default
if(t==0){
llResetScript();
}else{
llListenRemove(genericListen);
genericListen = llListen(card_channel, "", "", "");
llSay(0, "Card is trying to find a table");
llListen(t, "", "", "");
g_iStart=t;
@ -25,9 +32,37 @@ default
}
}
touch_start(integer t){
if(llDetectedKey(0) == g_kCzar){
if(!g_iConfirm){
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);
llResetTime();
llSetTimerEvent(1);
}
g_iConfirm++;
if(g_iConfirm==2){
llSay(card_channel, llList2Json(JSON_OBJECT, ["type", "final", "user", g_kUser]));
}
}
}
timer(){
if(llGetTime()>=10.0){
g_iConfirm=0;
llSetColor(ZERO_VECTOR,2);
llSetTexture(TEXTURE_TRANSPARENT,2);
llSetTimerEvent(0);
}
}
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");
g_kTable = (key)llJsonGetValue(m,["table"]);
@ -41,6 +76,9 @@ default
string text = llJsonGetValue(m,["card", "text"]);
integer color = (integer)llJsonGetValue(m,["card","color"]);
integer num = (integer)llJsonGetValue(m,["card", "num"]);
g_kUser = (key)llJsonGetValue(m,["card", "user"]);
g_kCzar = (key)llJsonGetValue(m,["card","czar"]);
if(color){
// black
llSetLinkColor(LINK_ROOT, <0.2,0.2,0.2>, 1);