Jump to content

Menu to Communicate - Multiple Objects


Biscoito Bonetto
 Share

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

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

Recommended Posts

Hello,

I'm new in scripts and I'm trying to make a menu that will change the textures of multiples objetcs.

For example: For object01: texture01, texture02 and texture03. For object02: texture04 and texture05.

My question is how to communicate these objects to a menu?

To test it, I put this script in one object to make the menu:

list texturechoices = ["texture01", "texture02", "texture03"];
string msg = "Please make a choice.";
key ToucherID;
integer channel_dialog;
integer listen_id;
     default {
    state_entry() {
        llSetScriptState("texturedefault", TRUE);
    channel_dialog = ( -1234 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
  }
  touch_start(integer total_number) {
    ToucherID = llDetectedKey(0);
    llDialog(ToucherID, msg, texturechoices, channel_dialog);
    listen_id = llListen( channel_dialog, "", ToucherID, "");
  }
}

 

And this script in other object to receive the commands of the menu:

default
    {
    state_entry()
    {
        llListen(-1234,"","",""); 
        llOffsetTexture(0, 0, -1);
        llSetTexture("texturedefault", ALL_SIDES); 
    }
    on_rez(integer start_param) {
        llResetScript();
        llOffsetTexture(0, 0, -1);
        llSetTexture("texturedefault", ALL_SIDES);  
    }
    listen(integer c,string n,key id, string m)
    {

        if(m == "texture01")
        {      
                llOffsetTexture(0, 0, -1);
                llSetTexture("texture01", ALL_SIDES);

        }
        if(m == "texture02")
        {
            llSetTexture("texture02", ALL_SIDES);
        }
        if(m == "texture03")
        {      
                llOffsetTexture(0, 0, -1);
                llSetTexture("texture03", ALL_SIDES);

        }
    }
}

 Sure, It didn't work. But I think that the problem is only with menu and how to communicate it with multiples objects using llListen.

Thanks for your time!

  • Like 1
Link to comment
Share on other sites

Well, yes.... You are sending a message on a channel that is equal to -1234 times a hefty number based on the sender's UUID but the receiving objectis listening for a message on channel -1234.  It will never hear a thing  If you want it to hear on channel -1234, you have to send on channel -1234

If you are dealing with unlinked objects, this is one way to change textures and colors. If your objects are linked, though, it is much better to use llSetLinkPrimitiveParamsFast to do the job  It's faster, and you save the sim overhead on running several scripts when one will do

Link to comment
Share on other sites

May I say 'well done' on the way you have asked this question.  By showing us the code we can spot the problem.  "It doesn't work" could have been better but at least we were able to read and check.  Many other people are only saying "I can't get my script to work, what do I do?" or similar, without showing us what they have.  Not a lot we can do for them :-(

  • Like 1
Link to comment
Share on other sites


PeterCanessa Oh wrote:

May I say 'well done' on the way you have asked this question.  By showing us the code we can spot the problem.  "It doesn't work" could have been better but at least we were able to read and check.  Many other people are only saying "I can't get my script to work, what do I do?" or similar, without showing us what they have.  Not a lot we can do for them :-(

to this I say, "amen"....

if anyone is reading this, and thinking of asking for help... PLEASE post up the code of at least the portion you are having trouble with.... preferably the whole thing.... or a simplified version that also has the same problem. you get help and done so much faster this way....

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4776 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...