LlRezObjectWithParams
Looking for the current API? Open the llRezObjectWithParams reference →
Wiki description
Instantiate
inventory object at pos with an initial set of parameters specified in params.pos will default to the position of the object containing the script, unless REZ_POS is specified. (see below)Return value notes
Returns a key which will be the key of the object when it is successfully rezzed in the world. On failure, returns
(key)"" (in LSL), or NULL_KEY (in Lua).Specification
Parameters
| parameter | integer value | values to set | description | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| REZ_PARAM | 0 | integer param | Start parameter passed into the rezzed object's on_rez(integer) event. | |||||||||||||||||||||||||||
| REZ_FLAGS | 1 | integer flags | Flags applied to rezzed object when it is created in the world.Flags
| |||||||||||||||||||||||||||
| REZ_POS | 2 | vector pos, integer relative, integer at_root | Position to rez the new object in the world. If relative is FALSE the position is in region coordinates. If relative is TRUE, the position will be relative to the rezzing object. If at_root is FALSE, the center of the object will be at the position specified by pos(llRezObject). Set at_root to TRUE to set the position of the root prim(llRezAtRoot). | |||||||||||||||||||||||||||
| REZ_ROT | 3 | rotation rot, integer relative | The initial rotation to apply to the object. If relative is TRUE, the rotation is relative to the rezzing object, otherwise it is absolute. | |||||||||||||||||||||||||||
| REZ_VEL | 4 | vector velocity, integer local, integer inherit | The initial velocity to apply to the object. If local is TRUE the velocity is in the local object coordinate frame, otherwise it is in world coordinates. If inherit is TRUE the object also inherits it's rezzer's velocity. | |||||||||||||||||||||||||||
| REZ_ACCEL | 5 | vector force, integer local | A constant force to apply to the object. If local is TRUE, the force vector is in local coordinates. | |||||||||||||||||||||||||||
| REZ_OMEGA | 7 | vector axis, integer local, float spin, float gain | Spin the object around the specified axis. If local is TRUE that axis is in local coordinates, otherwise they are global. | |||||||||||||||||||||||||||
| REZ_DAMAGE | 8 | float damage | The amount of damage applied to an agent upon collision with this object. | |||||||||||||||||||||||||||
| REZ_SOUND | 9 | string sound, float volume, integer loop | A sound to attach to this object. It will be played at the specified volume. If loop is TRUE the sound will loop continuously for the life of the object. The sound parameter may be either a sound file in the rezzer's inventory or the UUID of a sound asset. | |||||||||||||||||||||||||||
| REZ_SOUND_COLLIDE | 10 | string sound, float volume | A sound to play upon collision with another object, the ground or an avatar. The sound parameter may be either a sound file in the rezzer's inventory or the UUID of a sound asset. | |||||||||||||||||||||||||||
| REZ_LOCK_AXES | 11 | vector locks | Prevent the object from spinning on certain axes. Setting the vector's coordinate to non-zero will prevent the object from spinning on that axis. For instance will allow the object to only rotate around its Z-axis. | |||||||||||||||||||||||||||
| REZ_DAMAGE_TYPE | 12 | integer damage_type | The damage type to apply when this prim collides with another object. Can match one of the DAMAGE_TYPE_* constants, be a custom damage type or repurpose the damage field. | |||||||||||||||||||||||||||
| REZ_PARAM_STRING | 13 | string start_param | Pass an initialization string to the root prim of the newly rezzed object that may be read with llGetStartString from within the rezzed object. Maximum string length is 1024 bytes. |
Caveats
- Silently fails to rez
inventoryif REZ_POS is too far from the geometric center of the object trying to rezinventory(generally 10 meters; see llRezObject). - When scripting attachments meant to rez objects, remember that when used in the root of an (attached) attachment
llGetPosdoesn't return the position of the attachment but instead returns the position of the avatar's bounding box geometric center. Read llGetPos and llParticleSystem Caveats for more information. - If the object is unattached and the owner of the object does not have copy permission on
inventory, the object will no longer be present in inventory after it is rezzed (so another attempt to rez (the same object) will fail); if the owner does have copy permission, then a copy is rezzed, and the originalinventoryremains in inventory. - If the object is attached and the owner of the object does not have copy permission on
inventory, an error is shouted on DEBUG_CHANNEL: "Cannot rez no copy objects from an attached object." - Silently fails if you don't have offline building rights on the land. To have the right, your objects needs to either:
- Be on land you own yourself.
- Be on land where anyone is allowed to build, e.g. a sandbox.
- Be deeded to the group that owns the land.
- Be set to the same group that owns the land and the land have the parcel flag 'allow group to build' set.
- The group role "Always allow 'Create Objects'" will only work to override this when you are online, in the region, or have a child agent in the region. See SVC-3145 in the Issues subsection of Deep Notes for more information.
- See object_rez for examples on how to establish communications between the rezzing object and the new prim.
Examples
The list of parameters is entirely optional. If you want to rez an object exactly where the rezzer is, you may call the function with an empty list.
default
{
touch_start(integer total_number)
{
llRezObjectWithParams("Object", []);
}
}The below example rezzes an object slightly above the rezzer, slowly spinning and with automatic cleanup. See Temporary
default
{
touch_start(integer total_number)
{
llRezObjectWithParams("Object", [
REZ_FLAGS, REZ_FLAG_TEMP | REZ_FLAG_PHANTOM,
REZ_POS, <0,0,1>, TRUE, TRUE,
REZ_OMEGA, <0,0,1>, TRUE, 0.5, PI
]);
}
}The below is a basic example of firing a typical bullet from a worn attachment. The bullet is fired with a left-click during mouselook.
default
{
control(key id, integer level, integer edge)
{
integer click = level & edge;
if (click & CONTROL_ML_LBUTTON) {
llRezObjectWithParams("Bullet", [
REZ_POS, <2,0,0>, TRUE, TRUE, // Relative offset 2 meters forward
REZ_ROT, ZERO_ROTATION, TRUE, // Relative rotation
REZ_VEL, <100,0,0>, TRUE, FALSE, // Relative velocity 100m/s forward
REZ_DAMAGE, 40,
REZ_LOCK_AXES, <1,1,1>, // Disable all rotation
REZ_FLAGS, 0
| REZ_FLAG_PHYSICAL
| REZ_FLAG_TEMP
| REZ_FLAG_DIE_ON_COLLIDE
| REZ_FLAG_DIE_ON_NOENTRY
| REZ_FLAG_NO_COLLIDE_OWNER
| REZ_FLAG_NO_COLLIDE_FAMILY
| REZ_FLAG_BLOCK_GRAB_OBJECT
]);
}
}
run_time_permissions(integer perm)
{
if (perm) {
llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
}
}
attach(key id)
{
if (id) {
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
}
}
state_entry()
{
if (llGetAttached()) {
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
}
}
}Notes
Maximum rez distance
- The
distancescales with the size of the object the script is in.- The formula is
10 + llVecMag(llGetScale()) * 0.5
- The formula is
- The
distancemeasured is between the center of the rezzingprimand the center of theprimthat is rezzed.- The tests did not include rezzing from or the rezzing of link_set objects.
- A
0.01meter cube could rez just beyond10.0meters away. - A
10.0meter cube could rez just beyond18.66meters away. - A
32.0meter cube could rez just beyond37.71meters away. - A
64.0meter cube could rez just beyond65.42meters away.
See also: functions
See also: events
Shared wiki helpers
The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.
Template:LSL Function/inventory
Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<includeonly>{{#if:
{{:DEBUG_CHANNEL}}
{{#vardefine:p_{{{1|none}}}_desc|{{AAn|{{#if:{{{insert|}}}|{{{insert}}}|{{#if:{{{type|}}}|{{{type}}}|item}}}}}} in the {{LSLGC|Inventory|inventory}} {{#if:{{{remote|}}}|of the {{#if:{{{target|}}}|[[{{{target|}}}|target]]|target}} prim|of the prim this script is in}}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|{{#if:{{{empty|}}}|,| or}} a {{HoverLink|UUID|Universally Unique IDentifier}}{{#if:{{{type|}}}| of {{AAn|{{{type}}}}}}}}}{{#if:{{{empty|}}}| or an empty string{{#ifeq:{{{empty}}}|*|| {{{empty}}}}}}}{{#var:p_{{{1|none}}}_desc}}}}
{{#vardefine:p_{{{1|none}}}_hover|{{AAn|{{#if:{{{insert|}}}|{{{insert}}}|{{#if:{{{type|}}}|{{{type}}}|item}}}}}} in the inventory {{#if:{{{remote|}}}|of the target prim|of the prim this script is in}}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|{{#if:{{{empty|}}}|,| or}} a UUID{{#if:{{{type|}}}| of {{AAn|{{{type}}}|{{{type_hover|{{{type}}}}}}}}}}}}{{#if:{{{empty|}}}| or an empty string{{#ifeq:{{{empty}}}|*|| {{{empty_hover|{{{empty}}}}}}}}}}{{#var:p_{{{1|none}}}_hover}}}}
{{#vardefine:caveats{{#var:direction}}|{{#if:{{#if:{{{no_caveat|}}}||{{{1|}}}}}|{{#var:caveats{{#var:direction}}}}
{{#if:{{{empty|}}}|* If {{LSLP|{{{1}}}}} is not an empty string and...
**{{LSLP|{{{1}}}}} is missing from the prim's inventory {{#if:{{{full|}}}|or not {{HoverLink|:Category:LSL_Permissions/Asset|copy, mod and transfer|full permissions}}}} {{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|and it is not a {{HoverLink|UUID|Universally Unique IDentifier}}}} {{#if:{{{type|}}}|or it is not {{AAn|{{{type|item}}}}}}} then {{#if:{{{silent|}}}|it fails silently|an error is shouted on {{#var:DEBUG_CHANNEL}}}}.
|* If {{LSLP|{{{1}}}}} is missing from the prim's inventory {{#if:{{{full|}}}|or not {{HoverLink|:Category:LSL_Permissions/Asset|copy, mod and transfer|full permissions}}}} {{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|and it is not a {{HoverLink|UUID|Universally Unique IDentifier}}}} {{#if:{{{type|}}}|or it is not {{AAn|{{{type|item}}}}}}} then {{#if:{{{silent|}}}|it fails silently|an error is shouted on {{#var:DEBUG_CHANNEL}}}}. }}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|
* If {{LSLP|{{{1}}}}} is a {{HoverLink|UUID|Universally Unique IDentifier}} then there are no new [[:Category:LSL_Permissions/Asset|asset permissions]] consequences for the object.
** The resulting object develops no new usage restrictions that might have occurred if the asset had been placed in the prims inventory.}}|{{#var:caveats{{#var:direction}}}}}}}}
{{{{#if:{{{volume|}}}|LSL Function/volume}}|{{{volume|}}}|}}
}}</includeonly><noinclude>
{{Multi-lang}}
{{UpdateLink}}
{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=true}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=true}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}
{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=false}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=false}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}
{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=landmark|uuid=true|empty=(for teleporting within the same region)}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=landmark|uuid=true|empty=(for teleporting within the same region)}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}
</noinclude>Template:LSL Function/position
Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<noinclude>
This template is to be used to specify setup the description for position like parameters (offsets, positions, points, etc.).
Right now it's pretty basic and easy to edit. I'm wondering if these functions should be in a position parameter specific category.
====TODO====
* add clamping flag and verbiage for out of region/range coordinates.
</noinclude>{{#if:
{{#if:{{{region|}}}|
{{#if:{{{local|}}}|
{{#vardefine:p_{{{1|}}}_desc|position in {{HoverLink|Viewer coordinate frames#Region|Origin is the origin of the region which {{String|owns}} the object.|region}} or [[Viewer coordinate frames#Local|local coordinates]] depending upon the situation{{{desc|}}}}}
{{#vardefine:p_{{{1|}}}_hover|position in region or local coordinates depending upon the situation{{#if:{{{hover|}}}|{{{hover|}}}|{{{desc|}}}}}}}
|
{{#ifeq:{{{1|}}}|point|
{{#vardefine:p_{{{1|}}}_desc|A point in {{HoverLink|Viewer coordinate frames#Region|Origin is the origin of the region which {{String|owns}} the object.|region-local}} space{{#ifeq:{{{region|}}}|noZ| (z component is ignored)}}{{{desc|}}}}}
{{#vardefine:p_{{{1|}}}_hover|A point in region-local space{{#ifeq:{{{region|}}}|noZ| (z component is ignored)}}{{#if:{{{hover|}}}|{{{hover|}}}|{{{desc|}}}}}}}
|
{{#vardefine:p_{{{1|}}}_desc|position in {{HoverLink|Viewer coordinate frames#Region|Origin is the origin of the region which {{String|owns}} the object.|region coordinates}}{{#ifeq:{{{region|}}}|noZ| (z component is ignored)}}{{{desc|}}}}}
{{#vardefine:p_{{{1|}}}_hover|position in region coordinates{{#ifeq:{{{region|}}}|noZ| (z component is ignored)}}{{#if:{{{hover|}}}|{{{hover|}}}|{{{desc|}}}}}}}
}}
}}
|
{{#if:{{{local|}}}|
{{#ifeq:{{{1|}}}|offset|
{{LSL Function/offset|{{{1|}}}|local={{{local}}}}}
|
{{#vardefine:p_{{{1|}}}_desc|position in [[Viewer coordinate frames#Local|local coordinates]]{{{desc|}}}}}
{{#vardefine:p_{{{1|}}}_hover|position in local coordinates{{#if:{{{hover|}}}|{{{hover|}}}|{{{desc|}}}}}}}
}}
}}
}}
}}Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.