Vendor Events for Your Scripts
The Fasty Vendor script tells the other scripts in the same object what happens: a payment came in, a purchase was confirmed, money went back, the product changed. Use it to play a sound, light up the board, open a door, show Sold out… Your script only listens: it never touches money or delivery.
The message
Every event is a link_message sent to LINK_SET:
num | str | id |
|---|---|---|
| -3278 | EVENT|field|… | the avatar (or NULL_KEY) |
Read it with llParseStringKeepNulls(str, ["|"], []).
Events
| Event | When | Fields after the name | id |
|---|---|---|---|
PAID | The L$ came in and the vendor saved the sale. Not confirmed yet. | sale ID, amount, recipient's key (gift; empty = for themselves) | who paid |
CONFIRMED | Fasty (or a hub, if the server was down) accepted the sale: the delivery is guaranteed. | sale ID, amount, product ID | who paid |
REFUND | The vendor gave the L$ back (nothing for sale, reserved for someone else, group price without the tag). | amount | who paid |
PRODUCT | The vendor's product changed (panel, price, sale, round of a payment request). | the product line (below); empty = not selling | NULL_KEY |
Only CONFIRMED means "bought"
React to PAID for instant feedback (a ding), but give anything that matters (a door, a role, a reward) only on CONFIRMED. A sale that got stuck while everything was down sends CONFIRMED when it's accepted, minutes or hours later.
Purchases paid entirely with a gift card or a free coupon, and Get Free, don't go through Pay, so they send no PAID or CONFIRMED.
The product line
PRODUCT|id|name|price|image|item|…|group price. The fields you'll want:
Position (after PRODUCT) | Field |
|---|---|
| 1 | product ID |
| 2 | name (escaped: use llUnescapeURL) |
| 3 | price in L$ (the sale price while one is running) |
| 4 | image (texture UUID, may be empty) |
| 11 | group price (empty = no group discount) |
The other positions are for the vendor itself; ignore them.
Example
Plays a sound on payment, thanks the buyer on confirmation, and shows the price above the board:
integer FASTY = -3278;
default
{
link_message(integer sender, integer num, string str, key id)
{
if (num != FASTY) return;
list f = llParseStringKeepNulls(str, ["|"], []);
string ev = llList2String(f, 0);
if (ev == "PAID")
llPlaySound("register", 1.0); // a sound in this object's inventory
else if (ev == "CONFIRMED")
llRegionSayTo(id, 0, "Thank you! Enjoy your purchase.");
else if (ev == "PRODUCT")
{
if (llList2String(f, 1) == "") llSetText("Sold out", <1, 0.4, 0.4>, 1.0);
else llSetText(llUnescapeURL(llList2String(f, 2)) + "\nL$ " + llList2String(f, 3), <1, 1, 1>, 1.0);
}
}
}Good to know
- Touches: your script gets its own
touch_start; the vendor doesn't repeat it. - The vendor only sends. It doesn't listen to link messages, so nothing a script says can make it pay or deliver.
- Keep your script in the same object (any prim). Events go to
LINK_SET. - These events come with the current
Fasty Vendorscript. Gacha machines have their own events.