Search This Blog

Thursday, October 13, 2016

Spin the Wheel - llSetLinkPrimitiveParamsFast

Step1: 
Three main prims:
- a button for starting the spin
- a cylinder as the wheel
- a cube as the message board (show the keywords)

Name the cylinder "wheel"
Name the button "Start Spin"

Link wheel and Start Spin prims together
Add the script to the Start Spin button

Step2:  
//-------------- Touch to trigger functions for different linked objects---------

default
{
    touch_start(integer number) {
 
        llPlaySound("SpinSound",1);  //-- Play Spin Sound
        integer lupe = llGetNumberOfPrims()+1;
        while(--lupe > 1) {
            if(llGetLinkName(lupe)=="wheel"){
                llSay(0,"Wheee!");
                spinCylinder(lupe); //---Connect to spinCylinder script
            }
        }
 
    }
}

Step3:  
//-------------- Control the rotation of the cylinder---------  (Slots from -15 to 15) 

spinCylinder(integer linkNumber) {
    list baseRot = llGetLinkPrimitiveParams(linkNumber,[PRIM_ROTATION]);
    integer numberMoves = (integer)llFrand(300.0);
    float angle = 0;
    float changeAngle=PI/5.0*((float)numberMoves)/300.0;

    while(numberMoves > 0) {
        angle += changeAngle;
        llSetLinkPrimitiveParamsFast(linkNumber,
                                    [PRIM_ROTATION,
                                    llEuler2Rot(<0 .0="" angle="">)*llList2Rot(baseRot,0)/llGetRootRotation()/llGetRootRotation()]);
        llSleep(0.05);
        changeAngle *= 0.98;
        numberMoves -= 1;
    }

    baseRot = llGetLinkPrimitiveParams(linkNumber,[PRIM_ROTATION]);
    vector finalRot = llRot2Euler(llList2Rot(baseRot,0)/llGetRootRotation());
     llOwnerSay("The number is " + (string)((integer)(finalRot.z*RAD_TO_DEG/12.0)));


//-------Say keywords related to the random number of rotation (from -15 to 15) ------

if((integer)(finalRot.z*RAD_TO_DEG/12.0)==1){
    llSay(123, "DABCT");
    llPlaySound("ResultSound",1);
}
if((integer)(finalRot.z*RAD_TO_DEG/12.0)==2){
     llSay(123, "DAM");
   llPlaySound("ResultSound",1);
}
if((integer)(finalRot.z*RAD_TO_DEG/12.0)==3){
     llSay(123,  "DAP");
     llPlaySound("ResultSound",1);
}
if((integer)(finalRot.z*RAD_TO_DEG/12.0)==4){
    llSay(123, "ITC");
     llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==5){
    llSay(123, "SAF");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==6){
    llSay(123, "DLMS");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==7){
    llSay(123, "DMM");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==8){
    llSay(123, "DBRE");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==9){
    llSay(123, "DBSE");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==10){
    llSay(123, "DCEE");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==11){
    llSay(123, "DLSGI");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==12){
     llSay(123, "DC");
     llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==13){
    llSay(123, "DEE");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==14){
    llSay(123, "DEIE");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==15){
     llSay(123, "DISE");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==0){
    llSay(123, "DME");
     llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-1){
    llSay(123, "IDAAE");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-2){
    llSay(123, "IDBE");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-3){
    llSay(123, "DASS");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-4){
    llSay(123, "DHTI");
    llPlaySound("ResultSound",1);
}
  if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-5){
    llSay(123, "DRS");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-6){
    llSay(123, "SN");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-7){
    llSay(123, "SO");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-8){
    llSay(123, "DCBS");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-9){
    llSay(123, "DCC");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-10){
    llSay(123, "DE");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-11){
    llSay(123, "CIHK");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-12){
    llSay(123, "ELC");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-13){
    llSay(123, "GEC");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-14){
    llSay(123, "SD");
    llPlaySound("ResultSound",1);
}
 if((integer)(finalRot.z*RAD_TO_DEG/12.0)==-15){
    llSay(123, "SHTM");
    llPlaySound("ResultSound",1);
}
}




Step4:  Setup Xyz text board
//------- Three flat prims as one board and set up three board

1. Xyz text board sScript for In the Parent board

/////////////// CONSTANTS ///////////////////
// XyText Message Map.
integer DISPLAY_STRING      = 204000;
integer DISPLAY_EXTENDED    = 204001;
integer REMAP_INDICES       = 204002;
integer RESET_INDICES       = 204003;
integer SET_CELL_INFO       = 204004;
integer SET_LINE_CHANNEL = 100100;

// This is an extended character escape sequence.
string  ESCAPE_SEQUENCE = "\\e";

// This is used to get an index for the extended character.
string  EXTENDED_INDEX  = "123456789abcdef";

// Face numbers.
integer LEFT_FACE       = 4;
integer MIDDLE_FACE     = 0;
integer RIGHT_FACE      = 2;

// This is a list of textures for all 2-character combinations.
list    CHARACTER_GRID  = [
        "00e9f9f7-0669-181c-c192-7f8e67678c8d",
        "347a5cb6-0031-7ec0-2fcf-f298eebf3c0e",
        "4e7e689e-37f1-9eca-8596-a958bbd23963",
        "19ea9c21-67ba-8f6f-99db-573b1b877eb1",
        "dde7b412-cda1-652f-6fc2-73f4641f96e1",
        "af6fa3bb-3a6c-9c4f-4bf5-d1c126c830da",
        "a201d3a2-364b-43b6-8686-5881c0f82a94",
        "b674dec8-fead-99e5-c28d-2db8e4c51540",
        "366e05f3-be6b-e5cf-c33b-731dff649caa",
        "75c4925c-0427-dc0c-c71c-e28674ff4d27",
        "dcbe166b-6a97-efb2-fc8e-e5bc6a8b1be6",
        "0dca2feb-fc66-a762-db85-89026a4ecd68",
        "a0fca76f-503a-946b-9336-0a918e886f7a",
        "67fb375d-89a1-5a4f-8c7a-0cd1c066ffc4",
        "300470b2-da34-5470-074c-1b8464ca050c",
        "d1f8e91c-ce2b-d85e-2120-930d3b630946",
        "2a190e44-7b29-dadb-0bff-c31adaf5a170",
        "75d55e71-f6f8-9835-e746-a45f189f30a1",
        "300fac33-2b30-3da3-26bc-e2d70428ec19",
        "0747c776-011a-53ce-13ee-8b5bb9e87c1e",
        "85a855c3-a94f-01ca-33e0-7dde92e727e2",
        "cbc1dab2-2d61-2986-1949-7a5235c954e1",
        "f7aef047-f266-9596-16df-641010edd8e1",
        "4c34ebf7-e5e1-2e1a-579f-e224d9d5e71b",
        "4a69e98c-26a5-ad05-e92e-b5b906ad9ef9",
        "462a9226-2a97-91ac-2d89-57ab33334b78",
        "20b24b3a-8c57-82ee-c6ed-555003f5dbcd",
        "9b481daa-9ea8-a9fa-1ee4-ab9a0d38e217",
        "c231dbdc-c842-15b0-7aa6-6da14745cfdc",
        "c97e3cbb-c9a3-45df-a0ae-955c1f4bf9cf",
        "f1e7d030-ff80-a242-cb69-f6951d4eae3b",
        "ed32d6c4-d733-c0f1-f242-6df1d222220d",
        "88f96a30-dccf-9b20-31ef-da0dfeb23c72",
        "252f2595-58b8-4bcc-6515-fa274d0cfb65",
        "f2838c4f-de80-cced-dff8-195dfdf36b2c",
        "cc2594fe-add2-a3df-cdb3-a61711badf53",
        "e0ce2972-da00-955c-129e-3289b3676776",
        "3e0d336d-321f-ddfa-5c1b-e26131766f6a",
        "d43b1dc4-6b51-76a7-8b90-38865b82bf06",
        "06d16cbb-1868-fd1d-5c93-eae42164a37d",
        "dd5d98cf-273e-3fd0-f030-48be58ee3a0b",
        "0e47c89e-de4a-6233-a2da-cb852aad1b00",
        "fb9c4a55-0e13-495b-25c4-f0b459dc06de",
        "e3ce8def-312c-735b-0e48-018b6799c883",
        "2f713216-4e71-d123-03ed-9c8554710c6b",
        "4a417d8a-1f4f-404b-9783-6672f8527911",
        "ca5e21ec-5b20-5909-4c31-3f90d7316b33",
        "06a4fcc3-e1c4-296d-8817-01f88fbd7367",
        "130ac084-6f3c-95de-b5b6-d25c80703474",
        "59d540a0-ae9d-3606-5ae0-4f2842b64cfa",
        "8612ae9a-f53c-5bf4-2899-8174d7abc4fd",
        "12467401-e979-2c49-34e0-6ac761542797",
        "d53c3eaa-0404-3860-0675-3e375596c3e3",
        "9f5b26bd-81d3-b25e-62fe-5b671d1e3e79",
        "f57f0b64-a050-d617-ee00-c8e9e3adc9cb",
        "beff166a-f5f3-f05e-e020-98f2b00e27ed",
        "02278a65-94ba-6d5e-0d2b-93f2e4f4bf70",
        "a707197d-449e-5b58-846c-0c850c61f9d6",
        "021d4b1a-9503-a44f-ee2b-976eb5d80e68",
        "0ae2ffae-7265-524d-cb76-c2b691992706",
        "f6e41cf2-1104-bd0b-0190-dffad1bac813",
        "2b4bb15e-956d-56ae-69f5-d26a20de0ce7",
        "f816da2c-51f1-612a-2029-a542db7db882",
        "345fea05-c7be-465c-409f-9dcb3bd2aa07",
        "b3017e02-c063-5185-acd5-1ef5f9d79b89",
        "4dcff365-1971-3c2b-d73c-77e1dc54242a"
          ];

///////////// END CONSTANTS ////////////////

///////////// GLOBAL VARIABLES ///////////////
// All displayable characters.  Default to ASCII order.
string gCharIndex;
// This is the channel to listen on while acting
// as a cell in a larger display.
integer gCellChannel      = -1;
// This is the starting character position in the cell channel message
// to render.
integer gCellCharPosition = 0;
/////////// END GLOBAL VARIABLES ////////////

