Jump to content

Only owner or group can change texture


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

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

Recommended Posts

I am basically a script idiot. I have bought and tried 4 different scripts for making colorchange HUDs and that is too difficult. So I found a freebie script that I can use. This uses an old school blue pop-up.

The problem now is that I want only owner or group to use it. Anyone can touch now and change texture. Can you help me set in a code line?

 

//______Change Texture Menu___Alicia Stella______
//__________last modifed__May 2009___________
//_____more scripts: www.aliciastella.com_____

//Drop this script into an object with textures inside.

//When anyone Touches they will get a menu with all the textures available. Button names in menu will be first 10 characters from that item's name.

//NOTE: Texture Names may not exceed 24 characters or script error and menu fails.


integer side = ALL_SIDES; //ALL_SIDES or any face number 0 through 5

list texture_list;
key user = NULL_KEY;

composelist()
{
    integer currenttexture = 0;
    integer totaltextures = llGetInventoryNumber(INVENTORY_TEXTURE);

    if(totaltextures == 0) llWhisper(0, "Please add up to 22 Textures inside this object.");
    else {
        texture_list = [];
        do
        {
            texture_list = texture_list + llGetInventoryName(INVENTORY_TEXTURE, currenttexture);
            currenttexture++;
        }
        while (currenttexture > 0 & currenttexture < totaltextures);
    }    
}

//The Menu
integer menu_handler;
integer menu_channel;
integer menu_page;

menu(key user,string title,list texture_list)
{
    menu_channel = (integer)(llFrand(99999.0) * -1); //random channel
    menu_handler = llListen(menu_channel,"","","");

    integer max_page = llFloor (llGetListLength (texture_list) / 9) + 1;
    if (menu_page >= max_page) menu_page = 0;
    else if (menu_page < 0) menu_page = max_page - 1;
        
    integer range = menu_page * 9;
    list buttons = ["<<<", "Random", ">>>"] + llList2List (texture_list, range, range + 8);
            
    llDialog (user, title, buttons, menu_channel);
    
    llSetTimerEvent(30.0); //menu channel open for 30 seconds
}

default
{
    state_entry()
    {
        composelist(); //make list from inventory textures
    }

    touch_start(integer total_number)
    {
        user = llDetectedKey(0);
        menu_page = 0;
        menu(user, "\n\nPlease select one below.", texture_list);
    }

    listen(integer channel,string name,key id,string message)
    {
        if (channel == menu_channel) {
            llSetTimerEvent(0.0);
            llListenRemove(menu_handler);
            
            if(message == ">>>") {
                ++ menu_page;
                menu(user, "\n\nPlease select one below.",texture_list);
            
            } else if (message == "<<<") {
                -- menu_page;
                menu(user, "\n\nPlease select one below.",texture_list);
            
            } else if (message == "Random") llSetTexture(llList2String(texture_list, (integer) (llFrand (llGetListLength (texture_list)))), side);
            
            else llSetTexture(message, side);
        }
    }

    timer() //Close the Menu Listen or we'll get laggy
    {
        llSetTimerEvent(0.0);
        llListenRemove(menu_handler);
    }

    changed(integer change)
    {
        if (change & CHANGED_INVENTORY) //inventory has changed
        {
            composelist(); //rebuild the list
        }
    }
}

 

 

Link to post
Share on other sites

You can check in the touch event if the owner or someone with the same active group than the object has clicked.

touch_start(integer total_number)
{
		user = llDetectedKey(0);
		if (user == llGetOwner() || llSameGroup(user)) {
			menu_page = 0;
			menu(user, "\n\nPlease select one below.", texture_list);
		}
}

 

  • Like 1
  • Thanks 1
Link to post
Share on other sites
1 hour ago, Nova Convair said:

You can check in the touch event if the owner or someone with the same active group than the object has clicked.


touch_start(integer total_number)
{
		user = llDetectedKey(0);
		if (user == llGetOwner() || llSameGroup(user)) {
			menu_page = 0;
			menu(user, "\n\nPlease select one below.", texture_list);
		}
}

 

Will try when I log in. It's good to have an alt for testing.

Link to post
Share on other sites
5 hours ago, Marianne Little said:

I am basically a script idiot. I have bought and tried 4 different scripts for making colorchange HUDs and that is too difficult. So I found a freebie script that I can use. This uses an old school blue pop-up.

I am not a big script person either but that script you posted has you putting the textures in the object rather than calling the UUID of the texture.   So if you use this and if you are using purchased textures OR if you don't ant to give your personally made ones out full perm then  it might get tricky with permissions.  So watch out for that.   

Link to post
Share on other sites
53 minutes ago, Chic Aeon said:

I am not a big script person either but that script you posted has you putting the textures in the object rather than calling the UUID of the texture.   So if you use this and if you are using purchased textures OR if you don't ant to give your personally made ones out full perm then  it might get tricky with permissions.  So watch out for that.   

I tried giving it out to an alt. It was no problems. I changed the textures to no transfer before I put them in. Only problem now, is that anyone can click and change the texture.

Using UUID's is so timeconsuming, I type wrong, and making a color change HUD that attach to screen and is clickable is out of my reach. Someone said I should put one exterior wall shell of each texture in the folder. It is just that editing the walls in place takes time, if they do it and then think... "Hmmm.... it did look better with the other one." Then they have to start over. They can drop a texture on. But so many SL residents isn't good with editing.

This script over made me cry (not literally) because it is so simple.

  • Like 1
Link to post
Share on other sites
3 hours ago, Marianne Little said:

Using UUID's is so timeconsuming, I type wrong, and making a color change HUD that attach to screen and is clickable is out of my reach.

It doesn't need to be time-consuming and it doesn't need to challenge your typing ability.  I am probably the most typo-prone scripter in SL, but I almost never make a mistake putting UUIDs in a script.  Why?  Because all I have to do is find the script in my inventory, right click on it, and select Copy Asset UUID.  Then I just paste it (CTRL + V) into the appropriate spot in my script.  No typing involved.  

I agree about the HUD, though.  For something as simple as you are making, a HUD isn't really necessary.  It's one more thing for the user to lose in her inventory.  It's much smarter to use a dialog menu, as you have chosen to do with this script.  It's not "old school," BTW.  Dialogs are alive and well, very popular in SL.  They can become very tricky to script (and very confusing for users if not scripted thoughtfully), but they can be just right for something like your project.

Nova's solution for restricting access is exactly right.  Go for it.  😉

  • Like 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 471 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...