In search of a Scripted Memo Board

Creating scripts
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: In search of a Scripted Memo Board

Post by Graham Mills »

I've added the option to flip the pinblock so you can see text on one side and an image on the other. I've also instituted a 60 sec lock on use of the edit textbox which now glows while being used for editing.

It turns out that you can store in excess of the number of chars displayed in the viewer (presumably a limit specified by SL) so I've settled for 250 chars text which remains vaguely legible.

Code: Select all

//script for basic pinblock 0.11

integer chan;
integer hndl;
integer hndl_dialog;
integer display_chan = -1221;//needs to be static and used by display prim
integer prim_surface = ALL_SIDES;
integer prim_image = 0;
integer prim_text = 5;
string avatar;
key avatar_id;
float timeout = 60.0;
integer desc_limit = 250;

startTimeout()
{
    llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.1]);
    llSetTimerEvent(timeout);
}

cancelTimeout()
{
    //llListenRemove(hndl);
    //llListenRemove(hndl_dialog);
    llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.0]);
    llSetTimerEvent(0.0);
}

integer checkTimeout()
{
    list edit_glow = llGetPrimitiveParams([PRIM_GLOW, 0]);
    if (llList2Float(edit_glow, 0) > 0.0)
    {
        return 1;//timeout in progress
    }
    else
    {
        return 0;
    }
}

default
{
    state_entry()
    {
        chan = (integer)(llFrand(-1000000000.0) - 1000000000.0); 
        hndl = llListen(chan, "", NULL_KEY, "");
    }
    
    on_rez(integer n)
    {
        chan = (integer)(llFrand(-1000000000.0) - 1000000000.0); 
        hndl = llListen(chan, "", NULL_KEY, "");
    }
        
    touch_start(integer n)
    {
        avatar_id = llDetectedKey(0);
        llListenRemove(hndl_dialog);
        if (checkTimeout() == 1) 
        {
            llInstantMessage(llDetectedKey(0), "PinBlock being edited. Please wait");
        }
        else
        {
            llDialog(llDetectedKey(0), "Choose option", ["clear", "chat", "display", "edit", "flip"], chan + 1);
            hndl_dialog = llListen(chan + 1, "", NULL_KEY, "");
        }
    }
    
    timer()
    {
        cancelTimeout();
    }
    
    listen(integer c, string name, key id, string msg)
    {
        if (c == chan + 1)
        {
            cancelTimeout();
            if (msg == "edit")
            {
                startTimeout();
                llTextBox(id, "Enter 127 char text or image UUID ("+llGetSubString((string)timeout, 0, 4)+" sec timeout)", chan);
            }
            else if (msg == "flip")
            {
                vector angles_in_radians = <0.0, 0.0,180.0>*DEG_TO_RAD;
                rotation rot_xyzq = llEuler2Rot(angles_in_radians);
                llSetRot(llGetRot()*rot_xyzq);
            }
            else if (msg == "clear")
            {
                llSetObjectDesc("");
                llSetTexture(TEXTURE_BLANK, ALL_SIDES);
            }
            else if (msg == "chat")
            {
                llInstantMessage(id, llGetObjectDesc());
            }
            else if (msg == "display")
            {
                //do stuff on remote display prim
                llWhisper(display_chan, (string)llGetTexture(0)+"|"+llGetObjectDesc());
            }
        }   
        if (c == chan)
        {
            if (osIsUUID(msg) == 1)
            {                
                llSetTexture(msg, prim_image);//draw image
                
                string CommandList = "";
                // draw a filled rectangle
                CommandList = osSetPenSize(CommandList, 3);                  
                CommandList = osSetPenColor(CommandList, "Black"); 
                CommandList = osMovePen(CommandList, 200, 240);            
                CommandList = osDrawFilledRectangle(CommandList, 55, 55);  
                // setup text to go in the drawn box
                CommandList = osMovePen(CommandList, 205, 245); 
                CommandList = osSetFontName(CommandList, "Arial");
                CommandList = osSetFontSize(CommandList, 4);  
                CommandList = osSetPenColor(CommandList, "White"); 
                CommandList = osDrawText(CommandList, osKey2Name(id));
                osSetDynamicTextureDataBlendFace("", "vector", CommandList, "width:256,height:256,Alpha:0", TRUE, 2, 0, 128, prim_image);
                cancelTimeout();
            }
            else 
            { 
                //draw text
                
                if (llStringLength(msg) > desc_limit)
                {
                    llInstantMessage(avatar_id, "Truncated at "+(string)desc_limit+" chars");
                }
                string submsg = llGetSubString(llStringTrim(msg, STRING_TRIM), 0, desc_limit);
                llSetObjectDesc(submsg);
                    
                string CommandList = "";
                list words = llParseString2List(submsg, [" "], []);//[".", ",", ";", ":"]);
                integer len = llGetListLength(words);
                integer i = 0;
                integer n = 0;
                string s = "";
                do
                {
                    while(llStringLength(s) < 21)
                    {
                        if (llListFindList([llList2String(words, i)], [".", ",", ";", ":"]) > -1)
                        {
                            s = s +llList2String(words, i);
                        }
                        else
                        {
                            s = s + " "+llList2String(words, i);
                        }
                            
                        i++;
                    }

                    CommandList = osMovePen( CommandList, 10, 10 + n*20 );           // Upper left corner at <10,10>
                    CommandList = osDrawText( CommandList, s );
                    n++;
                    s = "";
                }
                while (i < len);
                
                CommandList = osSetFontSize(CommandList, 8); 
                CommandList = osMovePen( CommandList, 10, 230 );
                CommandList = osDrawText( CommandList, osKey2Name(id) );
                osSetDynamicTextureDataFace( "", "vector", CommandList, "width:256,height:256", 0, 5 );
                cancelTimeout();
            }
        }
    }
}
These users thanked the author Graham Mills for the post:
Selby Evans
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: In search of a Scripted Memo Board