ResetCharIndex() {
    gCharIndex  = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`";
    // \" <-- bug.="" fixes="" highlighting="" lsl="" p="" syntax="">    gCharIndex += "abcdefghijklmnopqrstuvwxyz{|}~";
    gCharIndex += "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}

vector GetGridPos(integer index1, integer index2) {
    // There are two ways to use the lookup table...
    integer Col;
    integer Row;
    if (index1 >= index2) {
        // In this case, the row is the index of the first character:
        Row = index1;
        // And the col is the index of the second character (x2)
        Col = index2 * 2;
    }
    else { // Index1 < Index2
        // In this case, the row is the index of the second character:
        Row = index2;
        // And the col is the index of the first character, x2, offset by 1.
        Col = index1 * 2 + 1;
    }
    return < Col, Row, 0>;
}

string GetGridTexture(vector grid_pos) {
    // Calculate the texture in the grid to use.
    integer GridCol = llRound(grid_pos.x) / 20;
    integer GridRow = llRound(grid_pos.y) / 10;

    // Lookup the texture.
    key Texture = llList2Key(CHARACTER_GRID, GridRow * (GridRow + 1) / 2 + GridCol);
    return Texture;
}

vector GetGridOffset(vector grid_pos) {
    // Zoom in on the texture showing our character pair.
    integer Col = llRound(grid_pos.x) % 20;
    integer Row = llRound(grid_pos.y) % 10;

    // Return the offset in the texture.
    return <-0 -="" .45="" 0.05="" 0.0="" 0.1="" 0.45="" col="" row="">;
}

ShowChars(vector grid_pos1, vector grid_pos2, vector grid_pos3) {
    // Set the primitive textures directly.
    llSetPrimitiveParams( [
        PRIM_TEXTURE, LEFT_FACE,   GetGridTexture(grid_pos1), <0 .1="" 0.1="" 0="">, GetGridOffset(grid_pos1), PI_BY_TWO,
        PRIM_TEXTURE, MIDDLE_FACE, GetGridTexture(grid_pos2), <0 .1="" 0.1="" 0="">, GetGridOffset(grid_pos2), 0.0,
        PRIM_TEXTURE, RIGHT_FACE,  GetGridTexture(grid_pos3), <0 .1="" 0.1="" 0="">, GetGridOffset(grid_pos3), -PI_BY_TWO
        ]);
}

RenderString(string str) {
    // Get the grid positions for each pair of characters.
    vector GridPos1 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 0, 0)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 1, 1)) );
    vector GridPos2 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 2, 2)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 3, 3)) );
    vector GridPos3 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 4, 4)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 5, 5)) );

    // Use these grid positions to display the correct textures/offsets.
    ShowChars(GridPos1, GridPos2, GridPos3);
}

RenderExtended(string str) {
    // Look for escape sequences.
    list Parsed       = llParseString2List(str, [], [ESCAPE_SEQUENCE]);
    integer ParsedLen = llGetListLength(Parsed);

    // Create a list of index values to work with.
    list Indices;
    // We start with room for 6 indices.
    integer IndicesLeft = 6;

    integer i;
    string Token;
    integer Clipped;
    integer LastWasEscapeSequence = FALSE;
    // Work from left to right.
    for (i = 0; i < ParsedLen && IndicesLeft > 0; i++) {
        Token = llList2String(Parsed, i);

        // If this is an escape sequence, just set the flag and move on.
        if (Token == ESCAPE_SEQUENCE) {
            LastWasEscapeSequence = TRUE;
        }
        else { // Token != ESCAPE_SEQUENCE
            // Otherwise this is a normal token.  Check its length.
            Clipped = FALSE;
            integer TokenLength = llStringLength(Token);
            // Clip if necessary.
            if (TokenLength > IndicesLeft) {
                Token = llGetSubString(Token, 0, IndicesLeft - 1);
                TokenLength = llStringLength(Token);
                IndicesLeft = 0;
                Clipped = TRUE;
            }
            else
                IndicesLeft -= TokenLength;

            // Was the previous token an escape sequence?
            if (LastWasEscapeSequence) {
                // Yes, the first character is an escape character, the rest are normal.

                // This is the extended character.
                Indices += [llSubStringIndex(EXTENDED_INDEX, llGetSubString(Token, 0, 0)) + 95];

                // These are the normal characters.
                integer j;
                for (j = 1; j < TokenLength; j++)
                    Indices += [llSubStringIndex(gCharIndex, llGetSubString(Token, j, j))];
            }
            else { // Normal string.
                // Just add the characters normally.
                integer j;
                for (j = 0; j < TokenLength; j++)
                    Indices += [llSubStringIndex(gCharIndex, llGetSubString(Token, j, j))];
            }

            // Unset this flag, since this was not an escape sequence.
            LastWasEscapeSequence = FALSE;
        }
    }

    // Use the indices to create grid positions.
    vector GridPos1 = GetGridPos( llList2Integer(Indices, 0), llList2Integer(Indices, 1) );
    vector GridPos2 = GetGridPos( llList2Integer(Indices, 2), llList2Integer(Indices, 3) );
    vector GridPos3 = GetGridPos( llList2Integer(Indices, 4), llList2Integer(Indices, 5) );

    // Use these grid positions to display the correct textures/offsets.
    ShowChars(GridPos1, GridPos2, GridPos3);
}

integer ConvertIndex(integer index) {
    // This converts from an ASCII based index to our indexing scheme.
    if (index >= 32) // ' ' or higher
        index -= 32;
    else { // index < 32
        // Quick bounds check.
        if (index > 15)
            index = 15;

        index += 94; // extended characters
    }

    return index;
}

default {
    state_entry() {
        // Initialize the character index.
        ResetCharIndex();
        integer ThisLink = llGetLinkNumber();
        llMessageLinked(ThisLink , SET_CELL_INFO, llList2CSV([SET_LINE_CHANNEL, 0]), "");
        llMessageLinked(ThisLink + 1, SET_CELL_INFO, llList2CSV([SET_LINE_CHANNEL, 6]), "");
        llMessageLinked(ThisLink + 2, SET_CELL_INFO, llList2CSV([SET_LINE_CHANNEL, 12]), "");
        llMessageLinked(ThisLink + 3, SET_CELL_INFO, llList2CSV([SET_LINE_CHANNEL, 18]), "");
        llMessageLinked(ThisLink + 4, SET_CELL_INFO, llList2CSV([SET_LINE_CHANNEL, 24]), "");



        //llSay(0, "Free Memory: " + (string) llGetFreeMemory());
    }

    link_message(integer sender, integer channel, string data, key id) {
        if (channel == DISPLAY_STRING) {
            RenderString(data);
            return;
        }
        if (channel == DISPLAY_EXTENDED) {
            RenderExtended(data);
            return;
        }
        if (channel == gCellChannel) {
            // Extract the characters we are interested in, and use those to render.
            RenderString( llGetSubString(data, gCellCharPosition, gCellCharPosition + 5) );
            return;
        }
        if (channel == REMAP_INDICES) {
            // Parse the message, splitting it up into index values.
            list Parsed = llCSV2List(data);
            integer i;
            // Go through the list and swap each pair of indices.
            for (i = 0; i < llGetListLength(Parsed); i += 2) {
                integer Index1 = ConvertIndex( llList2Integer(Parsed, i) );
                integer Index2 = ConvertIndex( llList2Integer(Parsed, i + 1) );

                // Swap these index values.
                string Value1 = llGetSubString(gCharIndex, Index1, Index1);
                string Value2 = llGetSubString(gCharIndex, Index2, Index2);

                gCharIndex = llDeleteSubString(gCharIndex, Index1, Index1);
                gCharIndex = llInsertString(gCharIndex, Index1, Value2);

                gCharIndex = llDeleteSubString(gCharIndex, Index2, Index2);
                gCharIndex = llInsertString(gCharIndex, Index2, Value1);
            }
            return;
        }
        if (channel == RESET_INDICES) {
            // Restore the character index back to default settings.
            ResetCharIndex();
            return;
        }
        if (channel == SET_CELL_INFO) {
            // Change the channel we listen to for cell commands, and the
            // starting character position to extract from.
            list Parsed = llCSV2List(data);
            gCellChannel        = (integer) llList2String(Parsed, 0);;
            gCellCharPosition   = (integer) llList2String(Parsed, 1);
            return;
        }
    }

}

2. Xyz text board script for the child board

////////////////////////////////////////////
// XyText Slave Script
//
// Based on XyText v1.0.2 by Xylor Baysklef
// Thanks to AngryBeth Shortbread
////////////////////////////////////////////

/////////////// CONSTANTS ///////////////////
// XyText Message Map.
integer DISPLAY_STRING      = 204000;
integer DISPLAY_EXTENDED    = 204001;
integer REMAP_INDICES       = 204002;
integer RESET_INDICES       = 204003;
integer SET_CELL_INFO       = 204004;
integer SET_LINE_CHANNEL = 100100;

// This is an extended character escape sequence.
string  ESCAPE_SEQUENCE = "\\e";

// This is used to get an index for the extended character.
string  EXTENDED_INDEX  = "123456789abcdef";

// Face numbers.
integer LEFT_FACE       = 4;
integer MIDDLE_FACE     = 0;
integer RIGHT_FACE      = 2;

// This is a list of textures for all 2-character combinations.
list    CHARACTER_GRID  = [
        "00e9f9f7-0669-181c-c192-7f8e67678c8d",
        "347a5cb6-0031-7ec0-2fcf-f298eebf3c0e",
        "4e7e689e-37f1-9eca-8596-a958bbd23963",
        "19ea9c21-67ba-8f6f-99db-573b1b877eb1",
        "dde7b412-cda1-652f-6fc2-73f4641f96e1",
        "af6fa3bb-3a6c-9c4f-4bf5-d1c126c830da",
        "a201d3a2-364b-43b6-8686-5881c0f82a94",
        "b674dec8-fead-99e5-c28d-2db8e4c51540",
        "366e05f3-be6b-e5cf-c33b-731dff649caa",
        "75c4925c-0427-dc0c-c71c-e28674ff4d27",
        "dcbe166b-6a97-efb2-fc8e-e5bc6a8b1be6",
        "0dca2feb-fc66-a762-db85-89026a4ecd68",
        "a0fca76f-503a-946b-9336-0a918e886f7a",
        "67fb375d-89a1-5a4f-8c7a-0cd1c066ffc4",
        "300470b2-da34-5470-074c-1b8464ca050c",
        "d1f8e91c-ce2b-d85e-2120-930d3b630946",
        "2a190e44-7b29-dadb-0bff-c31adaf5a170",
        "75d55e71-f6f8-9835-e746-a45f189f30a1",
        "300fac33-2b30-3da3-26bc-e2d70428ec19",
        "0747c776-011a-53ce-13ee-8b5bb9e87c1e",
        "85a855c3-a94f-01ca-33e0-7dde92e727e2",
        "cbc1dab2-2d61-2986-1949-7a5235c954e1",
        "f7aef047-f266-9596-16df-641010edd8e1",
        "4c34ebf7-e5e1-2e1a-579f-e224d9d5e71b",
        "4a69e98c-26a5-ad05-e92e-b5b906ad9ef9",
        "462a9226-2a97-91ac-2d89-57ab33334b78",
        "20b24b3a-8c57-82ee-c6ed-555003f5dbcd",
        "9b481daa-9ea8-a9fa-1ee4-ab9a0d38e217",
        "c231dbdc-c842-15b0-7aa6-6da14745cfdc",
        "c97e3cbb-c9a3-45df-a0ae-955c1f4bf9cf",
        "f1e7d030-ff80-a242-cb69-f6951d4eae3b",
        "ed32d6c4-d733-c0f1-f242-6df1d222220d",
        "88f96a30-dccf-9b20-31ef-da0dfeb23c72",
        "252f2595-58b8-4bcc-6515-fa274d0cfb65",
        "f2838c4f-de80-cced-dff8-195dfdf36b2c",
        "cc2594fe-add2-a3df-cdb3-a61711badf53",
        "e0ce2972-da00-955c-129e-3289b3676776",
        "3e0d336d-321f-ddfa-5c1b-e26131766f6a",
        "d43b1dc4-6b51-76a7-8b90-38865b82bf06",
        "06d16cbb-1868-fd1d-5c93-eae42164a37d",
        "dd5d98cf-273e-3fd0-f030-48be58ee3a0b",
        "0e47c89e-de4a-6233-a2da-cb852aad1b00",
        "fb9c4a55-0e13-495b-25c4-f0b459dc06de",
        "e3ce8def-312c-735b-0e48-018b6799c883",
        "2f713216-4e71-d123-03ed-9c8554710c6b",
        "4a417d8a-1f4f-404b-9783-6672f8527911",
        "ca5e21ec-5b20-5909-4c31-3f90d7316b33",
        "06a4fcc3-e1c4-296d-8817-01f88fbd7367",
        "130ac084-6f3c-95de-b5b6-d25c80703474",
        "59d540a0-ae9d-3606-5ae0-4f2842b64cfa",
        "8612ae9a-f53c-5bf4-2899-8174d7abc4fd",
        "12467401-e979-2c49-34e0-6ac761542797",
        "d53c3eaa-0404-3860-0675-3e375596c3e3",
        "9f5b26bd-81d3-b25e-62fe-5b671d1e3e79",
        "f57f0b64-a050-d617-ee00-c8e9e3adc9cb",
        "beff166a-f5f3-f05e-e020-98f2b00e27ed",
        "02278a65-94ba-6d5e-0d2b-93f2e4f4bf70",
        "a707197d-449e-5b58-846c-0c850c61f9d6",
        "021d4b1a-9503-a44f-ee2b-976eb5d80e68",
        "0ae2ffae-7265-524d-cb76-c2b691992706",
        "f6e41cf2-1104-bd0b-0190-dffad1bac813",
        "2b4bb15e-956d-56ae-69f5-d26a20de0ce7",
        "f816da2c-51f1-612a-2029-a542db7db882",
        "345fea05-c7be-465c-409f-9dcb3bd2aa07",
        "b3017e02-c063-5185-acd5-1ef5f9d79b89",
        "4dcff365-1971-3c2b-d73c-77e1dc54242a"
          ];

///////////// END CONSTANTS ////////////////

///////////// GLOBAL VARIABLES ///////////////
// All displayable characters.  Default to ASCII order.
string gCharIndex;
// This is the channel to listen on while acting
// as a cell in a larger display.
integer gCellChannel      = -1;
// This is the starting character position in the cell channel message
// to render.
integer gCellCharPosition = 0;
/////////// END GLOBAL VARIABLES ////////////

ResetCharIndex() {
    gCharIndex  = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`";
    // \" <-- b="" bug.="" fixes="" highlighting="" lsl="" syntax="">
    gCharIndex += "abcdefghijklmnopqrstuvwxyz{|}~";
    gCharIndex += "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}

vector GetGridPos(integer index1, integer index2) {
    // There are two ways to use the lookup table...
    integer Col;
    integer Row;
    if (index1 >= index2) {
        // In this case, the row is the index of the first character:
        Row = index1;
        // And the col is the index of the second character (x2)
        Col = index2 * 2;
    }
    else { // Index1 < Index2
        // In this case, the row is the index of the second character:
        Row = index2;
        // And the col is the index of the first character, x2, offset by 1.
        Col = index1 * 2 + 1;
    }
    return < Col, Row, 0>;
}

string GetGridTexture(vector grid_pos) {
    // Calculate the texture in the grid to use.
    integer GridCol = llRound(grid_pos.x) / 20;
    integer GridRow = llRound(grid_pos.y) / 10;

    // Lookup the texture.
    key Texture = llList2Key(CHARACTER_GRID, GridRow * (GridRow + 1) / 2 + GridCol);
    return Texture;
}

vector GetGridOffset(vector grid_pos) {
    // Zoom in on the texture showing our character pair.
    integer Col = llRound(grid_pos.x) % 20;
    integer Row = llRound(grid_pos.y) % 10;

    // Return the offset in the texture.
    return <-0 -="" .45="" 0.05="" 0.0="" 0.1="" 0.45="" col="" row="">;
}

ShowChars(vector grid_pos1, vector grid_pos2, vector grid_pos3) {
    // Set the primitive textures directly.
    llSetPrimitiveParams( [
        PRIM_TEXTURE, LEFT_FACE,   GetGridTexture(grid_pos1), <0 .1="" 0.1="" 0="">, GetGridOffset(grid_pos1), PI_BY_TWO,
        PRIM_TEXTURE, MIDDLE_FACE, GetGridTexture(grid_pos2), <0 .1="" 0.1="" 0="">, GetGridOffset(grid_pos2), 0.0,
        PRIM_TEXTURE, RIGHT_FACE,  GetGridTexture(grid_pos3), <0 .1="" 0.1="" 0="">, GetGridOffset(grid_pos3), -PI_BY_TWO
        ]);
}

RenderString(string str) {
    // Get the grid positions for each pair of characters.
    vector GridPos1 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 0, 0)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 1, 1)) );
    vector GridPos2 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 2, 2)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 3, 3)) );
    vector GridPos3 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 4, 4)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 5, 5)) );

    // Use these grid positions to display the correct textures/offsets.
    ShowChars(GridPos1, GridPos2, GridPos3);
}

