-
-
Save nebadon2025/6dc58ac63479a5a05057 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string CommandList = ""; | |
key queryID; | |
integer lineNo; | |
string FontName = "Verdana, Geneva, sans-serif"; // Arial is the default font used, if unspecified | |
integer FontSize = 24; // default to 24 point for sample | |
clear() { | |
CommandList = ""; | |
} | |
drawText(string text, integer line) { | |
CommandList = osSetFontName(CommandList, FontName); | |
CommandList = osSetFontSize(CommandList, FontSize); | |
CommandList = osMovePen(CommandList, 10, 10 + (30 * line)); | |
CommandList = osDrawText(CommandList, text); | |
} | |
flipImage() { | |
osSetDynamicTextureData( "", "vector", CommandList, "width:1024,height:1024", 0); | |
} | |
string str_replace(string str, string search, string replace) { | |
return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace); | |
} | |
string WrapText(string pcText, integer piWidth) { | |
list laLines = []; | |
integer liIndex; | |
integer liKeep; // Specifies if we keep the char pointed at or not | |
integer liLen = llStringLength(pcText); | |
list llSearch = [" ", "\n"]; | |
while (liLen > 0) { | |
liIndex = piWidth; | |
if (!(liKeep = (liLen <= piWidth))) { | |
while ((liIndex >= 0) && (-1 == llListFindList(llSearch, (list)llGetSubString(pcText, liIndex, liIndex)))) | |
--liIndex; | |
if (liIndex <= 0) { | |
liIndex = piWidth; | |
liKeep = 1; | |
} | |
} | |
laLines += llGetSubString(pcText, 0, liIndex - 1); | |
pcText = llDeleteSubString(pcText, 0, liIndex - liKeep); | |
liLen -= (1 + liIndex - liKeep); | |
} | |
return llDumpList2String(laLines,"\n"); | |
} | |
default | |
{ | |
state_entry() | |
{ | |
} | |
touch_start(integer num) { | |
if (llDetectedKey(0) == llGetOwner()) { | |
if (llGetInventoryType("Note") == INVENTORY_NOTECARD) { | |
lineNo = 0; | |
clear(); | |
queryID = llGetNotecardLine("Note", lineNo); | |
} else { | |
llOwnerSay("No notecard named \"Note\" found."); | |
} | |
} | |
} | |
changed(integer change) { | |
if (change & CHANGED_INVENTORY) { | |
if (llDetectedKey(0) == llGetOwner()) { | |
if (llGetInventoryType("Note") == INVENTORY_NOTECARD) { | |
lineNo = 0; | |
clear(); | |
queryID = llGetNotecardLine("Note", lineNo); | |
} else { | |
llOwnerSay("No notecard named \"Note\" found."); | |
} | |
} | |
} | |
} | |
dataserver(key query_id, string data) { | |
string lineData; | |
if (query_id == queryID) { | |
if (data != EOF) { | |
if (lineNo < 25) { | |
lineData = str_replace(data, ";", ":"); | |
drawText(WrapText(data,52) + "\n", lineNo); | |
lineNo++; | |
queryID = llGetNotecardLine("Note", lineNo); | |
} | |
} else { | |
if (lineNo == 25) { | |
llOwnerSay("Notecard too long for display, truncating."); | |
} | |
flipImage(); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To use this board edit it and go to the contents tab | |
edit the file named "Note" and save it | |
Then click the panel board to display updated text! | |
*There is no word wrap & 52 characters per line! | |
Take a copy and rez it to the ground to start using! | |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 | |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment