Temp-Rez Build Systems
Temp-Rez Build Systems — Free class in Alife Virtual School
Welcome, creators, to Alife Virtual School! In today's advanced workshop, we'll master one of the most powerful techniques in any creator's toolkit: designing Temp-Rez Build Systems. In a bustling, content-rich metaverse like Alife Virtual, land impact (or "prims") is the ultimate currency of creation. While our platform is uniquely generous, professional builders know that efficiency is the key to crafting truly spectacular, large-scale experiences. This class will teach you how to use LSL scripting to spawn complex objects on demand and have them automatically clean themselves up, saving thousands of prims and unlocking a new level of dynamic, interactive design for your virtual world projects.
This skill is essential for anyone serious about building in a free 3D world. It's the secret behind everything from holo-decks and on-demand vehicle rezzers to complex combat systems and interactive store displays. By mastering temp-rez, you're not just saving prims; you're creating smarter, more responsive, and more impressive environments that will set your creations apart in our rapidly expanding open simulator universe.
The Alife Advantage: Building Without Breaking the Bank
Before we dive into the technical details, it's crucial to understand why this skill is so uniquely empowering within the Alife Virtual ecosystem. In other virtual worlds, managing prims isn't just a creative challenge—it's a financial one. High land costs and monthly fees force creators to constantly compromise. Here, we've removed those barriers, allowing your creativity to be the only limit. Let's look at a direct comparison:
| Feature / Cost | Alife Virtual | Leading Competitor (e.g., Second Life) |
|---|---|---|
| Private Island (65,536 sqm) | FREE, Forever | ~$300 USD per month + setup fees |
| Object & Texture Uploads | FREE & Unlimited | L$10 (~$0.04 USD) per upload |
| Land Impact (Prims) on Full Region | Generous limits on your FREE island | Tied to your expensive monthly tier |
| Virtual Economy | 100% Free Creation | Heavily commercialized, requires constant investment |
As you can see, the value proposition is staggering. While a builder in another metaverse might use temp-rez systems out of financial desperation, an Alife Virtual builder uses them as a mark of professional quality and creative ambition. You have a full, free region; now, let's learn how to make it feel like ten regions in one.
What You Will Learn
By the end of this class, you will be able to:
- Understand the core concept of temporary rezzing and its benefits.
- Write an LSL script that rezzes an object from a prim's inventory upon touch.
- Utilize the
TEMP_ON_REZflag to make spawned objects temporary. - Implement a self-destruct timer on the rezzing device for a clean, one-shot operation.
- Request and handle script permissions gracefully.
- Calculate and use relative offsets for precise object placement.
- Apply these techniques to create sophisticated, multi-object build systems.
Prerequisites
This is an advanced class. To succeed, you should already be comfortable with the following:
- Basic LSL Scripting: You understand variables, functions, events (especially
state_entry,touch_start, andtimer), and control structures (if/else). - Alife Virtual Building: You know how to create, position, and link prims.
- Inventory Management: You know how to place objects and scripts from your personal inventory into a prim's content inventory.
- Viewer Proficiency: You are familiar with the build and script editor windows in a viewer like Firestorm, which is fully compatible with Alife Virtual.
Tutorial: Building Your First Temp-Rez System
Let's build a simple, practical system: a "rezzing disc" that, when touched, spawns a comfortable armchair and then vanishes. The armchair will automatically disappear after a set time. This is the foundational model for almost all temp-rez systems.
Step 1: Create the Components
We need three things to start:
- The Rezzer: Create a simple prim. A flat cylinder or a cube works well. This will be our rezzing device. Let's name it "Armchair Rezzer".
- The Payload: Create or find the object you want to rez. For this example, build a simple armchair from a few prims and link them together. Name the final linked object "AVS Armchair".
- The Script: Create a new script in your inventory. We'll call it "Temp-Rez Script".
Crucial Setup: Take the "AVS Armchair" object from the world into your inventory. Then, drag both the "AVS Armchair" and your "Temp-Rez Script" from your inventory into the Contents tab of the "Armchair Rezzer" prim.
Step 2: The LSL Script - A Line-by-Line Breakdown
Open the "Temp-Rez Script" inside the rezzer prim. Delete the default "Hello, Avatar!" code and let's build our script from scratch.
// Alife Virtual School - Class 24: Temp-Rez Build Systems
// --- SCRIPT START ---
// The name of the object we want to rez from this prim's inventory.
string payloadObject = "AVS Armchair";
// How long (in seconds) the rezzer will wait before deleting itself after rezzing.
float selfDestructTimer = 5.0;
// How long (in seconds) the rezzed temporary object will last.
// NOTE: This is a default, typically around 30-180 seconds depending on platform settings.
// We are relying on the default TEMP_ON_REZ behavior.
integer tempLifetime = 60; // For our planning purposes.
default
{
state_entry()
{
// When the script starts, it asks for permission to rez objects.
// This is essential for the llRezObject function to work.
llRequestPermissions(llGetOwner(), PERMISSION_REZ_OBJECT);
}
run_time_permissions(integer permissions)
{
// This event triggers after the owner responds to the permission dialog.
if (permissions & PERMISSION_REZ_OBJECT)
{
// If permission was granted, we make the object touchable.
llSetText("Touch to Rez Armchair", <1.0, 1.0, 1.0>, 1.0);
llSetTouchText("Rez");
}
else
{
// If permission was denied, the script can't work.
llOwnerSay("I need permission to rez objects to function properly.");
}
}
touch_start(integer total_number)
{
// This event fires when someone touches the rezzer prim.
// 1. Calculate the rezzing position. We'll rez it 1 meter in front of the rezzer.
vector rezPos = llGetPos() + <1.0, 0.0, 0.0> * llGetRot();
// 2. Get the rezzer's rotation to align the new object.
rotation rezRot = llGetRot();
// 3. The magic function: llRezObject!
// llRezObject(object name, position, velocity, rotation, parameter);
llRezObject(payloadObject, rezPos, ZERO_VECTOR, rezRot, tempLifetime);
// 4. Give the user feedback.
llOwnerSay("Armchair rezzed! It will disappear in " + (string)tempLifetime + " seconds.");
// 5. Start the timer to make this rezzer prim delete itself.
llSetTimerEvent(selfDestructTimer);
// 6. Make the rezzer non-touchable to prevent spamming.
llSetText("", ZERO_VECTOR, 0.0);
}
timer()
{
// This event fires after the time set by llSetTimerEvent.
// Clean up the rezzer prim itself.
llDie();
}
}
// --- SCRIPT END ---
Step 3: Understanding the Key Functions and Concepts
llRequestPermissions(key owner, integer perm)
This is your script's way of politely asking the object owner for the power to do something potentially disruptive. PERMISSION_REZ_OBJECT is the specific permission needed. The script won't proceed until you click "Yes" on the dialog that appears.
run_time_permissions(integer permissions)
This event is the callback for your request. The script checks if the permission was granted. This is the proper, modern way to handle permissions, far better than just failing silently.
llRezObject(string name, vector pos, vector vel, rotation rot, integer param)
This is the star of the show. Let's break down its arguments:
string name: The exact name of the object in the prim's inventory ("AVS Armchair").vector pos: The world coordinates where the object will appear. We calculate this relative to the rezzer.vector vel: The initial velocity for the object. We useZERO_VECTORas we don't want it to fly away.rotation rot: The initial rotation. We use the rezzer's rotation so it faces the same way.integer param: This is the secret sauce. Historically, this was used for various things, but in modern LSL, setting this to a non-zero integer makes the object temporary. The integer value is the lifetime of the temporary object in seconds. So, a value of60makes it temporary for 60 seconds.
Pro Tip: Relative Positioning
Never hard-code world coordinates (e.g.,<128, 128, 30>) for rezzing. Your system will break if you move it. Always calculate the position relative to the rezzer usingllGetPos()andllGetRot(). The linellGetPos() + <1.0, 0.0, 0.0> * llGetRot()is a standard LSL idiom for "1 meter in front of me."
llSetTimerEvent(float sec) and timer()
This pair of functions creates a simple countdown. llSetTimerEvent(5.0) tells the script, "Wake me up in 5 seconds." When the 5 seconds are up, the code inside the timer() event runs.
llDie()
This function instructs the prim containing the script to delete itself from the world. It's the perfect way to clean up our one-shot rezzer, returning its prim cost to your land allowance instantly.
Step 4: Test Your System!
Save your script. If there are no errors, you should get a permission request in the top right of your screen. Click "Yes". The text on the rezzer should change. Touch it. If everything is set up correctly:
- The "AVS Armchair" will appear 1 meter in front of the rezzer.
- You'll get a confirmation message in local chat.
- 5 seconds later, the "Armchair Rezzer" disc will vanish.
- 60 seconds after it appeared, the "AVS Armchair" will also vanish.
Congratulations! You've just built a fully functional, self-cleaning temp-rez system.
Common Mistake: "Object not found in inventory"
The most common error is a mismatch between thepayloadObjectvariable in the script and the actual name of the object in the prim's contents. Names must be identical, including spaces and capitalization. Double-check them!
Advanced Applications
A single temp-rez object is just the beginning. This technique is a gateway to incredible complexity and interactivity, all while maintaining a low prim count on your free Alife Virtual island.
- Scene Changers & Holo-decks: Imagine a single button that rezzes an entire forest scene, a sci-fi cityscape, or a medieval dungeon. This is done by having a controller script rez multiple "payload" objects (trees, buildings, props) at calculated offsets.
- On-Demand Vehicles: Create a garage where touching a display model of a car rezzes a fully driveable, temporary version. This saves you from having dozens of high-prim vehicles permanently rezzed.
- Combat and Defense Systems: Temporary rezzing is the foundation of projectile weapons (bullets, rockets), temporary shields, and explosion effects in the virtual economy of combat sims.
- Interactive Retail: In a store, instead of displaying 50 variations of a couch, have one display model. When touched, a menu appears, and selecting a fabric rezzes a temporary version of the couch in that fabric for the customer to inspect.
- Staged Assembly: A master controller can contain multiple rezzer prims. It can rez the first one, which then rezzes a part of a building and the *next* rezzer prim in the sequence. This allows you to "grow" massive, complex structures piece by piece in a visually stunning animation.
Practice Exercise: The Campsite Builder
Now it's your turn to build something more complex. Your assignment is to create a "Campsite Kit" system.
- Create a master object, like a small "Supply Crate".
- Create the payload objects: a "Campfire" and a "Log Seat".
- Place the Campfire and TWO copies of the Log Seat into the Supply Crate's inventory. You can rename them "Log Seat 1" and "Log Seat 2" if you wish, or you can just rez "Log Seat" twice.
- Write a script for the Supply Crate that, on touch, rezzes the Campfire in front of it, and the two Log Seats on either side of the campfire.
- All three objects should be temporary, lasting for 120 seconds (2 minutes).
- The Supply Crate should delete itself 10 seconds after rezzing the campsite.
Hint: You will need to call llRezObject() three times, each with a different calculated rezPos.
Frequently Asked Questions (FAQ)
- Q1: Do temporary objects count against my land's prim limit?
- A: Yes, but only for the duration of their short life. The moment they auto-delete, the prims are returned to your region's allowance. This is the entire point—you can have a 10,000-prim experience that only uses 100 prims of "permanent" rezzers.
- Q2: What is the maximum lifetime for a temporary object?
- A: This can vary by platform, but on most Open Simulator grids like Alife Virtual, it's typically a few minutes (e.g., 180 seconds). It is not meant for long-term rezzing. The
paraminllRezObjectis often capped, so setting it to a huge number might not work as expected. - Q3: Why not just rez a normal object and have a script inside it delete it later?
- A: You could, but
TEMP_ON_REZis far more reliable and efficient. If a scripted self-delete fails due to a script error or region lag, you are left with permanent "litter" that you have to clean up manually. The temporary flag is handled at the server level and is guaranteed to work, making it the professional choice. - Q4: Can other people trigger my temp-rezzer?
- A: Yes, the
touch_startevent can be triggered by anyone by default. You can easily restrict this by adding a check inside the event, like:if (llDetectedKey(0) == llGetOwner()) { ... }to make it owner-only, or by checking against a group role or access list.
Your Creative Journey Starts Here
You now possess the knowledge to build dynamic, efficient, and impressive creations that were previously beyond your reach. The ability to manipulate the very fabric of the virtual world on-demand is a superpower. On a platform like Second Life, exploring this level of creativity would cost you thousands of dollars a year in tier fees. Here in Alife Virtual, it costs you nothing.
You have a FREE 65,536 sqm private island. You have FREE unlimited uploads for your mesh, textures, and animations. You have a powerful, professional-grade avatar from the moment you arrive. You have a 100% free virtual economy where your only investment is your time and imagination.
What will you build with this power?
Don't have your free island yet? Join Alife Virtual today! It's 100% free to sign up, download the Firestorm viewer, and claim your own piece of the metaverse. We can't wait to see what you create.
🎓 Ready to Practice In-World?
Get your FREE island and practice everything you just learned — no credit card, no monthly fees.
Claim Your Free Island Now →No credit card required · Takes 2 minutes · Your island is FREE forever