Script rez

From The SchomEmunity Wiki
Jump to: navigation, search

This is for making a sort of holodeck.

To make it work:
Create an object, name it "rezzer", and put the first script in it.
Create another object name it "object", and put the second script in it.
Put the second object inside the first object.
Now when you click on the rezzer, it will alternately rez and unrez the object.

First script:

integer rezzed = 0;

default
{
    state_entry()
    {

    }

    touch_start(integer total_number)
    {
        if(!rezzed){
            llRezObject("object",llGetPos()+<0,0,1>,ZERO_VECTOR,ZERO_ROTATION,42);
            rezzed = TRUE;
        }else{
            llSay(154,"unrez!");
            rezzed = FALSE;
        }
    }
}

Second script:

default
{
    state_entry()
    {
        llListen(154,"rezzer",NULL_KEY,"unrez!");
    }

    listen(integer channel, string name, key id, string message)
    {
        llDie();
    }
            
    touch_start(integer total_number)
    {
        
    }
}

This can only rez one object, but it can easily be modified to rez multiple objects; or, you could link a bunch of objects together and rez that.