Script disappear

From The SchomEmunity Wiki
Jump to: navigation, search

This script makes the object containing it turn invisible and phantom, effectively making it disappear; it is already being used in the volcano sumo. To activate it, type "appear" or "disappear".
As with my other voice-activated scripts, it is not case-sensitive.

string sentence = "";

integer said(string word, string sentence)
{
    string lowerCaseSentence = llToLower(sentence);
    integer saidWord = llSubStringIndex(lowerCaseSentence,word);
    if(saidWord != -1)
    {
        return TRUE;
    }else{
        return FALSE;
    }
}

default
{
    state_entry()
    {
        llListen(0,"",NULL_KEY,"");
    }
    
    listen(integer channel, string name, key id, string sentence)
    {
        if(said("appear",sentence)){
            llSetAlpha(100,ALL_SIDES);
            llSetPrimitiveParams([PRIM_PHANTOM,FALSE]);
        }
        if(said("disappear",sentence)){
            llSetAlpha(0,ALL_SIDES);
            llSetPrimitiveParams([PRIM_PHANTOM,TRUE]);
        }
    }
}