RenderExtended(string str) {
    // Look for escape sequences.
    list Parsed       = llParseString2List(str, [], [ESCAPE_SEQUENCE]);
    integer ParsedLen = llGetListLength(Parsed);

    // Create a list of index values to work with.
    list Indices;
    // We start with room for 6 indices.
    integer IndicesLeft = 6;

    integer i;
    string Token;
    integer Clipped;
    integer LastWasEscapeSequence = FALSE;
    // Work from left to right.
    for (i = 0; i < ParsedLen && IndicesLeft > 0; i++) {
        Token = llList2String(Parsed, i);

        // If this is an escape sequence, just set the flag and move on.
        if (Token == ESCAPE_SEQUENCE) {
            LastWasEscapeSequence = TRUE;
        }
        else { // Token != ESCAPE_SEQUENCE
            // Otherwise this is a normal token.  Check its length.
            Clipped = FALSE;
            integer TokenLength = llStringLength(Token);
            // Clip if necessary.
            if (TokenLength > IndicesLeft) {
                Token = llGetSubString(Token, 0, IndicesLeft - 1);
                TokenLength = llStringLength(Token);
                IndicesLeft = 0;
                Clipped = TRUE;
            }
            else
                IndicesLeft -= TokenLength;

            // Was the previous token an escape sequence?
            if (LastWasEscapeSequence) {
                // Yes, the first character is an escape character, the rest are normal.

                // This is the extended character.
                Indices += [llSubStringIndex(EXTENDED_INDEX, llGetSubString(Token, 0, 0)) + 95];

                // These are the normal characters.
                integer j;
                for (j = 1; j < TokenLength; j++)
                    Indices += [llSubStringIndex(gCharIndex, llGetSubString(Token, j, j))];
            }
            else { // Normal string.
                // Just add the characters normally.
                integer j;
                for (j = 0; j < TokenLength; j++)
                    Indices += [llSubStringIndex(gCharIndex, llGetSubString(Token, j, j))];
            }

            // Unset this flag, since this was not an escape sequence.
            LastWasEscapeSequence = FALSE;
        }
    }

    // Use the indices to create grid positions.
    vector GridPos1 = GetGridPos( llList2Integer(Indices, 0), llList2Integer(Indices, 1) );
    vector GridPos2 = GetGridPos( llList2Integer(Indices, 2), llList2Integer(Indices, 3) );
    vector GridPos3 = GetGridPos( llList2Integer(Indices, 4), llList2Integer(Indices, 5) );

    // Use these grid positions to display the correct textures/offsets.
    ShowChars(GridPos1, GridPos2, GridPos3);
}

integer ConvertIndex(integer index) {
    // This converts from an ASCII based index to our indexing scheme.
    if (index >= 32) // ' ' or higher
        index -= 32;
    else { // index < 32
        // Quick bounds check.
        if (index > 15)
            index = 15;

        index += 94; // extended characters
    }

    return index;
}

default {
    state_entry() {
        // Initialize the character index.
        ResetCharIndex();
        

        //llSay(0, "Free Memory: " + (string) llGetFreeMemory());
    }

    link_message(integer sender, integer channel, string data, key id) {
        if (channel == DISPLAY_STRING) {
            RenderString(data);
            return;
        }
        if (channel == DISPLAY_EXTENDED) {
            RenderExtended(data);
            return;
        }
        if (channel == gCellChannel) {
            // Extract the characters we are interested in, and use those to render.
            RenderString( llGetSubString(data, gCellCharPosition, gCellCharPosition + 5) );
            return;
        }
        if (channel == REMAP_INDICES) {
            // Parse the message, splitting it up into index values.
            list Parsed = llCSV2List(data);
            integer i;
            // Go through the list and swap each pair of indices.
            for (i = 0; i < llGetListLength(Parsed); i += 2) {
                integer Index1 = ConvertIndex( llList2Integer(Parsed, i) );
                integer Index2 = ConvertIndex( llList2Integer(Parsed, i + 1) );

                // Swap these index values.
                string Value1 = llGetSubString(gCharIndex, Index1, Index1);
                string Value2 = llGetSubString(gCharIndex, Index2, Index2);

                gCharIndex = llDeleteSubString(gCharIndex, Index1, Index1);
                gCharIndex = llInsertString(gCharIndex, Index1, Value2);

                gCharIndex = llDeleteSubString(gCharIndex, Index2, Index2);
                gCharIndex = llInsertString(gCharIndex, Index2, Value1);
            }
            return;
        }
        if (channel == RESET_INDICES) {
            // Restore the character index back to default settings.
            ResetCharIndex();
            return;
        }
        if (channel == SET_CELL_INFO) {
            // Change the channel we listen to for cell commands, and the
            // starting character position to extract from.
            list Parsed = llCSV2List(data);
            gCellChannel        = (integer) llList2String(Parsed, 0);;
            gCellCharPosition   = (integer) llList2String(Parsed, 1);
            return;
        }
    }

}



