Difference between revisions of "Computer:jaycoonlanguage"
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) m (a few readability improvements) |
m (<lsl> tag to <source>) |
||
Line 1: | Line 1: | ||
{{LSL Header}} | {{LSL Header}} | ||
This is a language that is written in LSL. It reads a notecard specified by the user (meant for use with my computer that you can buy here: http://slurl.com/secondlife/Coda/249/46/73) | This is a language that is written in LSL. It reads a notecard specified by the user (meant for use with my computer that you can buy here: http://slurl.com/secondlife/Coda/249/46/73) | ||
< | <source lang="lsl2"> | ||
// initialised: Starts un initialised | // initialised: Starts un initialised | ||
integer open = FALSE; | integer open = FALSE; | ||
Line 92: | Line 92: | ||
} | } | ||
} | } | ||
</ | </source> | ||
{{LSLC|Library}} | {{LSLC|Library}} |
Latest revision as of 18:40, 24 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
This is a language that is written in LSL. It reads a notecard specified by the user (meant for use with my computer that you can buy here: http://slurl.com/secondlife/Coda/249/46/73)
// initialised: Starts un initialised
integer open = FALSE;
string notecard;
key notecardLineQueryID;
key notecardTextQueryID;
integer lines;
string process;
string line;
string notcard;
list ints;
list strings;
default
{
state_entry()
{
// PUBLIC_CHANNEL has the integer value 0
llListen(PUBLIC_CHANNEL, "", NULL_KEY, "");
llListen(4, "", NULL_KEY, "");
}
listen(integer channel, string name, key id, string message)
{
// init start
if(message == "os:load progs")
llSay(4, "prog:jaycoonlanguage");
else if(message == "bios:startjaycoonlanguage")
open = TRUE;
else if(message == "close" && open)
open = FALSE;
// init done
// set notecard
if(~llSubStringIndex(message, "notecard:") && open)
notecard = llDeleteSubString(message, 0, 9);
if(message == "compile" && notecard != "" && open)
{
// start compiling
notecardLineQueryID = llGetNumberOfnotecardLineQueryIDs(notecard);
process = "lines";
integer contvar = 0;
while (contvar <= lines)
{
notecardTextQueryID = llGetnotecardLineQueryID(notecard,contvar);
if(~llSubStringIndex(line, "print:"))
{
line = llDeleteSubString(line,0,6);
if(~llListFindList(ints, [line]))
llSay(PUBLIC_CHANNEL,
llList2String(ints,llListFindList(ints, [line])));
if(~llListFindList(strings, [line]))
llSay(PUBLIC_CHANNEL,
llList2String(ints,llListFindList(strings, [line])));
llSay(PUBLIC_CHANNEL, line);
}
if(~llSubStringIndex(line, "int:"))
{
line = llDeleteSubString(line, 0, 4);
ints += (integer)line;
}
if(~llSubStringIndex(line, "string:"))
{
line = llDeleteSubString(line, 0, 4);
strings += (string)line;
}
++contvar;
}
}
}
dataserver(key query_id, string data)
{
if(query_id == notecardLineQueryID)
lines = (integer)data;
if(query_id == notecardTextQueryID)
line = data;
}
}