Peril_Dice/StatFloat.lsl
RebeccaNod1 8e69688bff
✅ New Features Added
Sequential Player Picking Logic

Players now pick in order starting with the peril player.

Number of picks is determined by the peril player’s current lives.

Picks are tracked globally to prevent duplicates.

Dynamic Dice Type Adjustment

Dice size (diceType) now adjusts based on player count:

1–2 players = 6

3–4 players = 12

5–6 players = 18, etc.

Prompt for Dice Roll

After all players have made their picks, the peril player is prompted to roll via a dialog.

Dice Roll Resolution Logic

If another player matches the roll, they become the new peril player.

If no one matches or the peril player matches, the peril player loses a life.

🔄 Fixes & Improvements
Fixed syntax and scoping errors (resultStr, newPeril, and timer logic).

Prevented duplicate rezzing of StatFloat objects.

Restored and ensured 🔢 Picks: are shown on the floating stat displays.

Updated floaters dynamically after each pick using llSetTimerEvent.
2025-07-20 00:04:48 -05:00

39 lines
1.4 KiB
Text

key target;
string displayText;
default {
on_rez(integer start_param) {
llOwnerSay("🧪 on_rez triggered with start_param: " + (string)start_param);
llListen(start_param, "", NULL_KEY, "");
llOwnerSay("📡 Listening on channel (on_rez): " + (string)start_param);
}
state_entry() {
llOwnerSay("🧭 StatFloat active");
llSetText("Waiting...", <1,1,1>, 1.0);
llSetTimerEvent(1.0);
}
listen(integer channel, string name, key id, string message) {
llOwnerSay("🔉 Heard on channel " + (string)channel + ": " + message);
if (llSubStringIndex(message, "FLOAT:") == 0) {
list parts = llParseString2List(message, ["|"], []);
if (llGetListLength(parts) >= 2) {
target = (key)llGetSubString(llList2String(parts, 0), 6, -1);
displayText = llList2String(parts, 1);
llSetText(displayText, <1,1,1>, 1.0);
llOwnerSay("✅ Received FLOAT for: " + (string)target);
}
} else if (message == "CLEANUP") {
llOwnerSay("🧹 Cleaning up...");
llDie();
}
}
timer() {
if (target != NULL_KEY && llKey2Name(target) != "") {
vector pos = llList2Vector(llGetObjectDetails(target, [OBJECT_POS]), 0) + <1,0,1>;
llSetRegionPos(pos);
}
}
}