//-------Show keywords related to the random number of rotation (from -15 to 15) on the announcement board -- (Set up New Script file in the Parent board)

////////////////////////////////////////////
// XyText TextSend
//
// A basic script for the XYText board
// Thanks to AngryBeth Shortbread
////////////////////////////////////////////

integer listenHandle;
integer RandomNo;

integer SET_LINE_CHANNEL = 100100;
integer DISPLAY_STRING      = 204000;
integer DISPLAY_EXTENDED    = 204001;
integer REMAP_INDICES       = 204002;
integer RESET_INDICES       = 204003;
integer SET_FADE_OPTIONS    = 204004;
integer SET_FONT_TEXTURE    = 204005;
integer SET_LINE_COLOR      = 204006;
integer SET_COLOR           = 204007;
integer RESCAN_LINKSET      = 204008;


default
{
    state_entry()
    {
         // Channel to set the line with

            listenHandle = llListen(123, "", NULL_KEY, "");
    }

    listen(integer chan, string name, key id, string msg)
    {
     
        list parsed = llParseString2List(msg,[" "],[]);
        integer RandomNo = (integer)llFrand(5);
        string text = llList2String(parsed, 0);
        llOwnerSay("Keyword number is " + (string)RandomNo);
 
        if(text == "DABCT"){
         llSay(0, "Department of Applied Biology and Chemical Technology:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Probes", "'");
         llSay(0, "Your keyword is Probes");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Eco", "'");
         llSay(0, "Your keyword is Eco");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Iodine", "'");
         llSay(0, "Your keyword is Iodine");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Biotechnology", "'");
         llSay(0, "Your keyword is Biotechnology");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Molecular", "'");
         llSay(0, "Your keyword is Molecular");
        }
    }
   
        if(text == "DAM"){
         llSay(0, "Department of Applied Mathematics:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Statistics", "'");
         llSay(0, "Your keyword is Statistics");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Diffusion", "'");
         llSay(0, "Your keyword is Diffusion");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Computation", "'");
         llSay(0, "Your keyword is Computation");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Probability", "'");
         llSay(0, "Your keyword is Probability");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Finance", "'");
         llSay(0, "Your keyword is Finance");
        }
    }
 
        if(text == "DAP"){
         llSay(0, "Department of Applied Physics:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Nanotechnology", "'");
         llSay(0, "Your keyword is Nanotechnology");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Plasma", "'");
         llSay(0, "Your keyword is Plasma");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Optics", "'");
         llSay(0, "Your keyword is Optics");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Photonics", "'");
         llSay(0, "Your keyword is Photonics");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Energy", "'");
         llSay(0, "Your keyword is Energy");
        }
    }    
 
        if(text == "ITC"){
         llSay(0, "Institute of Textiles and Clothing:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Retail", "'");
         llSay(0, "Your keyword is Retail");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Fibre", "'");
         llSay(0, "Your keyword is Fibre");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Thermal", "'");
         llSay(0, "Your keyword is Thermal");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Ergonomics", "'");
         llSay(0, "Your keyword is Ergonomics");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Silicon", "'");
         llSay(0, "Your keyword is Silicon");
        }
    }
     
        if(text == "SAF"){
         llSay(0, "School of Accounting and Finance:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Disclosure", "'");
         llSay(0, "Your keyword is Disclosure");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Audit", "'");
         llSay(0, "Your keyword is Audit");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Economy", "'");
         llSay(0, "Your keyword is Economy");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Banking", "'");
         llSay(0, "Your keyword is Banking");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Policymaking", "'");
         llSay(0, "Your keyword is Policymaking");
        }
    }
 
        if(text == "DLMS"){
         llSay(0, "Department of Logistics and Maritime Studies:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Geography", "'");
         llSay(0, "Your keyword is Geography");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Shipping", "'");
         llSay(0, "Your keyword is Shipping");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Transport", "'");
         llSay(0, "Your keyword is Transport");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Marine", "'");
         llSay(0, "Your keyword is Marine");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Supply chain", "'");
         llSay(0, "Your keyword is Supply chain");
        }
    }

        if(text == "DMM"){
         llSay(0, "Department of Management and Marketing:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Leadership", "'");
         llSay(0, "Your keyword is Leadership");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Authoritarian", "'");
         llSay(0, "Your keyword is Authoritarian");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "CEO", "'");
         llSay(0, "Your keyword is CEO");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Administration", "'");
         llSay(0, "Your keyword is Administration");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Non-profit", "'");
         llSay(0, "Your keyword is Non-profit");
        }
    }
 
        if(text == "DBRE"){
         llSay(0, "Department of Building and Real Estate:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Architecture", "'");
         llSay(0, "Your keyword is Architecture");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Stress", "'");
         llSay(0, "Your keyword is Stress");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Urban", "'");
         llSay(0, "Your keyword is Urban");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Cladding", "'");
         llSay(0, "Your keyword is Cladding");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Scaffoldingn", "'");
         llSay(0, "Your keyword is Scaffolding");
        }
    }
     
        if(text == "DBSE"){
         llSay(0, "Department of Building Services Engineering:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Facilities", "'");
         llSay(0, "Your keyword is Facilities");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Acoustics", "'");
         llSay(0, "Your keyword is Acoustics");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Bioaerosal", "'");
         llSay(0, "Your keyword is Bioaerosal");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "HVAC", "'");
         llSay(0, "Your keyword is HVAC");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Janitorial", "'");
         llSay(0, "Your keyword is Janitorial");
        }
    }
     
         if(text == "DCEE"){
         llSay(0, "Department of Civil and Environmental Engineering:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Geotechnical", "'");
         llSay(0, "Your keyword is Geotechnical");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Hydraulics", "'");
         llSay(0, "Your keyword is Hydraulics");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Contamination", "'");
         llSay(0, "Your keyword is Contamination");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Air quality", "'");
         llSay(0, "Your keyword is Air quality");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Traffic pollution", "'");
         llSay(0, "Your keyword is Traffic pollution");
        }
    }
           
         if(text == "DLSGI"){
         llSay(0, "Department of Land Surveying and Geo-Informatics:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Geospace", "'");
         llSay(0, "Your keyword is Geospace");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Mapping", "'");
         llSay(0, "Your keyword is Mapping");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "GPS", "'");
         llSay(0, "Your keyword is GPS");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Wavebands", "'");
         llSay(0, "Your keyword is Wavebands");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Landsliden", "'");
         llSay(0, "Your keyword is Landslide");
        }
    }
     
         if(text == "DC"){
         llSay(0, "Department of Computing:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Digital", "'");
         llSay(0, "Your keyword is Digital");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "IT", "'");
         llSay(0, "Your keyword is IT");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Cloud", "'");
         llSay(0, "Your keyword is Cloud");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Wireless", "'");
         llSay(0, "Your keyword is Wireless");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Big Data", "'");
         llSay(0, "Your keyword is Big Data");
        }
    }
     
         if(text == "DEE"){
         llSay(0, "Department of Electrical Engineering:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Railway", "'");
         llSay(0, "Your keyword is Railway");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Tidal Energy", "'");
         llSay(0, "Your keyword is Tidal Energy");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Magnetics", "'");
         llSay(0, "Your keyword is Magnetics");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Circuits", "'");
         llSay(0, "Your keyword is Circuits");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Graphite", "'");
         llSay(0, "Your keyword is Graphite");
        }
    }        
         if(text == "DEIE"){
         llSay(0, "Department of Electronic and Information Engineering:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Accelerator", "'");
         llSay(0, "Your keyword is Accelerator");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Microelectronics", "'");
         llSay(0, "Your keyword is Microelectronics");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Signal processing", "'");
         llSay(0, "Your keyword is Signal processing");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Analogue", "'");
         llSay(0, "Your keyword is Analogue");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Microwave", "'");
         llSay(0, "Your keyword is Microwave");
        }
    }
     
         if(text == "DISE"){
         llSay(0, "Department of Industrial and Systems Engineering:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Supply Chain", "'");
         llSay(0, "Your keyword is Supply Chain");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "RFID", "'");
         llSay(0, "Your keyword is RFID");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Mechatronics", "'");
         llSay(0, "Your keyword is Mechatronics");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Machining", "'");
         llSay(0, "Your keyword is Machining");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Laser", "'");
         llSay(0, "Your keyword is Laser");
        }
    }
         
         if(text == "DME"){
         llSay(0, "Department of Mechanical Engineering:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Hybrid", "'");
         llSay(0, "Your keyword is Hybrid");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Nanostructure", "'");
         llSay(0, "Your keyword is Nanostructure");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Hypersonic", "'");
         llSay(0, "Your keyword is Hypersonic");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Fuel Cell", "'");
         llSay(0, "Your keyword is Fuel Cell");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Holography", "'");
         llSay(0, "Your keyword is Holography");
        }
    }
     
         if(text == "IDAAE"){
         llSay(0, "Interdisciplinary Division of Aeronautical and Aviation Engineering:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Aerodynamics", "'");
         llSay(0, "Your keyword is Aerodynamics");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Flight", "'");
         llSay(0, "Your keyword is Flight");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Turbofan", "'");
         llSay(0, "Your keyword is Turbofan");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Propulsion", "'");
         llSay(0, "Your keyword is Propulsion");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Simulator", "'");
         llSay(0, "Your keyword is Simulator");
        }
    }
     
         if(text == "IDBE"){
         llSay(0, "Interdisciplinary Division of Biomedical Engineering:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Prosthetics", "'");
         llSay(0, "Your keyword is Prosthetics");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Orthotics", "'");
         llSay(0, "Your keyword is Orthotics");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Diagnostics", "'");
         llSay(0, "Your keyword is Diagnostics");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Instrumentation", "'");
         llSay(0, "Your keyword is Instrumentation");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Musculoskeletal", "'");
         llSay(0, "Your keyword is Musculoskeletal");
        }
    }
     
         if(text == "DASS"){
         llSay(0, "Department of Applied Social Sciencess:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Ethnography", "'");
         llSay(0, "Your keyword is Ethnography");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Disaster", "'");
         llSay(0, "Your keyword is Disaster");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Gambling", "'");
         llSay(0, "Your keyword is Gambling");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Ethics", "'");
         llSay(0, "Your keyword is Ethics");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Globalisation", "'");
         llSay(0, "Your keyword is Globalisation");
        }
    }

         if(text == "DHTI"){
         llSay(0, "Department of Health Technology and Informatics:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Radiotherapy", "'");
         llSay(0, "Your keyword is Radiotherapy");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Carcinoma", "'");
         llSay(0, "Your keyword is Carcinoma");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Cancer", "'");
         llSay(0, "Your keyword is Cancer");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Genomics", "'");
         llSay(0, "Your keyword is Genomics");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Microbial", "'");
         llSay(0, "Your keyword is Microbial");
        }
    }

         if(text == "DRS"){
         llSay(0, "Department of Rehabilitation Sciences:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Neurological", "'");
         llSay(0, "Your keyword is Neurological");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Orthopaedic", "'");
         llSay(0, "Your keyword is Orthopaedic");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Geriatric", "'");
         llSay(0, "Your keyword is Geriatric");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Sports", "'");
         llSay(0, "Your keyword is Sports");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Physiotherapy", "'");
         llSay(0, "Your keyword is Physiotherapy");
        }
    }        
     
         if(text == "SN"){
         llSay(0, "Department of Nursing:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Palliative", "'");
         llSay(0, "Your keyword is Palliative");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Ageing", "'");
         llSay(0, "Your keyword is Ageing");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Childhood", "'");
         llSay(0, "Your keyword is Childhood");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Biomarkers", "'");
         llSay(0, "Your keyword is Biomarkers");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Parkinson’s", "'");
         llSay(0, "Your keyword is Parkinson’s");
        }
    }  
 
          if(text == "SO"){
         llSay(0, "Department of Optometry:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Vision", "'");
         llSay(0, "Your keyword is Vision");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Myopia", "'");
         llSay(0, "Your keyword is Myopia");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Glaucoma", "'");
         llSay(0, "Your keyword is Glaucoma");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Dystrophy", "'");
         llSay(0, "Your keyword is Dystrophy");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Optics", "'");
         llSay(0, "Your keyword is Optics");
        }
    }  
 
 
          if(text == "DCBS"){
         llSay(0, "Department of Chinese and Bilingual Studies:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Speech Therapy", "'");
         llSay(0, "Your keyword is Speech Therapy");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Translation", "'");
         llSay(0, "Your keyword is Translation");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Biliteracy", "'");
         llSay(0, "Your keyword is Biliteracy");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Trilingualism", "'");
         llSay(0, "Your keyword is Trilingualism");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Foreign Language", "'");
         llSay(0, "Your keyword is Foreign Language");
        }
    }
     
          if(text == "DCC"){
         llSay(0, "Department of Chinese and Culture:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Cultural Revolution", "'");
         llSay(0, "Your keyword is Cultural Revolution");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Bio-archiving", "'");
         llSay(0, "Your keyword is Bio-archiving");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Hong Kong", "'");
         llSay(0, "Your keyword is Hong Kong");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Nationalist", "'");
         llSay(0, "Your keyword is Nationalist");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Bodhisattvas", "'");
         llSay(0, "Your keyword is Bodhisattvas");
        }
    }
     
     
          if(text == "DE"){
         llSay(0, "Department of English:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Linguistics", "'");
         llSay(0, "Your keyword is Linguistics");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Metaphor", "'");
         llSay(0, "Your keyword is Metaphor");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Lingua Franca", "'");
         llSay(0, "Your keyword is Lingua Franca");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Literature", "'");
         llSay(0, "Your keyword is Literature");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Corpus", "'");
         llSay(0, "Your keyword is Corpus");
        }
    }
 
          if(text == "CIHK"){
         llSay(0, "Confucius Institute of Hong Kong:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Hanban", "'");
         llSay(0, "Your keyword is Hanban");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Exploratorium", "'");
         llSay(0, "Your keyword is Exploratorium");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Ming Dynasty", "'");
         llSay(0, "Your keyword is Ming Dynasty");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Indoctrination", "'");
         llSay(0, "Your keyword is Indoctrination");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Sinology", "'");
         llSay(0, "Your keyword is Sinology");
        }
    }
     
          if(text == "ELC"){
         llSay(0, "English Language Centre:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Pedagogy", "'");
         llSay(0, "Your keyword is Pedagogy");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Writing", "'");
         llSay(0, "Your keyword is Writing");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Target Language", "'");
         llSay(0, "Your keyword is Target Language");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Language Learning", "'");
         llSay(0, "Your keyword is Language Learning");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Autonomy", "'");
         llSay(0, "Your keyword is Autonomy");
        }
    }      

           if(text == "GEC"){
         llSay(0, "General Education Centre:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Interdisciplinary", "'");
         llSay(0, "Your keyword is Interdisciplinary");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Citizenship", "'");
         llSay(0, "Your keyword is Citizenship");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Storytelling", "'");
         llSay(0, "Your keyword is Storytelling");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Inter-collegiate", "'");
         llSay(0, "Your keyword is Inter-collegiate");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Appreciation", "'");
         llSay(0, "Your keyword is Appreciation");
        }
    }
         
           if(text == "SD"){
         llSay(0, "School of Design:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Social media", "'");
         llSay(0, "Your keyword is Social media");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Innovation", "'");
         llSay(0, "Your keyword is Innovation");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Spatial", "'");
         llSay(0, "Your keyword is Spatial");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Craft", "'");
         llSay(0, "Your keyword is Craft");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "DIY", "'");
         llSay(0, "Your keyword is DIY");
        }
    }
            if(text == "SHTM"){
         llSay(0, "School of Hotel and Tourism Management:");
       
        if((integer)RandomNo == 0){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Hospitality", "'");
         llSay(0, "Your keyword is Hospitality");
        }

        if((integer)RandomNo == 1){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "F&B", "'");
         llSay(0, "Your keyword is F&B");
 
        }
         if((integer)RandomNo == 2){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Bistro", "'");
         llSay(0, "Your keyword is Bistro");
        }
     
         if((integer)RandomNo == 3){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Asia-Pacific", "'");
         llSay(0, "Your keyword is Asia-Pacific");
        }
     
          if((integer)RandomNo == 4){
         llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Eta Sigma Delta", "'");
         llSay(0, "Your keyword is Eta Sigma Delta");
        }
    }          
     
    }
}


