// **** Texture Dropper Screen v1.11, by Mircea Kitsune & Sm0key **** // -------- Settings: -------- // Modify these to adjust the properties of your screen. Unless a specific value is required, use TRUE or FALSE. integer face = 0; //Primitive face to be used as screen. integer text = 2; //0 means no text, 1 displays lock status, 2 displays lock status and image + creator names. Selecting 2 clears the image between script restarts. integer notices = TRUE; //Echo information such as locking / unlocking of the screen and error messages in-world. integer lockdefault = FALSE; //Set to TRUE if the screen is to be locked by default. Relevant in the case of script restarts and when using the "clear" command. integer lockonpost = FALSE; //If TRUE the screen is locked once someone posts the first picture in it, useful for 'find and claim' screens. integer creatorlock = TRUE; //When lockonpost is also TRUE, this allows the creator of the displayed image to lock / unlock or clear the screen. string screenname = "screen"; //The name which best describes what your object is, used for info and text display (eg: screen, painting, monitor). string sound = ""; //A sound to be played each time a new image is posted. Leave this string empty to disable sounds. float soundvol = 1; //Volume of the sound specified above, can be anything between 0 and 1. // -------- Script: -------- // Modify anything below if you are a scripter and want to change something else in the script. string ScriptName; string InvName; string InvCreator; string Toucher; string Blank = "5748decc-f629-461c-9a36-a35a221fe21f"; //UUID of the blank texture. integer CmdChan = 9945; //System channel for llDialog. default { state_entry() { ScriptName = llGetScriptName(); llPreloadSound(sound); if(text == 2) //Set texture to blank when names are used to avoid images with no names between script restarts. { llSetTexture(Blank, face); llPlaySound(sound, soundvol); } else if(text != 1 | text != 2) { llSetText("", <0,0,0>, 0); } if(lockdefault == TRUE) { state locked; } else { state unlocked; } } } state locked { state_entry() { llAllowInventoryDrop(0); llListen(CmdChan, "", NULL_KEY, "" ); if(notices == 1) { llSay(0, "The " + screenname + " is now locked."); } if(text == 2 & InvName != "") { llSetText("[" + screenname + " locked] - " + InvName + " by " + InvCreator, <1,0.5,0.5>, 1); } else if(text == 1 | text == 2 & InvName == "") { llSetText("[" + screenname + " locked]", <1,0.5,0.5>, 1); } } touch_start(integer avatar) { Toucher = llDetectedKey(0); llSetTimerEvent(15); if (Toucher == llGetOwner()) { llDialog(llDetectedKey(0) , "You are the owner of this screen. What do you wish to do?", ["unlock", "clear"], CmdChan); } else if(lockonpost == TRUE & creatorlock == TRUE & llKey2Name(Toucher) == InvCreator) { llDialog(llDetectedKey(0) , "You have been identified as the creator of the currently posted image. What do you wish to do?", ["unlock", "clear"], CmdChan); } else { llSay(0, "The " + screenname + " is locked. The owner must first unlock it before you can display new pictures."); } } listen(integer channel, string name, key id, string message) { if(Toucher == llGetOwner() | lockonpost == TRUE & creatorlock == TRUE & llKey2Name(Toucher) == InvCreator) { Toucher = ""; //Protection so if an owner was the last to touch the object not anyone is able to manually chat an owner-only command on the channel. if(llToLower(message) == "unlock") { state unlocked; } if(llToLower(message) == "clear") { llSetTexture(Blank, face); llPlaySound(sound, soundvol); InvName = ""; InvCreator = ""; if(lockdefault == TRUE) { llSetText("[" + screenname + " locked]", <1,0.5,0.5>, 1); } else { state unlocked; } } } } timer() { Toucher = ""; //Further protection so if an owner ignores the dialog the screen does not remain vulnerable for anyone to chat an owner-only command to. llSetTimerEvent(0); } } state unlocked { state_entry() { llAllowInventoryDrop(1); llListen(CmdChan, "", NULL_KEY, "" ); if(notices == 1) { llSay(0, "The " + screenname + " is now unlocked."); } if(text == 2 & InvName != "") { llSetText("[" + screenname + " unlocked] - " + InvName + " by " + InvCreator, <0.5,1,0.5>, 1); } else if(text == 1 | text == 2 & InvName == "") { llSetText("[" + screenname + " unlocked]", <0.5,1,0.5>, 1); } } changed(integer mask) { if(mask & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY)) { if(llGetInventoryNumber(0)) //Texture dropped { InvName = llGetInventoryName(INVENTORY_TEXTURE, 0); key InvKey = llGetInventoryKey(InvName); InvCreator = llKey2Name(llGetInventoryCreator(InvName)); llRemoveInventory(InvName); llSetTexture(InvKey, face); llPlaySound(sound, soundvol); if(lockonpost == TRUE) { state locked; } else if(text == 2) { llSetText("[" + screenname + " unlocked] - " + InvName + " by " + InvCreator, <0.5,1,0.5>, 1); } } else //Something else dropped { integer Items = llGetInventoryNumber(-1); do { string InvName = llGetInventoryName(INVENTORY_ALL, --Items); if (InvName != ScriptName & InvName != sound) { llRemoveInventory(InvName); if(notices == 1) { llSay(0, "Error - Only textures may be dropped inside the " + screenname + "."); } } } while(Items); } } } touch_start(integer avatar) { Toucher = llDetectedKey(0); llSetTimerEvent(15); if (Toucher == llGetOwner()) { llDialog(llDetectedKey(0) , "You are the owner of this screen. What do you wish to do?", ["lock", "clear"], CmdChan); } else if(lockonpost == TRUE & creatorlock == TRUE & llKey2Name(Toucher) == InvCreator) { llDialog(llDetectedKey(0) , "You have been identified as the creator of the currently posted image. What do you wish to do?", ["lock", "clear"], CmdChan); } else { llSay(0, "The " + screenname + " is unlocked. Control + drag textures onto it to display them."); } } listen(integer channel, string name, key id, string message) { if(Toucher == llGetOwner() | lockonpost == TRUE & creatorlock == TRUE & llKey2Name(Toucher) == InvCreator) { Toucher = ""; //Protection so if an owner was the last to touch the object not anyone is able to manually chat an owner-only command on the channel. if(llToLower(message) == "lock") { state locked; } if(llToLower(message) == "clear") { llSetTexture(Blank, face); llPlaySound(sound, soundvol); InvName = ""; InvCreator = ""; if(lockdefault == TRUE) { state locked; } else { llSetText("[" + screenname + " unlocked]", <0.5,1,0.5>, 1); } } } } timer() { Toucher = ""; //Further protection so if an owner ignores the dialog the screen does not remain vulnerable for anyone to chat an owner-only command to. llSetTimerEvent(0); } }