Shortnote

This file is part of the inverse matrix calculator and assumes that the main calculator script file is placed in the same primitive and named [WaS-K] Matrix.

The optional script displays a spinner while the [WaS-K] Matrix script is active.

Code

activity_monitor.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
list spinChars = [ "↑", "↗", "→", "↘", "↓", "↙", "←", "↖" ];
string spinner() {
    string text = llList2String(llGetLinkPrimitiveParams(LINK_THIS, [PRIM_TEXT]), 0);
    do {
        string tok = llGetSubString(text, llStringLength(text)-1, llStringLength(text)-1);
        if(!~llListFindList(spinChars, (list)tok) && tok != "\n" && tok != "[" && tok != "]") jump show;
        text = llDeleteSubString(text, llStringLength(text)-1, llStringLength(text)-1);
    } while(llStringLength(text));
@show;
    string next = llList2String(spinChars,  0);
    spinChars = llDeleteSubList(spinChars, 0, 0);
    spinChars += next;
    return "[" + next + "]";
}
 
default {
    link_message(integer sender_num, integer num, string str, key id) {
        if(str == "start") {
            llSetTimerEvent(1);
            return;
        }
        llSetTimerEvent(0);
    }
    timer() {
        if(llGetScriptState("[WaS-K] Matrix") != TRUE) {
            llSetTimerEvent(0);
            return;
        }
        llSetText("Computing...\nPlease wait..." + "\n" + spinner(), <1,1,0>, 1);        
    }
}