Jump to content

MSTRPLN

Resident
  • Posts

    97
  • Joined

  • Last visited

Posts posted by MSTRPLN

  1. 3 minutes ago, arton Rotaru said:

    We are all waiting for such functionality to attach an object from another objects inventory directly.:)
    Until then we have to rez the object first. Once rezzed, the HUD itself will have to ask for permissions to attach. If it's supposed to work for the owner only, it's easy. If it's supposed to attach to non owners as well, you need some communication between the rezzer and the HUD, to pass along the key of the touching agent, so that the HUD knows to which agent it has to send the perm request.

    Hmm, any pointers how i would do that? (yes owner only, because i want to use this to change between different decals on the roads. I'd rather have a hud with thumbnails than a dialog)

  2. Hello, Somehow when i upload a mesh it ignores the UVmap, only on a few objects not all of them and everything is the same. (Yes also UV channels)

    Is this a common thing if so how would i solve it? It doesn't make sense, it not only looks unmapped but also tiled

    Screenshot_22.png

    Screenshot_23.png

    Screenshot_24.png

    Screenshot_26.png

  3. 1 hour ago, Rolig Loon said:

    Second question first:  Use llDetectedTouchST, which you will find described in the LSL wiki.

    The first question is harder, but only because I'm not sure that I understand your question.  I think you are asking about whether you can script some object that will enable a HUD when you click on it in world.  So, you wear the HUD and it is invisible or otherwise inactive until you click on a tree or something.  If that's what you mean, yes.  All you have to do is script the tree to send a message that can only be heard by something you are wearing, and tell your HUD to listen for it.  So the tree says:

    llRegionSayTo(llDetectedKey(0),secret_HUD_channel,"I'm a tree!");

    If your HUD is scripted to listen to secret_HUD_channel, it will be the only one to hear the message, even if there are 20 other people around with the same HUD. So..
     

    
    listen (integer channel, string name, key id, string message)
    {
        if (~llSubStringIndex(message,"tree"))
        {
            llSetAlpha(1.0,ALL_SIDES);
            llOwnerSay("You just touched a tree.");
        }
    }

    If I have completely missed your meaning, let's try again.

    Hmm not really. More like (keeping it simple for now):

    Item A has 2 items in it's contents: 1. Script - 2. Item B ( called HUD)

    when clicking on item A it will attach item B as a HUD. I managed to do something like this with llAttachToAvatarTemp but it attaches "Item A" rather than "Item B"

    default
    {
        state_entry()
        {
            llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
            llSay(0, "Hello, Avatar!");
        }
    
        touch_start(integer total_number)
        {
            integer totalItems = llGetInventoryNumber(INVENTORY_ALL);
            integer index;
            while (index < totalItems)
            {
                if(PERMISSION_ATTACH)
                {
                        string itemName = llGetInventoryName(INVENTORY_OBJECT, 0);
                        integer type = llGetInventoryType(itemName);
                        if (itemName == "HUD")
                        {
                            llAttachToAvatarTemp((integer)ATTACH_HUD_CENTER_1);
                            llSay(0,"Attached!");
                        } else {
                            llSay(0,"Not attached :(");
                        }
                }
            }
        }
    }

    Not really going deep into permissions etc, just trying to get the attaching to work. i tried adding the item name, type etc in the "" llAttachToAvatarTemp" but that gave me the following error "Function call mismatches type or number of arguments" and the wiki only says it needs a integer & attach point, not an example of attaching a different object.

  4. Hello, i was wondering the following:

    1. Can you attach/enable a HUD by clicking on an object? (im making a road system and i would like a HUD to pop-up when you click a road which will give you a texture changer HUD)
    Why? Because, if possible i'd like to create a hud to style it how i like instead of using a dialog (also the person would see whichtexture is which) but only changing the texture of the object that's been clicked/selected

    2. How would one select different elements in a HUD? for example those texture changer HUD's that let's you select which parts you want to change the texture of (for example a shirt you could enable/disable the front, back, sleeves, extras)

     

    Thanks in advance :)

    Ee8c9V2WSemf5kX7sMyZlg.png

  5. Alright i've read about "llList2Key" Which didn't give much information on how to use it and more other things.
    It just makes it look more complicated than it really is i guess.
    Not sure if i would have to use "while" since most if not all examples i've seen using "llList2Key" were in the while parts.

    I feel that i'm close but not quite there yet, something is wrong and i don't know what:

    // Script for texture changer receiverinteger rChannel =-5001;integer Rezzer;integer kRezzer;// Channel is the integer for reception (number mus the same as a transmission channel otherwise script will not work)default{        state_entry()        {            llListen(rChannel, "", NULL_KEY, "");            integer i;            list Rezzer = llGetObjectDetails(llGetKey(), [OBJECT_REZZER_KEY]);            key kRezzer = llList2Key(Rezzer,i);        }                listen(integer channel, string name, key id, string msg)        {                // Checks if same channel            if (rChannel == channel) {                if (id == kRezzer) {                    //if the message came from the rezzer                     llDie();                }                else {                    // Not from the rezzer                    llWhisper(0, "Whut?");                }            }        }}

    (20, 33) : ERROR : Type Mismatch That's right here there the red star is: if (id == kRezzer*) {
    This is the script of the receiver (the prim getting rezzed)

    Somehow i thought changing it to: key id = llList2Key(Rezzer,kRezzer) But that gave the same error, not sure if it works that way llList2Key(fromlist,tokey)


    for the transmitting script:

    //Rez an object on touch, with relative position, rotation, and velocity all described in the rezzing prim's coordinate system.string object = "[V] Demo"; // Name of object in inventoryvector relativePosOffset = <2.0, 0.0, 0.0>; // "Forward" and a little "above" this primvector relativeVel = <1.0, 0.0, 0.0>; // Traveling in this prim's "forward" direction at 1m/srotation relativeRot = <0.0, 0.0, 1.0, 1.0>; // Rotated 90 degrees on the x-axis compared to this priminteger startParam = 10;// Channelinteger rChannel =-5001;integer count;default{    state_entry()    {        llOwnerSay("Ready");    }    touch_end(integer total_number)    {        llInstantMessage(llDetectedKey(0), "This is a demo! It will delete itself in 10 seconds.");        state two;    }}state two{    state_entry()    {        // Rezzes item        vector myPos = llGetPos();        rotation myRot = llGetRot();         vector rezPos = myPos+relativePosOffset*myRot;        vector rezVel = relativeVel*myRot;        rotation rezRot = relativeRot*myRot;         llRezAtRoot(object, rezPos, rezVel, rezRot, startParam);                llSetTimerEvent (10.0);    }        timer ()    {        llWhisper(0, "Sorry your demo is over.");        llSetTimerEvent (0.0);        llRegionSay(rChannel, "RezDemo");        state default;    }}

    I've got the states to work so it's unclickable during rezzing.

  6. Hello, So i was playing around after reading this article and somehow it behaves differrent for me

    It looks fine:

    until i shine a light on it:

     

    Client: Default
    Grid: Beta
    Diffuse: no alpha
    Normal map: standard 128,128,255 color with specular as alpha saved: .TGA 32
    Specular map: white solid color with darker & contrastd specular saved: .TGA 32

     

    Specular:

     

    However the demo from the article shows just fine:

  7. Thank you, i've been experiencing with state so that once the item is rezzed it goes to state 2 and becomes unclickable to avoid multiple instaces and switched back to default state after the message to make the child die has been sent.

     

    The logic well, I'm just trying to do my best to get it to work really, the reason behind the id = kRezzer instead of == is because == gave me an error and didnt with just one. Im going to try to understand all you said and try it out on a copy and see how far i get.

  8. Thank you.  will look up and learn about what you both suggested.

    With temporarily i meant that it will be rezzed for a limited time (for example 60 seconds) before the rezzed object destroys itself.

    To make my 2nd question clear: The string "object" has to have a name that is the same as in the script.
    I was wondering if i could use something like llGetInventory with a filter so it doesnt take the script but the object (just to be safe). This way i can just put a random object inside the sytsem and it won't give an debug error like "[V] Demo could not be found". 

    Maybe that's possible with "llGetInventoryType" i'll have to look into that

    I also need to create a safety feature so only 1 item cn be rezzed at the time which i forget & you mentioned.

     

    Edit:

    Im starting with one problem at a time, i tried the OBJECT_REZZER_KEY but i must be doing something wrong because A still removes B's rezzed object

    // Script for texture changer receiverinteger rChannel =-5001;// Channel is the integer for reception (number mus the same as a transmission channel otherwise script will not work)integer Rezzer;default{        state_entry()        {            llListen(rChannel, "", NULL_KEY, "");            llScaleByFactor(0.3);            list Rezzer = llGetObjectDetails(llGetKey(), [OBJECT_REZZER_KEY]);        }                listen(integer channel, string name, key id, string msg)        {                // Checks if same channel            if (rChannel == channel) {                if (Rezzer = OBJECT_REZZER_KEY) {                    llDie();;                    } else {}                                } else { llDie(); }            llListenRemove(rChannel);//close listener        }}
  9. Hello. I;ve thought of a way to demo rez objects in world.

    Concept: A vendor on the wall with a demo button under it.
    When "Demo" is clicked it will rez a sized down demo in front of it which wil die
    with a timer, so it only rezzes temporarily. (the demo object is in the content along with the transmittor script)

     

    Problem: It works but if i have 2 or more of the same inworld System A will delete system B's rezzed
    object before it's timer has ran out, this is because it's on the same channel. I've tried multiple options to
    make the channels unique ie.

     

    integer rChannel = 0x80000000 | (integer) ( "0x" + (string) llGetOwner() );
    
    
    // and
    
    
    integer rChannel = (integer)(llFrand(-999999999.0) - 10000000.0);

    But now 2 problems occur: 1. I get an error saying "Cannot use llRegionSay(); on channel 0. 2. The receiver doesn't work anymore.

     

    Below my codes.

    Transmittor:

    string object = "[V] Demo"; // Name of object in inventory
    vector relativePosOffset = <2.0, 0.0, 0.0>; // "Forward" and a little "above" this prim
    vector relativeVel = <1.0, 0.0, 0.0>; // Traveling in this prim's "forward" direction at 1m/s
    rotation relativeRot = <0.0, 0.0, 1.0, 1.0>; // Rotated 90 degrees on the x-axis compared to this prim
    integer startParam = 10;
    
    // Channel
    integer rChannel =-5001;
    integer count;
    
    default
    {
         touch_start(integer tn)
        {
            // 1 minute
            llSetTimerEvent (60.0);
            llInstantMessage(llDetectedKey(0), "This is a demo! It will delete itself in 1 minute.");
            
            // Rezzes item
            vector myPos = llGetPos();
            rotation myRot = llGetRot();
     
            vector rezPos = myPos+relativePosOffset*myRot;
            vector rezVel = relativeVel*myRot;
            rotation rezRot = relativeRot*myRot;
     
            llRezAtRoot(object, rezPos, rezVel, rezRot, startParam);
        }
        on_rez(integer p) {
            llResetScript();   
        }
    
        timer ()
        {
            llOwnerSay("Sorry your demo is over.");
            llSetTimerEvent (0.0);
            llRegionSay(rChannel, "RezDemo");
        }
    }

    Receiver:

    integer rChannel =-5001;
    // Channel is the integer for reception (number mus the same as a transmission channel otherwise script will not work)
    
    default
    {
            state_entry()
            {
                llListen(rChannel, "", NULL_KEY, "");
            }
            
            listen(integer channel, string name, key id, string msg)
            {
                    // Checks if same channel
                if (rChannel == channel) {  llDie();
                } else { llDie(); }
                llListenRemove(rChannel);//close listener
            }
    }

    What i would nee jhelp with exactly is:

     

    - How to set a unique channel that the rezzer & rezzed object still listens to eachother but don't interfere with others.

    - How to detect prim in it's inventory without the need to renaming to "[V] Demo".

    - Send the message in the timer "Sorry your demo is over." to the person that started it so it doesn't spam the public channel. (if possible, cause llInstantMessage with DetectedKey(0) didn't work).

     

    Optional/Additional: I would like to know (yes i've searched) if there is a way to detect when someone uses "Pay"
    on right click > pay and play a sound or any other action.

    Thanks in advance.
    Sincerely, Chris.

  10. That's interesting, so in this case "message" after the (key) makes all the difference. i wish the wiki was more explained to avoid these senarios.

     

    One more last question, is there a way to make the channels random? Since if you would have 2 backdrops on a land with the same script in it it woudl change the texture on both of them (i know i can just manually change them but i'd rather it to be automated)

     

    i've tried a few including http://wiki.secondlife.com/wiki/LlDialog#Tips but it gives this error, not sure why since it's o the wiki.

  11. i've read it and it gives me a "Name not defined within scope" unless i put at the top "key uuid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";

    In that case it works, but it would only allow "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" any other UUID's will render as:

    else { llInstantMessage( llGetOwner(),"Not a valid UUID"); }

     

    Just so there will not be any misscomunicatio this is the code so far:

     

    integer iMenuChannel = 123;integer iTextBoxChannel = 486;integer iListener;key uuid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";default{    state_entry()    {    }            touch_start(integer total_number)    {        integer face = llDetectedTouchFace(0);;        if ( face == 4 ) {        llListenRemove(iListener);//close any stray listeners        key toucher = llDetectedKey(0);        llListen(iMenuChannel,"",toucher,"");        llDialog(toucher,"Please choose an option",["Texture","Reset"], iMenuChannel);        } else {        }    }    listen(integer channel, string name, key id, string message)    {        llListenRemove(iListener);                if (iMenuChannel == channel){            if("Texture" == message){                llListenRemove(iListener);//close any stray listeners                key toucher = llDetectedKey(0);                llListen(iTextBoxChannel,"",toucher,"");                llTextBox(id, "Please enter a message and click Submit", iTextBoxChannel);                //open listener on iTextBoxChannel and do stuff to make a text box appear            }            else if ("Reset" == message){              llSetTexture("792477f4-e765-e9ec-6bd8-dc228951b7e2", 4);            }        }        else if (iTextBoxChannel == channel){            if(uuid){            llSetTexture(message,4);            } else {                llInstantMessage( llGetOwner(),"Not a valid UUID");            }            //message from the text box.            //verify that the message is a key and, if it is, apply it to face 4        }    }}

     

    Unless im doing something wrong maybe i can put a few filters that check if, the entered text contains 36 characters (UUID has 36) and maybe even some other thigns but i'll have to dig deeper for that. i really appreciate you all helping me in the right direction while still letting me figure things out.

  12. Okay so i've rearranged the messages to show me werther it works or not

    if (message == "A")        {            llTextBox(id, "Please enter a message and click Submit", -165);            //do something else here            if(channel == -165) {            llSay(0, "It works ");            //llSetTexture(message,4);            } else { llSay(0, "It didnt work ");}        }

    what i now get is:

    When i click button A it imidiately says "It didnt work :(" Im not sure if i could tell the "It works/It didnt work" to wait until it receives a new message from the channel -165

  13. It already uses an if and else if to detect what button is pressed.

    if i put another one it doesn't do anything i can;t figure out why

    listen (integer channel, string name, key id, string message)    {        if (message == "A")        {            llTextBox(id, "Please enter a message and click Submit", -165);            //do something else here            if(channel == -165) {            llSetTexture(message,4);            }        }        else if (message == "B")        {            llSetTexture("792477f4-e765-e9ec-6bd8-dc228951b7e2", 4);                //do something else here        }        // simpleMenu(id); refresh menu    }

     

    Right now im trying to filter the message on a valid uuid but it's very confusing. if(uuid) gived me an error "name not defined within scope" and this doesn't work either:

     

    listen (integer channel, string name, key id, string message)    {        if (message == "A")        {            llTextBox(id, "Please enter a message and click Submit", -165);            //do something else here            message = (key)message;            if(message) {            llSetTexture(message,4);            } else { llSay(0, "You didn't enter a valid UUID");}        }        else if (message == "B")        {            llSetTexture("792477f4-e765-e9ec-6bd8-dc228951b7e2", 4);                //do something else here        }        // simpleMenu(id); refresh menu    }
  14. Alright, thnak you very much :)

     

     

    I took a different approach.

    // Example made by Kahiro Watanabe, visit modernclix.info for lsl and php/mysql tutorials// You can share this script with anyoneinteger listener;  // Listener for handling different channelsinteger simpleMenuChannel; // The channel used for the menu// Function that returns a random number (used for generating a random channel)integer randomNumber(){    return((integer)(llFrand(99999.0)*-1));}menu(key id, integer channel, string title, list buttons) // Generic menu creator{    llListenRemove(listener);    listener = llListen(channel,"",id,"");    llDialog(id,title,buttons,channel);    llSetTimerEvent(10.0);   // if no menu button is pressed in 20 seconds the timer is triggered to kill the listener}simpleMenu(key id) // This function calls the menu creator{    simpleMenuChannel = randomNumber();    menu(id,simpleMenuChannel,"Select an option",["A","B"]);}default{    touch_start(integer num)    {        simpleMenu(llDetectedKey(0));    }    listen (integer channel, string name, key id, string message)    {        if (message == "A")        {            llTextBox(id, "Please enter a message and click Submit", -165);            //do something else here            llSetTexture(message,4);        }        else if (message == "B")        {            llSetTexture("792477f4-e765-e9ec-6bd8-dc228951b7e2", 4);                //do something else here        }        // simpleMenu(id); refresh menu    }    timer()    {        llListenRemove(listener); // kill the listener        llSetTimerEvent(0.0); // stop the timer    }        changed(integer mask)    {   //Triggered when the object containing this script changes owner.        if(mask & CHANGED_OWNER)        {            llResetScript();   // This will ensure the script listens to the new owner, and doesn't continue listening to the creator.        }    }}

    It's working so far the only problem is: The llSetTexture takes the message of the llDialog which is "A" so i get an error saying "Texture A cannot be found" i have absolutely no clue how to seperate the conflicts.

     

    I've tried: 

    llTextBox(id, "Please enter a message and click Submit", -165);            //do something else here            if( channel == -165) {            llSetTexture(message,4);            }

    But unforunately nothing happend

  15. Every time someone touches the object, it opens a new listen handler. How am I going to keep from opening so many that the script stalls? (The maximum allowed is 64.)

    Haven't really thought about that, any insights about how to avoid this? Although the script only works for the owner (Detect owner)

    What if the owner types something other than a valid UUID in the text box?

    Hmm i havent thought about that i'll try this with an if/else

    What if the owner opens a text box but doesn't type anything in it?

    Im gonna implement this somehow

    Should I put a default texture UUID in the script?  When would I want the default to appear, if I did?

    Good one! i think i can do this with a reset that changes the script back idk

    What if the user wanted to change the color as well as the texture?

    Im not allowing that only texture else it'll get too complex i could do this with an dialog menu with a few color options & texture option

    Dop I really care what happens if the owner touches some other face?

    No/yes i want it also to have an resize script im going to script later on but i could also make a prim text that when clicked would activate that seperate script

  16. I think i have it, it works atleast if the code is valid enough i don't know.

     

    integer vListener;default{    touch_start(integer num_detected)    {        integer face = llDetectedTouchFace(0);;                if ( llDetectedKey(0) == llGetOwner())        {            if ( face == 4)            {                integer channel = -13572468;                vListener = llListen( channel, "", "", "");                 llTextBox(llDetectedKey(0), "Please enter the UUID of the texture you want as background.", channel);               }                        else            {                            }         }                else        {            llSay(0, "You're not the owner, you can't change the texture.");             }    } listen (integer channel, string name, key id, string message)    {        llSetTexture(message,4);    }}
×
×
  • Create New...