The Xash Contest Board broadcasts several link messages to the linkset (LINK_THIS) when events occur, such as a state change, a contestant joining, a vote being cast, or a winner being announced.
This allows third-party scripts placed inside the Contest Board object to react to these events (for example, to trigger custom particle effects, control venue lighting, play sounds, or update external displays).
To receive notifications from the Contest Board, implement the link_message event handler in your script. The board sends the following messages:
| Message | Description | integer num |
string str |
key id |
|---|---|---|---|---|
MSG_STATE_CHANGED |
Triggered when the contest board changes its phase or state. | 33100 |
The new state integer:
|
– |
MSG_CONTESTANT_JOINED |
Triggered when a new contestant registers/joins the contest. | 33101 |
– | The UUID of the contestant who registered. |
MSG_VOTE_CAST |
Triggered when a voter casts a vote for a contestant. | 33102 |
The UUID of the contestant who received the vote. | The UUID of the voter who cast the vote. |
MSG_SHOUT_WINNER |
Triggered when a winner is paid out and announced. | 33009 |
The payout details formatted as "{amount}|{rank}" (where {amount} is the L$ prize amount and {rank} is the finishing rank, e.g., "1", "2", "3"). |
The UUID of the winning contestant. |
Copy the following constants for use in your LSL script:
integer MSG_STATE_CHANGED = 33100;
integer MSG_CONTESTANT_JOINED = 33101;
integer MSG_VOTE_CAST = 33102;
integer MSG_SHOUT_WINNER = 33009;
integer STATE_INACTIVE = 0;
integer STATE_ENTRIES = 1;
integer STATE_VOTING = 2;
integer STATE_WINNERS = 3;
Here is an example of an LSL script that listens to the Contest Board public API to trigger custom logic:
// Public API Constants
integer MSG_STATE_CHANGED = 33100;
integer MSG_CONTESTANT_JOINED = 33101;
integer MSG_VOTE_CAST = 33102;
integer MSG_SHOUT_WINNER = 33009;
integer STATE_INACTIVE = 0;
integer STATE_ENTRIES = 1;
integer STATE_VOTING = 2;
integer STATE_WINNERS = 3;
default
{
state_entry()
{
// Ready to receive messages from the Contest Board script
}
link_message(integer nSender, integer nNum, string strMessage, key keyUUID)
{
if (nNum == MSG_STATE_CHANGED)
{
integer nNewState = (integer) strMessage;
if (nNewState == STATE_INACTIVE)
llOwnerSay("Contest Board is now inactive.");
else if (nNewState == STATE_ENTRIES)
llOwnerSay("Contest is open for entries!");
else if (nNewState == STATE_VOTING)
llOwnerSay("Voting has started!");
else if (nNewState == STATE_WINNERS)
llOwnerSay("Announcing and paying the winners!");
}
else if (nNum == MSG_CONTESTANT_JOINED)
llOwnerSay("Contestant joined: secondlife:///app/agent/" + (string) keyUUID + "/about");
else if (nNum == MSG_VOTE_CAST)
{
key keyVoter = keyUUID;
key keyContestant = (key) strMessage;
llOwnerSay("Voter secondlife:///app/agent/" + (string) keyVoter + "/about voted for contestant secondlife:///app/agent/" + (string) keyContestant + "/about");
}
else if (nNum == MSG_SHOUT_WINNER)
{
list listParams = llParseStringKeepNulls(strMessage, ["|"], []);
string strAmount = llList2String(listParams, 0);
string strRank = llList2String(listParams, 1);
llOwnerSay("Winner rank " + strRank + " paid L$" + strAmount + ": secondlife:///app/agent/" + (string) keyUUID + "/about");
}
}
}