MPP - Random Object Spawner Script V1.5.2 - Documentation
Makes objects appear in your scene: one random item from your list, at a fixed spot or anywhere inside a radius, when a visitor clicks the spawner, every few minutes on its own, or when another script asks for it (an MPP - Action Button, a scheduler). Keeps the scene clean with a maximum of active objects, a cleanup chat command and a cleanup event. Access by permission mode, per-visitor "not allowed" message, optional sounds.
This script is standalone - it does not require any other MPP script to function.
New in V1.5: settings grouped by category, the access scheme shared by every MPP script (Access/Permission Mode (1-3) with a Whitelist and a Blacklist, avatar handles accepted), an Enable Click switch, a private Denied Text for refused clicks, the option to hide the spawner from denied visitors, a cleanup command that follows the permissions and must be typed exactly, a maximum of active objects that holds even under fast clicks, empty list slots skipped instead of destroying an object for nothing, Volume 0 = silent, and warnings in the script console for risky settings. Two settings of V1.4.7 are not carried over: read "Updating from V1.4.7" before you update spawners already placed in a scene.
Quick Start
- After purchase, the script is in your Inventory in Build mode. Add it to the object that will be the spawner: a pedestal, a chest, a machine.
- Fill
Spawn/Spawnable Clusterswith one or more cluster resources from your inventory (the objects to make appear). - Set
Spawn/Position Offset: where the objects appear, in meters from the spawner (for example<0,0,1>= one meter above it). LeaveSpawn/Spawn Radiusat 5 for a random spot around that point, or set it to 0 for the exact spot. - Choose who may click:
Access/Permission Mode (1-3)is 1 by default (you only). Set it to 3 for a spawner open to everyone. - Set
Spawn/Max Active Items(for example 10) so the scene never fills up: the oldest object is removed before a new one appears. - Build and visit: hover the spawner, read "Spawn Object", click.
The rest of this guide details every option.
How It Works
| Source | Setting | Cooldown | Access check |
|---|---|---|---|
| Click | Activation/Enable Click | Yes, for everyone | Access/Permission Mode (owner always allowed) |
| Auto spawn | Activation/Auto Spawn Minutes | No | None |
| Script Event (button, scheduler, your script) | Events/Spawn Event Name | Yes, the same | Events/Use Click Permission (see "Script Events") |
| Cleanup (chat command or event) | Activation/Clean Command, Events/Clean Event Name | No | Owner always; others per Permission Mode |
Each spawn picks one filled entry at random in Spawnable Clusters, computes the spawn point (spawner position + Position Offset, then a random point inside Spawn Radius, never below Min Spawn Height), removes the oldest object if Max Active Items is reached, creates the object with Rotation, and plays Spawn Sound at the new object.
In the Build panel the settings are grouped by category: Activation/, Spawn/, Access/, Events/, Sound/ and Debug/.
Activation
Activation/Enable Click(default On): visitors seeActivation/Hover Text("Spawn Object" by default, 128 characters at most) and click to spawn. Off = no click and no hover text at all; auto spawn, Script Events and the Clean Command still work. Use Off for a spawner driven only by a timer or a button.Activation/Cooldown Seconds(default 5, 0 to 600): after a spawn by click or by Script Event, the spawner waits this long for everyone. The hover text disappears during the delay and comes back at its end. Auto spawn ignores it. A silent tenth of a second always separates two spawns, even at 0.Activation/Auto Spawn Minutes(default 0 = Off, 1 to 60): one object appears on its own every N minutes, whatever the permissions, the cooldown orEnable Click. SetMax Active Itemswith it, or the scene fills up.Activation/Clean Command(default/CleanSpawned): typed exactly in Nearby Chat (case does not matter), removes every object this spawner created./CleanSpawned nowor/CleanSpawnedBallsdo not match. The scene owner can always use it; visitors only ifPermission Modeallows them (a refused visitor gets no answer). Lines written in the chat by scripts are ignored. Empty = no command.
Spawn
| Setting | Default | What it does |
|---|---|---|
| Spawn/Spawnable Clusters | (empty) | Up to 20 cluster resources. Each spawn picks one filled entry at random. Empty slots are skipped and reported in the script console at start |
| Spawn/Position Offset | (none) | Offset in meters (X, Y, Z) from the spawner to the spawn point, in the scene axes (it does not turn with the spawner) |
| Spawn/Rotation | (none) | Rotation of each spawned object in degrees (X, Y, Z), absolute in the scene axes |
| Spawn/Spawn Radius | 5 | Radius in meters of the sphere around the spawn point where objects appear at random. 0 = always exactly at the spawn point |
| Spawn/Min Spawn Height | 1 | Absolute scene height (Z) in meters: a spawn point below it is raised to it, also with a radius of 0 |
| Spawn/Max Active Items | 0 | Most objects kept at once (1 to 100). At the limit the oldest one is destroyed before a new one appears. 0 = unlimited: set a limit on any spawner open to visitors |
Tip for a single-item rezzer: one entry in the list, Spawn Radius 0, Max Active Items 1. Each click replaces the object.
Access Control
Who can click, use the Clean Command and, with Use Click Permission On, send events, is set by one number and two lists, in the Access/ group. This is the scheme shared by every MPP script:
| Access/Permission Mode | Who is allowed |
|---|---|
| 1 - Owner only (default) | The scene owner only |
| 2 - Owner + Whitelist | The scene owner and the avatars of Access/Whitelist (empty list = owner only) |
| 3 - Everyone except Blacklist | Everyone, minus the avatars of Access/Blacklist (empty list = everyone) |
- The scene owner is always allowed, in every mode, even if listed in the Blacklist.
- A list that the current mode does not use is ignored, with a warning in the script console.
Access/WhitelistandAccess/Blacklist: avatar handles or avatar UUIDs, separated by commas or semicolons. Handles are not case sensitive and a leading@is ignored. Display names are not accepted. An old V1.4.7 entry of UUIDs separated by spaces still works: every UUID of it is read, the other words are ignored with a warning. Example:@morgane, friend-handle; 3f2c1a9e-0000-4c1e-9a55-1234567890ab.- Tip: turn
Debug/Debug LoggingOn and click with the avatar to add: the script console shows its handle and UUID, ready to paste. Access/Denied Text(default "You are not allowed to use this spawner."): private message sent to a visitor who clicks without being allowed, at most once every 5 seconds. Empty = silent. A refused Clean Command or Script Event is always silent.Access/Hide From Denied(default Off): denied visitors do not see the spawner as clickable (no highlight, no hover text). Applied to the avatars present at start and to each arriving avatar about 2 seconds after arrival, and kept after each cooldown. The access check on click always stays active.
Script Events (buttons, schedulers, your own scripts)
With Events/Enable Script Events On (default), the spawner listens to two Script Events:
| Event (default name) | Effect |
|---|---|
mpp_randomspawn_spawn (Events/Spawn Event Name) | Spawns one object, like a click, with the same cooldown |
mpp_randomspawn_clean (Events/Clean Event Name) | Removes every object this spawner created |
Several spawners with the same names all react to one event; give each spawner its own names to target them.
Who may send them: Events/Use Click Permission (default On):
- On: an event that carries the avatar who caused it (an MPP - Action Button does) follows
Access/Permission Mode, the owner always allowed. An event without an avatar (a timer, the Day Night scheduler, a script of your own without payload) passes only in mode 3. - Off: every spawn and clean event is accepted, with or without an avatar.
A refused event is silent for the visitor (Debug Logging writes it in the console). Empty event names are not listened to; the two names must differ.
From an MPP - Action Button: Send as Command On and Command 1 = mpp_randomspawn_spawn (or the clean name). From your own script: post the event name, and send the same data as Action Button when you want the access check to know the avatar (an object with a text property ActivatorAvatarUuid holding the avatar's UUID).
Sound
| Setting | Default | What it does |
|---|---|---|
| Sound/Spawn Sound | (none) | Played at the new object when it appears |
| Sound/Spawn Volume | 100 | 0 to 200 percent (100 = as recorded, 0 = no sound) |
| Sound/Clean Sound | (none) | Played at the spawner when the objects are removed |
| Sound/Clean Volume | 100 | 0 to 200 percent (0 = no sound) |
Editor Properties Reference (26 total)
Activation
| Property | Type | Default | Description |
|---|---|---|---|
| Activation/Enable Click | bool | On | Click on the spawner; Off = no click and no hover text |
| Activation/Hover Text | string | "Spawn Object" | Hover text (128 characters, 4 lines at most); empty = Spawn Object |
| Activation/Cooldown Seconds | number, 0-600 | 5 | Wait after a spawn by click or event, for everyone; hover text hidden meanwhile |
| Activation/Auto Spawn Minutes | integer, 0-60 | 0 | One spawn every N minutes on its own; 0 = Off |
| Activation/Clean Command | string | "/CleanSpawned" | Exact Nearby Chat command that removes the spawned objects; empty = Off |
Spawn
| Property | Type | Default | Description |
|---|---|---|---|
| Spawn/Spawnable Clusters | list of clusters | (empty) | The objects to spawn, one picked at random |
| Spawn/Position Offset | Vector | (none) | Spawn point, in meters from the spawner |
| Spawn/Rotation | Vector | (none) | Rotation of the spawned objects, in degrees |
| Spawn/Spawn Radius | number, 0-1000 | 5 | Random distance around the spawn point; 0 = exact spot |
| Spawn/Min Spawn Height | number, -2000-2000 | 1 | Lowest scene height of a spawn point |
| Spawn/Max Active Items | integer, 0-100 | 0 | Objects kept at once, oldest removed first; 0 = unlimited |
Access
| Property | Type | Default | Description |
|---|---|---|---|
| Access/Permission Mode (1-3) | int (1-3) | 1 | 1 = Owner only, 2 = Owner + Whitelist, 3 = Everyone except Blacklist. The owner is always allowed |
| Access/Whitelist | string | "" | Handles or UUIDs allowed in mode 2 |
| Access/Blacklist | string | "" | Handles or UUIDs blocked in mode 3 |
| Access/Denied Text | string | "You are not allowed to use this spawner." | Private message for a refused click (empty = silent) |
| Access/Hide From Denied | bool | Off | Denied avatars do not see the spawner as clickable |
Events
| Property | Type | Default | Description |
|---|---|---|---|
| Events/Enable Script Events | bool | On | Listens to the two events below |
| Events/Spawn Event Name | string | "mpp_randomspawn_spawn" | Spawns one object (same cooldown as a click); empty = off |
| Events/Clean Event Name | string | "mpp_randomspawn_clean" | Removes the spawned objects; empty = off |
| Events/Use Click Permission | bool | On | On = the event's avatar must pass Permission Mode (no avatar: mode 3 only). Off = every event accepted |
Sound
| Property | Type | Default | Description |
|---|---|---|---|
| Sound/Spawn Sound | SoundResource | (none) | Sound at the new object |
| Sound/Spawn Volume | integer, 0-200 | 100 | Loudness in percent (0 = no sound) |
| Sound/Clean Sound | SoundResource | (none) | Sound at the spawner on cleanup |
| Sound/Clean Volume | integer, 0-200 | 100 | Loudness in percent (0 = no sound) |
Debug
| Property | Type | Default | Description |
|---|---|---|---|
| Debug/Debug Logging | bool | Off | Writes spawns, cleanups, access decisions (with the avatar handle and UUID) and the start state to the script console |
Version Notes
| Version | What changed |
|---|---|
| V1.4.6 | Max Active Items: a limit of active objects, the oldest replaced first (1 = single-item rezzer) |
| V1.4.7 | Sold until V1.5.2 |
| V1.5.0 | Settings grouped by category; Clean Command exact, following the permissions (the owner always); Denied Text for refused clicks; Max Active Items held under fast clicks; empty list slots skipped; 0.1 s safety between spawns; Volume 0 = silent; handles accepted in the lists; auto spawn keeps going after an error; warnings at start |
| V1.5.1 | Permission Mode as a number (never sold) |
| V1.5.2 (this version) | Access/Permission Mode (1-3), the scheme shared by every MPP script, with Whitelist and Blacklist; Activation/Enable Click; Access/Hide From Denied; Use Click Permission decides alone what happens to events without an avatar (Allow Without Avatar removed) |
Updating from V1.4.7
Before you update, take a screenshot of the Build panel of one spawner of each kind. Two settings are replaced by new ones and their values are not carried over.
- Your other values carry over: the list of clusters, positions, radius, height, limit, hover text, cooldown, auto spawn, clean command, both lists, sounds, volumes and event names keep their internal names and their values. The panel now shows plain labels in six groups instead of the raw names (
ReadyPromptisActivation/Hover Text,SpawnDelayisActivation/Cooldown Seconds,ClickWhitelistCsvisAccess/Whitelist, and so on). - Permission Mode: replaced by
Access/Permission Mode (1-3), which starts at 1 = Owner only on every updated spawner: visitors cannot click until you set it again. Use your screenshot:
| V1.4.7 Permission Mode | V1.5.2 |
|---|---|
| Nobody | Activation/Enable Click Off (auto spawn and events keep working; set Permission Mode for the events) |
| Everyone | Permission Mode 3, Blacklist empty |
| OwnerOnly | Permission Mode 1 (nothing to do) |
| WhitelistOnly, OwnerAndWhitelist | Permission Mode 2 (the owner is now always allowed) |
| BlacklistOnly | Permission Mode 3 with your list in Blacklist |
- Allow Without Avatar: removed. With
Events/Use Click PermissionOn, an event without an avatar now passes in mode 3 only; turnUse Click PermissionOff to accept every event, as the old switch did. - Three new settings:
Activation/Enable Click(On),Access/Denied Text(a private message for refused clicks; empty it for the V1.4.7 silence) andAccess/Hide From Denied(Off). - What behaves differently: the Clean Command must be typed exactly and follows the permissions (in V1.4.7 anyone could clean everything); a lone word in an old list (a label like
Friends) is now read as a handle, so check your lists;Spawn VolumeandClean Volume0 are now silent; a cleanup launched while an object is being created can leave that one object, the next cleanup removes it.
Recipes
A - A pedestal that shows one item. One entry, Spawn Radius 0, Max Active Items 1, Permission Mode 3: each click replaces the item on the display spot.
B - Random props over time. Several entries, Auto Spawn Minutes 5, Max Active Items 10, Enable Click Off: props appear on their own, never more than ten.
C - A loot button. An MPP - Action Button with Send as Command On and Command 1 = mpp_randomspawn_spawn; on the spawner, Use Click Permission On and Permission Mode 3 so everyone can press it, Max Active Items set.
D - A reward for your staff. Permission Mode 2 with their handles in Whitelist, Hide From Denied On: visitors do not even see the spawner as clickable.
E - A cleanup button for you. An MPP - Action Button with Command 1 = mpp_randomspawn_clean and Access/Permission Mode 1 on the button; or simply type /CleanSpawned in the chat.
Troubleshooting
| Symptom | Check |
|---|---|
| Visitors cannot click after the update | Access/Permission Mode starts at 1 (owner only): set 3, or 2 with a Whitelist (see "Updating from V1.4.7") |
| Nothing appears on click | Spawnable Clusters filled? A warning at start names an empty list. The hover text hidden = cooldown running |
| No hover text at all | Activation/Enable Click Off, or you are a denied visitor with Hide From Denied On, or the cooldown is running |
| The object appears under the floor or too far | Check Position Offset (scene axes, not the spawner's), Spawn Radius, Min Spawn Height |
/CleanSpawned does nothing | Typed exactly, alone in Nearby Chat? As a visitor, you must be allowed by Permission Mode. The owner can always clean |
| My button does nothing | Events/Enable Script Events On, same event name on both sides? With Use Click Permission On, the visitor must be allowed; an event without avatar passes in mode 3 only |
| The scene fills up | Set Spawn/Max Active Items |
| A visitor in my list is still refused | Handles or UUIDs, not display names; Permission Mode must use that list (2 for the Whitelist, 3 for the Blacklist). Turn Debug/Debug Logging On to read the handle |
| Warnings at start | They name the setting to fix: empty list, same name for both events, a list not used by the mode, no way to spawn (click Off, auto spawn 0, no event), unlimited items on a spawner open to visitors |
Limits
- The cooldown is shared by everyone: one spawn per cooldown, whoever clicks.
- The Clean Command answers only exact lines typed by avatars; text posted by other scripts is ignored.
Position OffsetandRotationare in the scene axes: turning the spawner does not turn its spawn point.- Up to 20 entries in
Spawnable Clustersand 100 active objects.
Related MPP Items
| Item | What it adds |
|---|---|
| Action Button Script (V1.7.1) | Spawn and cleanup buttons with mpp_randomspawn_spawn and mpp_randomspawn_clean, with their own access control. Store: https://www.sansar.com/store/listings/3e1a3546-6c79-4527-bc1e-78d02648d19e/action-button-script |
| MPP - Day and Night Sky Cycle | Its scheduler can post the spawn event at a given hour (an event without avatar: Use Click Permission Off or Permission Mode 3) |
MPP - My Pretty Pixels. Random Object Spawner Script V1.5.2 (script MPP - Random Object Spawner). Store: https://www.sansar.com/store/listings/1de81a6d-1e59-4b68-9423-c11b4deaa61d/random-object-spawner-script