Created
June 19, 2014 01:44
-
-
Save nebadon2025/54bce9ce76821b26387c 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); | |
} | |
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(data, lineNo); | |
lineNo++; | |
queryID = llGetNotecardLine("Note", lineNo); | |
} | |
} else { | |
if (lineNo == 25) { | |
llOwnerSay("Notecard too long for display, truncating."); | |
} | |
flipImage(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment