Looking forward

    I have been wanting to make this post for a while but things in real life have kept me from doing it. I have neglected a few other posts announcing the latest versions of Sensations, the Collar etc because I wanted to get this information out and sadly it took me longer than I had hoped.

    So the reason for this post is about the future.  I have been working hard on Sensations v5 and the Collar v8 (the rest of the items will be updated soon but these are the areas of focus right now).  There will be some changes which are needed to keep Sensations items the as the most advanced in SecondLife. The trouble is some of these changes could potentially affect some third party addon makers.  To make this as easy as possible for them I will be having an open beta period where people can choose to update to the beta versions of Sensations and the Collar so we can see what addons have troubles before going completely public.

    For plugins that the creator has left SecondLife or are no longer able to be updated for some other reason, I will be providing a compatibility script which will maintain compatibility with the old plugins, however it will not be the prefered method, since it will cause more lag (because of the addition of the compatibility script as well as duplicate link messages being generated in the old format).

    Starting with I believe Sensations v4 there have been some optional parameters to the 828 (menu button) link message. Starting with Sensations v5 these parameters will be mandatory. Messages sent without them will be ignored by the internal scripts as invalid.  The 826 (menu button checker) message will not require (but will accept) the parameters.  In Sensations v5 the 828 message will additionally be sent for messages from other sources than the menu.  The new source parameter will indicate the source that generated the message.

    The following is an example Sensations v5/Collar v8 plugin:

     

    // Sensations Example Plugin Script (For Sensations v5+ and Amethyst Collar v8+)
    // By: Amethyst Rosencrans
     
    key nullkey = NULL_KEY;
    string nullstr = "";
     
    // Ownership flags
    integer SUB = 1;                // ME/SELF
    integer GROUP = 2;
    integer SECOWNER = 4;           // ALLOWED
    integer OWNER = 8;
    integer SLAVE = -2147483648;    // OTHERS
    integer OWNED = 1073741824;     // !UNOWNED
    integer SELFCOM = 536870912;
    integer INDIRECT = 268435456;
    integer ALL = 134217728;
    integer OWNERS = 14;
    integer ANYONE = 15;
    integer OWNEDSUB = 1073741825;
     
    // Internal variables
    integer AutoTouch = -1;     // Do we automatically repop the menu?
    integer RandChan = -1;      // Random menu channel
    string Type;                // Type of the item we are installed in
     
    // Buttons we will add to the item's menu
    list MyButtons = [ "ForMe...", "ForOthers...", "ForOwner...", "ForSecowner...", "ForGroup...", "ForOwners...", "ForAnyone...", "ForAll...", "ForUnowned..." ];
    // Which availabilities the menu items will have
    list MyAvail = [ SUB, SLAVE, OWNER, SECOWNER, GROUP, OWNERS, ANYONE, ALL, OWNED ];
     
    // Handle commands
    // Source: 0 from menu 1 from public channel 2 from alternate channel 3 from Sensations HUD 4 Remote inworld 5 Remote web page
    // Level: Bit mask containing SUB, GROUP, SECOWNER, OWNER, SLAVE, SELFCOM, INDIRECT and OWNED flags
    HandleCommand(string message, key id, string name, integer popup, integer source, integer level, integer page)
    {
        // Split the command message into pieces
        list templist = llParseString2List(message, [" "], []);
        string cmd = llList2String(templist, 0);
        integer handled = FALSE;
     
        // Commands for the owner
        if(level & OWNER)
        {
        }
     
        // Commands for secondary owners
        if(level & SECOWNER)
        {
        }
     
        // Commands for group owners
        if(level & GROUP)
        {
        }
     
        // Commands for owner, secondary or group owners
        if(level & OWNERS)
        {
        }
     
        // Commands for the sub
        if(level & SUB)
        {
        }
     
        // Commands for all
        if(llGetSubString(message, 0, 6) == "Button ")
        {
            Say("%t pressed " + message + " on %o's " + Type + ".", id);
            handled = TRUE;
        }
        // See if one of our buttons was pressed
        else if(llListFindList(MyButtons, [ message ]) != -1)
        {
            // Generate an example menu
            integer x;
            list buttons;
     
            for(x=0;x<20;x++)
            {
                buttons += "Button " + (string)x;
            }
            // Use the menu helper... 
            // just pass in our current button pressed as the base and the page
            // nullstr for the backbutton because we are just going back to Main...
            DynamicMenu("Welcome to our example dynamic menu!", id, message, page, nullstr, buttons);
        }
     
        // If we are handling a menu and autotouch is on
        if(popup && AutoTouch == 1 && handled)
        {
            // Popup the menu
            llMessageLinked(LINK_THIS, 830, llKey2Name(id), id);
        }
    }
     
    // Use the menu helper to create a dynamic menu 
    // (this should only be used for menus with variable number of buttons)
    // menutext - Text to display on the dialog menu
    // id - Avatar to display the menu to 
    // basemenu - Base name of the menu for example "Test" or "Test..."
    // page - Page number to display, usually just passed in
    // backbutton - Button to lead to the previous menu, if blank will go to Main...
    // buttons - List of buttons to add to the menu 
    DynamicMenu(string menutext, key id, string basemenu, integer page, string backbutton, list buttons)
    {
        llMessageLinked(LINK_THIS, 820, llDumpList2String([menutext, id, basemenu, page, backbutton ], "|"), llDumpList2String(buttons, "|"));
    }
     
    // Say text using the spatial setting
    // Also handles dealing with %o %t %p etc
    Say(string text, key id)
    {
        llMessageLinked(LINK_THIS, 792, text, id);
    }
     
    default
    {
        state_entry()
        {
            // Request Sensations menu channel update
            llMessageLinked(LINK_SET, 827, nullstr, nullkey);
            // Plugins should use 812 unless they are 
            // 1) adding buttons to the Sensations menu then use 827 nullstr nullkey
            // 2) in the collar and need the owner list then use 47
        }
     
        // Handle messages from the collar script
        link_message(integer sender, integer num, string str, key id)
        {
            // Update the Type variable
            if(num == 790)
            {
                Type = str;
            }
            // This is a request to update plugin buttons
            // If the parameters are both null... then we send our button
            else if(num == 827 && str == nullstr && id == nullkey)
            {
                // Add buttons to the menu
                llMessageLinked(LINK_THIS, 808, llDumpList2String(MyButtons, "|"), llDumpList2String(MyAvail, "|"));
            }
            // Handle menu presses
            else if(num == 828)
            {
                list templist = llParseStringKeepNulls((string)id, ["|"], []);
     
                // Drop out for old style messages
                if(llGetListLength(templist) == 1)
                {
                    return;
                }
     
                key id = llList2String(templist, 0);
                string name = llList2String(templist, 1);
                integer popup = llList2Integer(templist, 2);
                string seccode = llList2String(templist, 3);
                integer source = llList2Integer(templist, 4);
                integer level = llList2Integer(templist, 5);
                integer page = llList2Integer(templist, 6);
     
                templist = [];
     
                HandleCommand(str, id, name, popup, source, level, page);
            }
            // Handle a menu channel update
            else if(num == 829)
            {
                integer newchan = (integer)str;
     
                if(newchan)
                {
                    RandChan = newchan;
                }
            }
            // Get the autotouch setting
            else if(num == 831)
            {
                AutoTouch = (integer)str;
            }
        }
    }
     


    Posted January 12, 2010 by Amethyst Rosencrans

    Post comment

    Comment by lilfae Resident

    Before working on new, would you mind trying to fix the web interface, my avatar and her mistress took two hours trying, before realising your Google API key is out, which was irritating.

    Comment by Amethyst Rosencrans

    I fixed the google API key when I noticed it was expired.  Google didn't say the keys expired when I applied for them. Was a google thing not my interface.

    Post comment