Jump to content

Wandering Soulstar

Resident
  • Posts

    421
  • Joined

  • Last visited

Posts posted by Wandering Soulstar

  1. Hi @Rolig Loon,

    I am struggling to understand this, and hopefully you (or someone else ) can clarify for me. I'm trying to create an overall controller for my sliding doors .. which are a bit more complex as they have multiple panels, and thus I move them in stepped groups (i.e. first panel slides until it is even with panel two, then they both move 'together' .. etc). so my questions

    1) Why:

    vector local_pos = ((vector)llList2String(temp,0)- llGetPos())/llGetRot();

    Instead of simply changing the initial PP call to:

    list temp = llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL,PRIM_ROT_LOCAL]);
    vector local_pos = (vector)llList2String(temp,0);

    2) Actually not clear what all the rotation stuff is doing ... why do we reset the prim's rotation? Moving a linked prim along an axis, in-world, we can see that neither its world nor its local rotations every change .. so why are we doing that here?

    3) Following onto 1) why are we not simply doing the following when setting the position:

    llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, local_pos + (<0.0, gDistance * gON, 0.0>)]);

    Is there something I am missing here?

  2. Hi All,

    Have a question in regards to setting colours, and its not about the code/functions .. those I know, but rather about getting the colour vector that I want. I am currently building a house for a client, and one of the things I want to put into it is the capability for them to change the colours of the walls, and in fact define the colours they want available. Now the basics are simple, but where I am running up blank in in the fact that the walls include an recessed base board, and for effect this needs to be a few shades darker than the colour of the wall itself ... and that is what I cannot figure out. Looking at the colour changer in world, set a colour and then move the slider at the right. The changes in the LSL values follow no logic that I could calculate as, other than going down when it gets darker, which ones move, and by how much is impossible for me to tell. Looking at the Hue Sat and Lum values can see that the move is only in the L value .. so my question then lies .. is there a way to convert an LS Colour vector to HSL and then back again?

    Thanks!!!

  3. On 4/27/2019 at 4:50 PM, Arduenn Schwartzman said:

    Changing states only works from within an event, not from within a function, unless you prefix it with if(TRUE);

    
    uYourFunction(){
      state other_state;
    }

    Will result in an error message. However,

    
    uYourFunction(){
      if(TRUE)state other_state;
    }

    Will work. I think this unintended behavior or LL would not have bothered disallowing the first one. (And may therefore qualify as a hack.)

    When I saw this I was quite pleased, if so would clean up a number of places where I've had to do some fancy stepping to change the state. As with @Wulfie Reanimator my first reaction was to go in-world and compile a simple script so that I could see it with my own eyes, and yep it did so. Later when sitting down to work on a customisation of my Home Control System, before putting this to use I thought to actually execute some code using this, just to be certain .. and have learned some interesting 'features' of this ... first I tried the code below:

    integer gCounter = 0;
    
    integer is_even(integer value)
    {
        float fResult = value/2.0;
        integer result = (llFloor(fResult) == fResult);
        llOwnerSay("Result: " + (string)result);
        if (result){state even;}
        return result;
    }
    
    default
    {
        touch_end(integer total_number)
        {
            if (!is_even(gCounter++)){state odd;}
        }
    }
    
    state even
    {
        state_entry()
        {
            llOwnerSay("I'm Even!");
            state default;
        }
    }
    
    state odd
    {
        state_entry()
        {
            llOwnerSay("I'm Odd!");
            state default;
        }
    }

    The results of this were not what I expected though:

    [01:46] Wanda Soulstar: with state call in function
    [01:46] Wanda Soulstar: -----------
    [01:46] Object: Result: 1
    [01:46] Object: I'm Odd!
    [01:46] Object: Result: 0
    [01:46] Object: I'm Odd!
    [01:46] Object: Result: 1
    [01:46] Object: I'm Odd!
    [01:46] Object: Result: 0
    [01:46] Object: I'm Odd!

    I then changed the line on the return to touch_end to do an Owner Say instead of going to the odd state:

    [02:07] Wanda Soulstar: with owner say instead of state
    [02:07] Wanda Soulstar: -------------------
    [02:07] Object: Result: 0
    [02:07] Object: I am Odd
    [02:08] Object: Result: 1
    [02:08] Object: I am Odd
    [02:08] Object: I'm Even!
    [02:08] Object: Result: 0
    [02:08] Object: I am Odd
    [02:08] Object: Result: 1
    [02:08] Object: I am Odd
    [02:08] Object: I'm Even!

    So what I was seeing here was that the function would return, and finishing the event that had made the call to the function before going into the state called in the function. And it looked that the return from the function, when there was a call to a state in it, was being set to the default value for the type of the function. I confirmed this by changing the return to a string (True/False) and in the instances where state even was called the return was always an Empty String (""). With the code I has was not certain if any code in the function was executed after the state even line .. so I modified my code to the below:

    integer gCounter = 0;
    
    string is_even(integer value)
    {
        string sResult = "TRUE";
        float fResult = value/2.0;
        integer result = (llFloor(fResult) == fResult);
        llOwnerSay("Result: " + (string)result);
        if (result){state even;}
        
        if (result)
        {
            sResult = "True";
            llOwnerSay("Continue Even");
        } 
        else 
        {
            sResult = "False";
        }
        return sResult;
    }
    
    default
    {
        touch_end(integer total_number)
        {
            string result = is_even(gCounter++);
            if (result == "False"){llOwnerSay("I am Odd");}
            llOwnerSay("Result in Touch: " + result);
        }
    }
    
    state even
    {
        state_entry()
        {
            llOwnerSay("I'm Even!");
            state default;
        }
    }

    And ... the result:

    [02:36] Wanda Soulstar: checking if function completes
    [02:36] Wanda Soulstar: --------------
    [02:36] Object: Result: 1
    [02:36] Object: Result in Touch: 
    [02:36] Object: I'm Even!
    [02:37] Object: Result: 0
    [02:37] Object: I am Odd
    [02:37] Object: Result in Touch: False
    [02:37] Object: Result: 1
    [02:37] Object: Result in Touch: 
    [02:37] Object: I'm Even!
    [02:37] Object: Result: 0
    [02:37] Object: I am Odd
    [02:37] Object: Result in Touch: False

    As you can see, when we call state even in the function it executes no further in the function and returns the default value for the function type.  So something that we need to be aware of when using state in a user-defined function/sub:

    • No code in the function will execute after the state is called .. but...
    • The event code after the call to the function with the state call will execute before the execution moves to the new state ..
    • If there is another state call in said code it will execute and ignore the one called in the function
    • If it is a function and not a sub, the return value when a state is called will be the default value for said type

    AS this is a hack, not surprising that strange things happen, but as long as we know the boundaries, can be useful. Next time I'm inworld and have a moment would like to see what happens with nested calls to user functions, i.e. touch to function1 to function2 where the state call resides ... what gets executed and what does not ...

    • Thanks 1
  4. @steph Arnott  ... you stated a position, I asked for data to back it up, you said go to the Wiki, I did and documented what was there, and there was nothing to back up your statement, and now it seems that your supporting information comes from a source that only  you had access to, so there is no way for anyone to independently verify it.

    Logic is not based on 'It is True because someone told me it is' but rather having proof that it is True ....

  5. 2 minutes ago, steph Arnott said:

    I will take Strife Onizuka informed explaination to me over yours. Be blessed. 

    So .. another bit of secret arcane knowledge to which only you are privy and the rest of us are expected to take your word for over the documentation that exists. I think I'll go with the documentation.

    • Thanks 1
  6. 20 minutes ago, steph Arnott said:

    Read the official LSL wiki for starters then. It gives plenty of information.

    I was expecting that you'd say something like that. In the Wiki for the function llListen (link) the first mention of a null key:

    Quote

    Specification

    For the listen event to be triggered it must first match the criteria set forth by the filters; only when all the criteria have been met is a listen event generated. First the message must have been transmitted on channel. If id is both a valid key and not a null key then the speaker's key must be equivalent[2] to id. If name is set then the speaker's legacy name must match name exactly (case sensitive). If msg is set then the spoken message must match msg exactly (case sensitive).

    Then later in the code example 'Two Listen Handles' they show when setting a listen for anyone the call to the finction with NULL_KEY. The only other mention of NULL_KEY in this entry is on the notes:

    Quote

    Avoid channel zero (PUBLIC_CHANNEL) and set name or id where possible to avoid lag. llListen(0, "", NULL_KEY,"") can be laggy as it listens to all chat from everyone in chat range and so should be avoided.

    .. and obviously here the mention is in regards to opening listens on the Public Channel for everyone as it could be laggy. As I could not find anything here, I went to the definition og th NULL_KEY constant itself (link). Here the closest thing to any warning or advice in regards to not using NULL_KEY comes about half way into the notes:

    Quote

    ...In many applications keys are checked against NULL_KEY to determine if they are valid; this is bad practice

    LSL makes it easy to check if a key is valid. Simply use the key as the parameter for a conditional.

    That is, instead of if(uuid != NULL_KEY), use if(uuid). if(uuid) will only return TRUE if it is a valid key that is also not a null key.

    So simply a statement about how to determine if a variable holds a valid key ...

    So instead of :

    18 hours ago, steph Arnott said:

    You can not use NULL_KEY in the llListen function. It has a value of "00000000-0000-0000-0000-000000000000". You are locking your script to a value it will never recieve. Set it to llListen(737, "",  "", "" ); 

    The wiki specifically shows the use of NULL_KEY in an llListen call. Furthermore in no place did I find any warnings that using NULL_KEY in llListen (or any other function that takes a key as a parameter) would:

    17 hours ago, steph Arnott said:

    You use it, then when it glitches you will be scratching your head wondering what is going on.

    And I definitely could find nowhere the following:

    3 hours ago, steph Arnott said:

    My claims? Even LL's own code writters state NOT to use NULL_KEY in MONO. They state to only  test for a valid key or in the case of listen filters to leave it  "" or a valid key..

    So .. if it is on the Wiki and you have found this important piece of knowledge, could you please share that with the fourm?

  7. As far as I know LSL only allows you to change the camera view of an AV when they sit on a Prim ... and then only offsets etc in relation to the AV. I do not think you can force it to focus on a specific object so that it follows after that. The only semi-solution (and would be extremely complicated (at least for me) would be for there to be communications between the RC heli and the prim that the AV is seated on that calculates the offset based on the position of the RC heli in relation to the prim that AV is seated on.

  8. 10 hours ago, steph Arnott said:

    You use it, then when it glitches you will be scratching your head wondering what is going on. I have been in SL to long and know what will happen. And FYI you should not even be valuating a NULL_KEY even in a conditional. It is a bad practice.

    Once again .. providing baseless claims that you cannot demonstrate, and incorrect direction. In all the years of my coding in SL, and scripts that have been running for years, I have never had an issue with Listens that have NULL_KEY in them. And, if I have explicitly set a variable to equal NULL_KEY, then later test to see if it has changed in a conditional, why in the world would that not work .. and where have any guides stated that it is 'a bad practice' .. other than you stating it?

    9 hours ago, steph Arnott said:

    I give up. It is just wasting my time.

    Actually I am sure it is myself, or anyone else that challenges your claims that is wasting their time .. and so to take a page from multiple threads you have posted to .. Good Day.

  9. 1 hour ago, Ziggy Starsmith said:

    Private sims can be for bigger and different needs. 

    There is a big jump between 1024 and a full sim, quite obviously. I for one, whilst I really like what they are doing with the new homes, have no plans whatsoever to abandon my current Mainland, nor stop using Mainland ... I love to build and create new and different homes .. and the sheer scale and variety of the Mainland means I am always finding something new. If this world was just about having(living) in preset homes .. having the world defined for me .. then I highly doubt I would have stayed so long.

    • Like 2
  10. @Chic Aeon .. to be clear I am not uploading a linkset, as I stated I am using Mesh Studio to create the DAE file, and that is what it is for, turning prim linkest into reasonably good DAEs. Appreciate the link to the limits, but was looking for thresholds where the upload wieght's change.

    @arton Rotaru This helps greatly. Just to be certain I understand it, past the 5.43m radius the lowest LOD will be replaced by the low, past 10.86m the lowest and low will be replaced by the medium, and then past the 43.44m radius the only LOD being used is the highest. That then would explain what I am seeing, the double size has passed the 10.86m radius and so the medium LOD is being applied to all.

    Thanks to both for your quick responses!

  11. Hi All,

    I have a question in regards to uploaded mesh and the LI said items require. It seems to me that there must be a threshold, either in triangles, or size of the uploaded mesh where the cost goes up noticeably. What I mean is explained by the following scenario. Before I go into it, I am using Mesh Studio to create DAE files from inworld prim builds. Please no comments about using Blender, etc, I know them and just do not have time atm to learn this. In any case I doubt that this is the issue .. so the scenario:

    • 23 prim linkset(basically a wall and window with frame, and is 6m wide by 5m high. When I take the created DAE file to upload it shows at high 156 triangles/312 vertices. Use the same DAE for medium, and then auto-generated for the other two (14/26 and 10/14 respectively). This gives me a mesh of 0.7LI.
    • Now double the original and create a linkset with 46 prims, 13m wide and still 5m high. Going to upload the DAE file shows 316 triangles and 632 vertices for hig, as above use the same for medium and auto-generated for the other two (23/43, 14/26). so far everything is 2x the original .. until we get to the LI, which is 3.9, 5.57x the original, or almost 2.8x what it would be just using the earlier mesh twice in-world.

    So what this is showing me is that there is some threshold that changes to way the LI is calculated, and I suspect it it the size of the original build. So my question is, what is that threshold, i.e. when is it better for me to break things up into smaller pieces.

     

    Thanks in advance,

    Wanda

  12. @steph Arnott really do not know what you are 'on about' with your comments like

    1 hour ago, steph Arnott said:

    Be odd seeing as you can not convert list to string with that.

    and

    16 hours ago, steph Arnott said:

    This is wrong. Using this function llToLower defeats the literal match. 

    and

    16 hours ago, steph Arnott said:

     It will just add a lower case converted entry.

    The OP had code that was going through the inventory, getting names, and adding to a list. Whilst they referred to 'deleting from the list, the suggestion given does that by never adding to the list. There was no 'literal' match asked for by the OP, and no lower case converted entery gets added, .. oh and yes it would compile:

            integer counter;
            list objectlist = [];
            
            integer contents_total = llGetInventoryNumber(INVENTORY_OBJECT);
            for (counter = 0; counter <= contents_total; ++counter)
            {
                string contents_name = llGetInventoryName(INVENTORY_OBJECT, counter);//strings
                if (llSubStringIndex (llToLower (contents_name), "freya") == -1) objectlist += contents_name;//list of object names
            }

    The above (with declarations added) compiles perfectly and only adds to the list, Inventory Objects that do not have the 'string of characters' freya (OP's request) to the list.

    • Thanks 1
  13. So .. have tried all the steps on the Firestorm page, including the last one of copying inventory from SL Viewer .. and nope. I have tested with two alts and two other viewers (SL & Catznip) with exactly the same results in all cases. In the other viewers everything is fine, but in Firestorm the Library does not show all files that should be there as described above.

    Next step will be to do a Firestorm re-install I guess

  14. Hi all ... Something has happened with my Inventory on Firestorm. It is not loading Library items past the Gestures folder, so nothing other than the folders showing up in Objects, Textures, etc. This seems to be Firestorm related as I have logged in with Catznip and they are all there ... have flushed my Inven Cache and relogged, and same problem persists ... any suggestions?

×
×
  • Create New...