🎯 Refactored the Game Architecture
We modularized the original Peril Dice controller into separate cohesive components:
Main Peril Dice Controller
Handles core logic: player join/leave, peril selection, game sync, and communication routing.
Broadcasts updates via MSG_SYNC_GAME_STATE after major state changes.
Applies llSleep(0.2) to improve message delivery reliability.
Dialog Handler Module
Manages the number-picking dialog.
Tracks player picks and updates picksData accordingly.
Sends state sync after every valid pick.
Fixed pick serialization bugs and ensured updates trigger correctly.
Float Rezzer Module
Registers player data and rezzes a StatFloat object beside each participant.
Applies llSetObjectDesc(name); before rezzing for easier identification.
On update, broadcasts llRegionSay messages including current lives, peril, and picks.
StatFloat (HUD Script)
Listens on assigned channel to receive floating text updates.
Parses synced game state from link_message to extract lives, picks, and peril data.
Dynamically follows the avatar.
Enhanced parsing reliability and fixed index mapping for correct player display.
Roll and Confetti Module
Performs dice rolls and checks for matches.
Transfers peril role on match or removes a life otherwise.
Triggers confetti on a miss and updates floats for all players.
🛠 Debugging and Enhancements
Added llOwnerSay debug statements across all modules.
Resolved multiple name not defined within scope (nndws) issues.
Verified and cleaned up serialized game data formats across modules.
Ensured consistent use of player indexing and life count mapping.
|
||
|---|---|---|
| DialogHandler.lsl | ||
| FloaterManager.lsl | ||
| PerilController.lsl | ||
| README.md | ||
| RollConfettiModule.lsl | ||
| StatFloat.lsl | ||
| StatFloatRezzer.lsl | ||
Peril Dice
Notice these rules were made by Noose the Bunny (djmusica28) secondlife:///app/agent/5935e159-63ba-415a-b20b-4813b50367d0/about, im baseing off this but im also automating it
🎲 PERIL DICE – GAME RULES 🧍 Objective: Avoid becoming the “person in peril” and losing all your lives. The last player with lives remaining wins!
🛠️ Setup Each player wears a Peril Dice Tracker HUD
Everyone starts with 3 lives
Choose a dice type: d6, d12, or d20
One player clicks "Set Yourself In Peril" on the HUD to start
🔁 Game Rounds
- Determine Lives of Person in Peril
3 Lives → Each player picks 1 number
2 Lives → Each player picks 2 numbers
1 Life → Each player picks 3 numbers
-
Players Pick Numbers Everyone (including the player in peril) picks their numbers from the die range. Example: On a d12 with 2 lives in peril → pick 2 numbers between 1–12.
-
Roll the Die Use a real or scripted dice object in SL to roll (matching your chosen type).
🎯 Check the Result If the roll matches another player's pick → That player becomes the new person in peril
If the roll matches no one, or the peril player’s own pick → The peril player loses 1 life and stays in peril
💀 Elimination When a player reaches 0 lives, they're eliminated from the game.
🏆 Winning the Game The last remaining player with lives wins!
✅ Game Example 4 players, using a d12
Alice is in peril with 2 lives
Everyone picks 2 numbers:
makefile
Copy
Edit
Bob: 3, 7
Carol: 6, 11
Dave: 2, 9
Alice: 1, 12
🎲 Roll = 6 → Carol becomes the new person in peril
📟 PERIL DICE TRACKER HUD GUIDE Touch the tracker to access the menu:
🔘 Set Dice Pick d6, d12, or d20 — defines the range of possible numbers.
🔘 Pick Numbers Lets you pick numbers (based on how many the current person in peril is allowed). Your picks are shown in the floating text.
🔘 Set Yourself in Peril Marks you as the current player in peril. Everyone’s HUD will update with your name and lives.
🔘 Lose Life / Reset Lives Used only by the wearer of the HUD to manage their own lives. If you’re the player in peril, everyone else will see your life change reflected in their menus.
🧠 Odds of Rolling a Specific Number Here’s the chance of any one number being rolled:
Dice Total Sides % Chance per Number d6 6 16.7% d12 12 8.3% d20 20 5.0%
The more numbers you can pick, the better your odds — but lives are limited!