Difference between revisions of "Computer:jaycoonlanguage"
Jump to navigation
Jump to search
(New page: ((LSL Header)) This is a language the is writing in lsl it reads a notecard that the user specifies(meant for use with my computer buy that here:http://slurl.com/secondlife/Coda/249/46/73)...) |
m (<lsl> tag to <source>) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{LSL Header}} | |||
This is a language | 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 | |||
integer open = FALSE; | |||
string notecard; | string notecard; | ||
key | |||
key | key notecardLineQueryID; | ||
key notecardTextQueryID; | |||
integer lines; | integer lines; | ||
string process; | string process; | ||
Line 12: | Line 16: | ||
list ints; | list ints; | ||
list strings; | list strings; | ||
default | default | ||
{ | { | ||
state_entry() | state_entry() | ||
{ | { | ||
llListen( | // PUBLIC_CHANNEL has the integer value 0 | ||
llListen(4,"", | llListen(PUBLIC_CHANNEL, "", NULL_KEY, ""); | ||
llListen(4, "", NULL_KEY, ""); | |||
} | } | ||
listen(integer | |||
listen(integer channel, string name, key id, string message) | |||
{ | { | ||
if(message == "os:load progs") | // init start | ||
if(message == "os:load progs") | |||
llSay(4,"prog:jaycoonlanguage"); | llSay(4, "prog:jaycoonlanguage"); | ||
if(message == "bios:startjaycoonlanguage") | else if(message == "bios:startjaycoonlanguage") | ||
open = TRUE; | open = TRUE; | ||
if(message == "close" && open) | else if(message == "close" && open) | ||
open = FALSE; | open = FALSE; | ||
// init done | |||
if(~llSubStringIndex(message, "notecard:") && open | |||
// set notecard | |||
notecard = llDeleteSubString(message,0,9); | if(~llSubStringIndex(message, "notecard:") && open) | ||
notecard = llDeleteSubString(message, 0, 9); | |||
if(message == "compile" && notecard != "" && open) | if(message == "compile" && notecard != "" && open) | ||
{ | { | ||
// start compiling | |||
notecardLineQueryID = llGetNumberOfnotecardLineQueryIDs(notecard); | |||
process = "lines"; | process = "lines"; | ||
integer contvar = 0; | integer contvar = 0; | ||
while (contvar <= lines) | while (contvar <= lines) | ||
{ | { | ||
notecardTextQueryID = llGetnotecardLineQueryID(notecard,contvar); | |||
if(~llSubStringIndex(line, "print:")) | |||
{ | { | ||
line = llDeleteSubString(line,0,6); | |||
if(~llListFindList(ints,[line])) | |||
if(~llListFindList(ints, [line])) | |||
llSay( | llSay(PUBLIC_CHANNEL, | ||
llList2String(ints,llListFindList(ints, [line]))); | |||
if(~llListFindList(strings,[line])) | |||
if(~llListFindList(strings, [line])) | |||
llSay( | llSay(PUBLIC_CHANNEL, | ||
llList2String(ints,llListFindList(strings, [line]))); | |||
llSay( | |||
llSay(PUBLIC_CHANNEL, line); | |||
} | } | ||
if(~llSubStringIndex(line,"int:")) | if(~llSubStringIndex(line, "int:")) | ||
{ | { | ||
line = llDeleteSubString(line,0,4); | line = llDeleteSubString(line, 0, 4); | ||
ints += (integer)line; | ints += (integer)line; | ||
} | } | ||
if(~llSubStringIndex(line,"string:")) | if(~llSubStringIndex(line, "string:")) | ||
{ | { | ||
line = llDeleteSubString(line,0,4); | line = llDeleteSubString(line, 0, 4); | ||
strings += (string)line; | strings += (string)line; | ||
} | } | ||
++contvar; | |||
} | } | ||
} | } | ||
} | } | ||
dataserver(key | |||
dataserver(key query_id, string data) | |||
{ | { | ||
if( | if(query_id == notecardLineQueryID) | ||
lines = (integer)data; | |||
lines = (integer) | |||
if(query_id == notecardTextQueryID) | |||
if( | line = data; | ||
line = | |||
} | } | ||
} | } | ||
</ | </source> | ||
{{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;
}
}