//-------Show keywords related to the random number of rotation (from -15 to 15) on the announcement board -- (without Xyz text script)


integer listenHandle;


default
{
    state_entry()
    {
            listenHandle = llListen(-123, "", NULL_KEY, "");
    }

    listen(integer chan, string name, key id, string msg)
    {
        list parsed = llParseString2List(msg,[" "],[]);
        string text = llList2String(parsed,0);

        if(text == "ELC")
        {
            llSetPrimitiveParams([PRIM_TEXTURE,0, "81d319dc-08a1-70ff-7d08-d2d5e8521d90" ,<1>,<0>,0.0]);  // Link the prim with different texture
        }
      if(text == "Design")
        {
            llSetPrimitiveParams([PRIM_TEXTURE,0, "bb14e17f-48e2-b0de-2d3a-f3fc919d3455" ,<1>,<0>,0.0]);
        }
      if(text == "English")
        {
            llSetPrimitiveParams([PRIM_TEXTURE,0, "3dd9c930-88cb-80cd-04df-a146429166ba" ,<1>,<0>,0.0]);
        }
     if(text == "Computing")
        {
            llSetPrimitiveParams([PRIM_TEXTURE,0, "ab55d18b-f220-7dad-2036-9dbe6d9d24ae" ,<1>,<0>,0.0]);
        } 
     if(text == "ITC")
        {
            llSetPrimitiveParams([PRIM_TEXTURE,0, "7bfad861-8374-84fb-f71f-2a58fb6dd64a" ,<1>,<0>,0.0]);
        } 
    }
}