diff --git a/README.md b/README.md index cb87a35..9e76c21 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,10 @@ Notecard-based (LSL) script for randomly grabbing urls and displaying media obje - [Example Notecard](#example-notecard) - [Usage](#usage) - [Change-log](#change-log) + - [Minor Patch 4](#minor-patch-4) - [Minor Patch 3](#minor-patch-3) - [Minor Patch 2](#minor-patch-2) - - [Minor Patch](#minor-patch) + - [Minor Patch 1](#minor-patch) ### Example @@ -49,6 +50,19 @@ https://i.imgur.com/dc9RNYg.mp4 ## Change-log +### Minor Patch 4 +*RELEASED* - **11/13/23** +__Version__: *0.1.1b* +- - - - - - - - - - +- Script Optimization + - Lines Truncated to reduce script size + - Similar Functions/Code Concatenated +- Script Commenting + - General Fixes/Proofreading/updates +- Setup Functionality Fixes + - Added Fullbright to on for MediaFace variable +- README Cleanup/Additions +- - - - - - - - - - ### Minor Patch 3 *RELEASED* - **10/14/23** __Version__: *0.1.1a* diff --git a/main.lsl b/main.lsl index e6fd1a5..8a38dbb 100644 --- a/main.lsl +++ b/main.lsl @@ -8,30 +8,26 @@ //ONLY PLACE ONE IMAGE/MP4 LINK PER LINE IN THE NOTECARD key linecountid; -key lineid; -key MyKey; +key lineid; key MyKey; -string hailsVersion = "0.1.1a"; //Version Number -string rcInfo; +string hailsVersion = "0.1.1b"; //Version Number +string rcInfo = "Release_Candidate 1"; string card = "hails.urls"; //Notecard name string objectName = "hails.media2Prim"; //Primitive name -string objDesc; -string hailsObjName; -string hailsURL; -string hailsHome; +string objDesc; string hailsObjName; string hailsURL; string hailsHome; string forceHomeURL = "https://hails.cc/"; string hailsTexture = "9d0c0e2d-852e-b2d0-9e5e-a64b2f78bc3a"; -integer debug = FALSE; //DEBUG toggle, TRUE = ON | FALSE = OFF -integer debugIM = FALSE; //Instant Messaging DEBUG toggle, TRUE = ON | FALSE = OFF -integer rc = FALSE; //Dev Variable -integer linemax; +integer debug = TRUE; //DEBUG toggle, TRUE = ON | FALSE = OFF +integer debugIM = TRUE; //Instant Messaging DEBUG toggle, TRUE = ON | FALSE = OFF +integer rc = TRUE; //Dev Variable integer doPhantom = TRUE; //Primitive Phantom Status, TRUE = ON | FALSE = OFF integer doGrab = TRUE; //Primitive Grab/Drag Functionality, TRUE = ON | FALSE = OFF integer doSetup = TRUE; //Whether to perform setup functionality integer hailsStartSetup = FALSE; // LEAVE ALONE | Default State integer mediaFace = 0; // TOP = 0 | +X = 1 | +Y = 2 | -X = 3 | +X = 4 | BOTTOM = 5 integer oppositeFace = 5; // Set to the opposite side of mediaFace variable! +integer linemax; float hailsTimer = 2.25; // Short pause timer float hailsTimer2 = 10.75; @@ -57,8 +53,7 @@ vector gray = <0.667,0.667,0.667>; integer random_integer(integer min, integer max) { return min + (integer)(llFrand( max - min + 1 )); } //Random number generation -checkDebug() -{ +checkDebug() { objDesc = llGetObjectDesc(); if (objDesc == "v" + hailsVersion + " - DEBUG") { llOwnerSay(hailsObjName + " DEBUG enabled.. SKIP"); } else if (objDesc == "debug") { debug = TRUE; debugIM = TRUE; llOwnerSay(hailsObjName + " DEBUG mode Enabled.."); llInstantMessage(MyKey, "IM DEBUG mode Enabled.."); llSetObjectDesc("v" + hailsVersion + " - DEBUG"); llSetObjectName(objectName + " - DEBUG"); } @@ -66,100 +61,67 @@ checkDebug() else if (objDesc == "nosettext") { rc = FALSE; llSetText("", ZERO_VECTOR, 0.0); llSetObjectDesc("v" + hailsVersion); } else if (objDesc == "resetme") { llSetObjectDesc("v" + hailsVersion); llClearPrimMedia(mediaFace); hailsSetup(); llResetScript(); } else if (objDesc == "dosetup") { llSetObjectDesc("v" + hailsVersion); doSetup = TRUE; hailsStartSetup = TRUE; hailsSetup(); } - else { llSetObjectDesc("v" + hailsVersion); llSetObjectName(objectName); } -} + else { llSetObjectDesc("v" + hailsVersion); llSetObjectName(objectName); } } -hailsSetup() //Setup Primitive Function -{ - MyKey = llGetOwner(); - llClearPrimMedia(mediaFace); +hailsSetup() { + MyKey = llGetOwner(); llClearPrimMedia(mediaFace); if (rc) { llSetText("v" + hailsVersion + " - " + rcInfo, fuchsia, 0.71); llSetObjectDesc("v" + hailsVersion + " - " + rcInfo); } else { llSetText("", ZERO_VECTOR, 0.0); } - if (hailsStartSetup & doSetup) { if (debug) { llOwnerSay(hailsObjName + " StartSetup already TRUE. . .SKIP."); } else { if (llGetAlpha(oppositeFace)) { hailsStartSetup = TRUE; } else { hailsStartSetup = FALSE; } } } - if (hailsStartSetup & doSetup) //main function logic - { + if (llGetAlpha(oppositeFace)) { hailsStartSetup = TRUE; if (debug) { llOwnerSay(hailsObjName + " STARTSETUP set to TRUE"); } } else { hailsStartSetup = FALSE; if (debug) { llOwnerSay(hailsObjName + " STARTSETUP set to FALSE"); } } + if (hailsStartSetup & doSetup) { if (debug) { llOwnerSay(hailsObjName + " Begin Setup/Optimization function..."); } //debug - llSetTexture(TEXTURE_BLANK, ALL_SIDES); llSetTexture(hailsTexture, mediaFace); llSetColor(black, ALL_SIDES); llSetColor(white, mediaFace); llSetAlpha(1.0, ALL_SIDES); llSetAlpha(0.0, oppositeFace); llSetStatus(STATUS_BLOCK_GRAB_OBJECT, doGrab); llSetStatus(STATUS_PHANTOM, doPhantom); hailsStartSetup = FALSE; + llSetTexture(TEXTURE_BLANK, ALL_SIDES); llSetTexture(hailsTexture, mediaFace); llSetColor(black, ALL_SIDES); llSetColor(white, mediaFace); llSetAlpha(1.0, ALL_SIDES); llSetAlpha(0.0, oppositeFace); llSetStatus(STATUS_BLOCK_GRAB_OBJECT, doGrab); llSetStatus(STATUS_PHANTOM, doPhantom); llSetPrimitiveParams([PRIM_FULLBRIGHT, mediaFace, TRUE]); hailsStartSetup = FALSE; if (debug) { llOwnerSay(hailsObjName + " Setup is Complete."); } - llSleep(0.27); //Take a nap ..zzZzz.. - } + llSleep(0.27); } else { - if (debug) { llOwnerSay(hailsObjName + " SKIP Setup Function. . ."); } - } -} + if (debug) { llOwnerSay(hailsObjName + " SKIP Setup Function. . ."); } } } -media2Prim() -{ +media2Prim() { llSetPrimMediaParams(mediaFace,[PRIM_MEDIA_AUTO_PLAY,TRUE, PRIM_MEDIA_HOME_URL,hailsHome, PRIM_MEDIA_CURRENT_URL,hailsURL, PRIM_MEDIA_HEIGHT_PIXELS,1024, PRIM_MEDIA_WIDTH_PIXELS,800, PRIM_MEDIA_PERMS_INTERACT,0x0, PRIM_MEDIA_CONTROLS,1, PRIM_MEDIA_AUTO_SCALE,1, PRIM_MEDIA_AUTO_LOOP,1]); - if (debug) { llOwnerSay(hailsObjName + " has updated URL: (" + hailsURL + ") "); } -} + if (debug) { llOwnerSay(hailsObjName + " has updated URL: (" + hailsURL + ") "); } } -checkSimPop() -{ - integer numOfAvatars = llGetRegionAgentCount(); - integer counter; +checkSimPop() { + integer numOfAvatars = llGetRegionAgentCount(); integer counter; if (debug) { llOwnerSay(hailsObjName + " is checking Sim Population.."); } - while (numOfAvatars < 1) - { + while (numOfAvatars < 1) { if (counter < 1) { llSetTimerEvent(0.0); llClearPrimMedia(mediaFace); if (debugIM) { llInstantMessage(MyKey, "Sim is empty, hibernating.."); } } - llSleep(15); + llSleep(2.5); //Short Snooze ..zzzzzZzzzzz.. if (counter > 1000) { counter = 1; } else { ++counter; } numOfAvatars = llGetRegionAgentCount(); - if (debug) { llOwnerSay(hailsObjName + " is re-checking Sim Population.."); } - } + if (debug) { llOwnerSay(hailsObjName + " is re-checking Sim Population.."); } } if (debug) { llOwnerSay(hailsObjName + " Sim Pop check PASSED."); } - counter = 0; - } + counter = 0; } default { - on_rez(integer start_param) - { - checkDebug(); llClearPrimMedia(mediaFace); - llSleep(0.75); llResetScript(); - } - changed(integer change) - { - if (change & (CHANGED_OWNER | CHANGED_INVENTORY | CHANGED_REGION)) - { + on_rez(integer start_param) { + llClearPrimMedia(mediaFace); + llSleep(0.75); llResetScript(); } + changed(integer change) { + if (change & (CHANGED_OWNER | CHANGED_INVENTORY | CHANGED_REGION)) { if (debug) { llOwnerSay(hailsObjName + " has detected a change, Rebooting. . ."); } - checkDebug(); llClearPrimMedia(mediaFace); llSleep(hailsTimer); llResetScript(); - } - } + checkDebug(); llClearPrimMedia(mediaFace); llSleep(hailsTimer); llResetScript(); } } state_entry() { if (debug & debugIM) { llSetObjectDesc("debug"); } - hailsObjName = objectName + ":"; - hailsSetup(); + hailsObjName = objectName + ":"; hailsSetup(); linecountid = llGetNumberOfNotecardLines(card); //get the number of notecard lines if (debug) { llOwnerSay(hailsObjName + " is Performing Start up.."); } lineid = llGetNotecardLine(card, random_integer(0, linemax)); hailsRandTimer = random_integer(59, 199); if (debug) { llOwnerSay(hailsObjName + " TimerEvent set for " + (string)hailsRandTimer); } //Debug - llSetTimerEvent(hailsRandTimer); - } - touch_start(integer total_number) - { + llSetTimerEvent(hailsRandTimer); } + touch_start(integer total_number) { checkDebug(); llSetTexture(hailsTexture, mediaFace); llClearPrimMedia(mediaFace); if (debug) { llOwnerSay(hailsObjName + " Touch Function has been Activated"); } hailsRandTimer = random_integer(59, 199); llSetTimerEvent(0.0); lineid = llGetNotecardLine(card, random_integer(0, linemax)); - llSleep(0.25); //Take another nap ..zzZzz.. - } - timer() - { + llSleep(0.25); } + timer() { checkDebug(); checkSimPop(); - lineid = llGetNotecardLine(card, random_integer(0, linemax)); - } - dataserver(key id, string data) - { - if (id == linecountid) - { - linemax = (integer)data - 1; - } - else if (id == lineid) - { + lineid = llGetNotecardLine(card, random_integer(0, linemax)); } + dataserver(key id, string data) { + if (id == linecountid) { + linemax = (integer)data - 1; } + else if (id == lineid) { hailsURL = data; hailsHome = data; media2Prim(); hailsRandTimer = random_integer(59, 199); llSetTimerEvent(hailsRandTimer); if (debug) { llOwnerSay(hailsObjName + " TimerEvent set for " + (string)hailsRandTimer); llOwnerSay(hailsObjName + " is Sleeping for " + (string)hailsTimer); } //Debug - llSleep(hailsTimer); - } - } -} + llSleep(hailsTimer); } } }