Jump to content

Tutorial: An introduction to rezzing objects by script


Innula Zenovka
 Share

You are about to reply to a thread that has been inactive for 293 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Ok, what if the objects yes multiple objects are  no copy items set for sale. 

I already have a script that will  rez and position  the objects  but it only works  in one direction.  As the  script is modify is there a way to  put a few lines into the script   only in the rezzer to read that no matter  how it is positioned the objects will  rez out as the script  already  has been set up to rez the defined objects in it (ie 5 across 3 up/down on a shelving unit that is acting as the rezzer)  ? 

Currently  they only will  rezz out properly   from west to east   like that  but    if you move the   shelves  the script doesn't want to keep the different position (wall is a diagonal or  it should rez  E to W   as an example_ it still thinks the shelving unit is  facing  the original direction  

The only thing I am able to get to  function atm is the rotation of the  objects  individually and it  rez them out  correctly in a 5x3  rows but  only in one direction  

The objects can not have additional scripts  added to it  as they  are one of a kind items no copy no modify 

Edited by Chantilly Levee
attempting to be more clear and additional information
Link to comment
Share on other sites

  • 4 weeks later...

@Chantilly Levee

just don't multiply by the rezzer's rotation?

 touch_start(integer total_number)
    {    string myObj    = llGetInventoryName( INVENTORY_OBJECT,0 );        
         vector myPos    = llGetPos();       
         vector rezPos   = myPos + <2.0, 0.0, 0.2>; // or region coordinates
         vector rezVel   = <1.0, 0.0, 0.0>;
         rotation rezRot =  llEuler2Rot(<0.0, 0.0, 0.0> * DEG_TO_RAD );         
         integer param   = 10;        
         llRezAtRoot(myObj, rezPos, rezVel, rezRot, param);
    }

 

Link to comment
Share on other sites

  • 10 months later...
  • 1 month later...

@finiks66   sorry so late, but it may help others, so..

You can pass things thru the rez functions.

In the above code, the "param" variable can pass a channel to the rezzed object.

:: ignore accidental quote ::

Quote

if anyone knows how to get rid of a quote, ...i sure cant figure out how to remove this.

integer itemChan = 0x80000000 | (integer)("0x" + (string)llGetKey() );
llRezAtRoot(myObj, rezPos, rezVel, rezRot, itemChan);

 

 

and in the rezzed object...

on_rez(integer param)
{ // integer passedChan = param;
}

etc etc ..

Edited by Xiija
Link to comment
Share on other sites

2 hours ago, Xiija said:
integer itemChan = 0x80000000 | (integer)("0x" + (string)llGetKey() );
llRezAtRoot(myObj, rezPos, rezVel, rezRot, itemChan);

If your channel is based on they key of the rezzer, you can actually calculate that in the on_rez event of the child and save the parameter for some other information:

// rezed item script
on_rez(integer i)
{
  key parent = llList2Key(llGetObjectDetails(llGetKey(),[OBJECT_REZZER_KEY]),0);
  integer itemChan = 0x80000000 | (integer)("0x" + (string)parent );
  /// use itemchan in a listen etc. etc.
}

 

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

omg XD My brain is already on overload trying to take all of this in but I'm excited none the less. 

My big question is:

What if I wanted this to rez the object on touch and then kill the object on a second touch. I've tried this with other rezzer code but I always seem to get a Syntax error :(

Also (and this might be a bit of a reach so it's fine if it's not possible or too complicated) Might there be a way to make it only derez if the person who clicked it touches it a second time or if it's the owner or a VIP list? Barring that what about a long click? (Just to make sure rondos don't accidentally derez it before it's intended function is completed, while still letting anyone initialize the rez to start with) 

Edited by Rivengate
Misspell
Link to comment
Share on other sites

4 hours ago, Rivengate said:

What if I wanted this to rez the object on touch and then kill the object on a second touch. I've tried this with other rezzer code but I always seem to get a Syntax error :(

in LSL, there's no way to directly change the state of one object via a different object. you either need to make the rezzed object listen for a command from the rezzer, or change the user-interaction to touching the rezzed object to de-rez it.

4 hours ago, Rivengate said:

make it only derez if the person who clicked it touches it a second time or if it's the owner or a VIP list?

store the key of the person who touched it to initialize as a global variable, then test if the key of a new toucher is the same (==) or present in some list (-1!=llListFindList(whitelist,[uuidOfNewToucher]);)

//rezzer
integer gChanComm = -1342; // shared between rezzer and rezzed object.
list gWhitelist = 
[   "key of trusted person 1",
    "key of trusted person 2" // no final ','
];
key gWhoRezzed;
key gWhatIRezzed;

default
{   touch_end(integer n)
    {   key toucher = llDetectedKey(0);
        if(""==llKey2Name(gWhatIRezzed)) // the object isn't here anymore, rez it.
        {   //rez object
            gWhoRezzed = toucher;
        }else if(
           toucher == llGetOwner() ||
           toucher == gWhoRezzed ||
           -1!=llListFindList(gWhitelist,[toucher])
        ){
           llSay(gChanComm,"Please die.");
        }
    }
    object_rez(key k)
    {   gWhatIRezzed = k;
    }
}

rezzed object :

integer gChanComm = -1342;
default
{   object_rez(integer param)
    {   llListen(gChanComm,"",llList2Key(llGetObjectDetails(llGetKey(),[OBJECT_REZZER_KEY]),0),"Please die.");
    }
    listen(integer chan,string name,key ID,string text)
    {   llDie();
    }
}

or so (not tested)

Edited by Quistess Alpha
2 states for the rezzer was unnessesary, possibly confusing?
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 293 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...