Post by Graham Mills »

OK, so I have uploaded a 12 position product I've provisionally called BlockBoard. The display screen is basically the backboard for the memo cards/blocks. It's cheap (10 KC) and I hope it works for you! https://www.kitely.com/market/product/5 ... BlockBoard
These users thanked the author Graham Mills for the post:
Selby Evans
User avatar
Kim McCabe
Posts: 38
Joined: Fri Mar 20, 2020 5:34 am
Has thanked: 58 times
Been thanked: 65 times

Re: In search of a Scripted Memo Board

Post by Kim McCabe »

This is really cool, Thank You so much!
These users thanked the author Kim McCabe for the post:
Graham Mills
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: In search of a Scripted Memo Board

Post by Graham Mills »

Kim McCabe wrote:
Fri Aug 21, 2020 6:29 pm
This is really cool, Thank You so much!
Most welcome. I should mention that I would imagine UUIDs will only work if the image is full perm? Anyway, I'll hopefully continue to refine it and in particular implement assigning/locking of individual pinblocks. Any feedback/feature requests, please DM me.
User avatar
Frank SquirrelHerder
Posts: 79
Joined: Mon Dec 24, 2018 7:16 pm
Location: North Dakota, USA
Has thanked: 124 times
Been thanked: 84 times

Re: In search of a Scripted Memo Board

Post by Frank SquirrelHerder »

This is really great, Graham!

Are you available for hire by chance, for scripting projects?
These users thanked the author Frank SquirrelHerder for the post:
Graham Mills
By day I write modern fantasy novels, by night I torture prims!
Powered by black coffee and dark beer.
User avatar
Brayla Sana
Posts: 78
Joined: Wed Mar 27, 2013 7:09 pm
Has thanked: 19 times
Been thanked: 144 times

Re: In search of a Scripted Memo Board

Post by Brayla Sana »

https://www.kitely.com/market/product/5 ... Full-Perms

I made this set about a month ago. There is a notecard version and a text channel version. It doesn't do photos, though.
These users thanked the author Brayla Sana for the post (total 2):
Frank SquirrelHerderGraham Mills
Dadiella's for Fashion and Brayla Sana Gallery for Building!
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: In search of a Scripted Memo Board

Post by Graham Mills »

Sorry, Frank, but I'm not really a commercial standard scripter across the board. There are a few areas I do dabble in, mostly education and OSSL related, but the gaps in both my knowledge and interests limit further engagement. Thanks for the kind words!
Frank SquirrelHerder wrote:
Fri Aug 28, 2020 7:14 pm
This is really great, Graham!

Are you available for hire by chance, for scripting projects?
These users thanked the author Graham Mills for the post:
Frank SquirrelHerder
Post Reply