This website is best displayed on Waterfox! or Librewolf!
Please consider downloading Waterfox! or Librewolf! (or any other firefox based web browser) as they're the only free (as in freedom) browsers left at the moment!
Google has a monopoly on browsers with the chromium technology they control and are using this to force you to see mroe ads and collect more data on you! Even firefox has removed privacy statements from their website. Another free up and coming browser is Ladybird it is currently in development and not ready yet. Hear the Ladybird creator talk about the project and its aim to not be dependant on big tech

Avatar text display thing!


<--- Back

Show text


                    // Copyright © 2023 Reiikz
                    // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
                    // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
                    // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                    string command = "/text";
                    string text;
                    integer LINK_DISPLAY = 0;
                    float alpha = 1.0;
                    string start_color = "d93cfc";
                    vector current_color;
                    string default_text;
                    float textDuration;
                    float lastTextSet;
                    float timer_velocity = 0.2;

                    float messageDuration = 200;

                    vector colorCycling = <0.0, 0.6, 0.6'>;

                    integer maxMessages = 3;
                    list messagequeue;
                    list messagequeue_keys;

                    cyclecolor(){
                        colorCycling.x += 0.05;
                        if(colorCycling.x >= 1.0){
                            colorCycling.x = 0.0;
                            colorCycling.y += 0.05;
                        }
                        if(colorCycling.y >= 1.0){
                            colorCycling.y = 0.6;
                            colorCycling.z += 0.05;
                        }
                        if(colorCycling.z >= 1.0){
                            colorCycling.z = 0.6;
                        }
                        current_color = hsv2rgb(colorCycling);
                        setText(text);
                    }

                    key avatar_key;
                    integer checkIsMe(key _key){
                        return _key == avatar_key;
                    }

                    integer strStartsWith(string haystack, string needle){
                        return  0 == llSubStringIndex(haystack, needle);
                    }

                    vector hsv2rgb(vector hsv) {
                        if(hsv.y) {
                            float ht = 6*hsv.x; integer i = (integer)ht; float f = ht-i;
                            if(i == 0) return ;
                            else if(i == 1) return ;
                            else if(i == 2) return ;
                            else if(i == 3) return ;
                            else if(i == 4) return ;
                            else return ;
                        }
                        return ;
                    }

                    vector hex2lsl(string hex)
                    {
                        if(strStartsWith(hex, "#")){
                            hex = llGetSubString(hex, 1, llStringLength(hex) - 1);
                        }
                        integer i = (integer)("0x" + hex);
                        return <(i >> 16) & 0xFF, (i >> 8) & 0xFF, (i & 0xFF)> / 255;
                    }

                    mySetLinkText(integer linknum, string text, vector color, float alpha) {
                        llSetLinkPrimitiveParamsFast(linknum, [PRIM_TEXT, text, color, alpha]);
                    }

                    setText(string t){
                        text = t;
                        mySetLinkText(LINK_DISPLAY, text, current_color, alpha);
                    }

                    integer hasAviRequestedMessageRecently(key who)
                    {
                        return ~llListFindList(messagequeue_keys, (list)who);
                    }

                    requestNewMessage(string message, key who){

                        if(checkIsMe(who)){
                            text = message;
                            lastTextSet = llGetTime();
                        }

                        if(llGetListLength(messagequeue) >= maxMessages){
                            llRegionSayTo(who, 0, "Message queue is full");
                        }

                        if(!hasAviRequestedMessageRecently(who) && (! checkIsMe(who))){
                            messagequeue += message;
                            messagequeue_keys += who;
                        }else{
                            if(! checkIsMe(who)) llRegionSayTo(who, 0, "Please wait for your message to display for " + (string)messageDuration + "s to set another one");
                        }

                        llOwnerSay(text + ": displaying for " + (string)messageDuration + "s by: " + llGetDisplayName(who));
                        
                    }

                    default
                    {
                        timer(){
                            cyclecolor();
                            integer listCount = llGetListLength(messagequeue);
                            if(llGetTime() - lastTextSet  > messageDuration){
                                lastTextSet = llGetTime();
                                if(listCount == 0){
                                    text = default_text;
                                }else{
                                    text = llList2String(messagequeue, 0);
                                    messagequeue = llDeleteSubList(messagequeue, 0, 0);
                                    messagequeue_keys = llDeleteSubList(messagequeue_keys, 0, 0);
                                }
                            }
                        }

                        state_entry()
                        {
                            default_text = "use " + command + "   #to set any text here";
                            llSetTimerEvent(timer_velocity);
                            current_color = hex2lsl(start_color);
                            text = llLinksetDataRead("TEXT");
                            if(llStringLength(text) < 2){
                                setText(default_text);
                            }
                            lastTextSet = llGetTime();
                            avatar_key = llGetOwner();
                            llListen(PUBLIC_CHANNEL, "", NULL_KEY, "");
                        }

                        on_rez(integer start_param)
                        { //when the object is rezzed, reset the script.
                            llResetScript();
                        }

                        changed(integer change)
                        {
                            if (change & CHANGED_OWNER)//if owner changes, reset the script.
                            {
                                // ready = FALSE;
                                llResetScript();
                            }
                            ///////////////////NOTECARD
                            if(change & CHANGED_INVENTORY)
                            { //The object's inventory just changed - the notecard could have been modified!
                                // ready = FALSE;
                                llResetScript();
                            }
                        }

                        listen(integer channel, string name, key id, string message)
                        {
                            if(strStartsWith(message, command)){
                                text = llGetSubString(message, llStringLength(command), llStringLength(message) - 1);
                                requestNewMessage(text, id);
                            }

                            // if(checkIsMe(id)){
                            //     if(strStartsWith("/setTextCommand")){
                                        // implement later    
                            //     }
                            // }
                        }
                    }
                
                

Example update checker script