Czervik LSL Computer: Difference between revisions
Jump to navigation
Jump to search
New page: The below code is some code being written by ~~~. It isn't even partly done, and I were a programmer It'd be version 0.00.0.000.0.01, although I don't do that... So, if you're interested o... |
No edit summary |
||
| Line 51: | Line 51: | ||
if (llList2String(ld, 1) != llList2String(ld, 3) | if (llList2String(ld, 1) != llList2String(ld, 3) | ||
pass = 1; | pass = 1; | ||
} else { | |||
fail("Can not compare two strings using the " + llList2String(ld, 2) + " opperator."); | |||
} | |||
} else { | |||
if (llList2String(ld, 2) == "==") { | |||
if (llList2String(ld, 1) == llList2String(ld, 3) | |||
pass = 1; | |||
} else if (llList2String(ld, 2) == "!=") { | |||
if (llList2String(ld, 1) != llList2String(ld, 3) | |||
pass = 1; | |||
} else if (llList2String(ld, 2) == "<") { | |||
if ((integer)llList2String(ld, 1) < (integer)llList2String(ld, 3) | |||
pass = 1; | |||
} else if (llList2String(ld, 2) == ">") { | |||
if ((integer)llList2String(ld, 1) > (integer)llList2String(ld, 3) | |||
pass = 1; | |||
} else if (llList2String(ld, 2) == "<=") { | |||
if ((integer)llList2String(ld, 1) <= (integer)llList2String(ld, 3) | |||
pass = 1; | |||
} else if (llList2String(ld, 2) == ">=") { | |||
if ((integer)llList2String(ld, 1) >= (integer)llList2String(ld, 3) | |||
pass = 1; | |||
} else { | |||
fail("Can not compare two ints using the " + llList2String(ld, 2) + " opperator."); | |||
} | |||
} | |||
if (llList2String(ld, 4) == ":") { | |||
if (!pass) { | |||
//TODO: Skip to the end of the :, not just then next line. | |||
iLine++; | |||
} | |||
} else { | |||
if (!pass) { | |||
iLine++; | |||
} | |||
} | |||
} else if (llList2String(ld, 0) == "say") { | |||
if (llGetSubString(llList2String(ld, 1), 0, 0) == "\"") { | |||
llSay(0, llGetSubString(llList2String(ld, 1), 1, -2)); | |||
} else { | |||
string type = getType(llList2String(ld, 3)); | |||
if (type == "str") { | |||
int pos = llListFindList(stringsName, [llList2String(ld, 1)]); | |||
if (pos != -1) | |||
llSay(0, llList2String(strings, pos)); | |||
} else { | } else { | ||
int pos = llListFindList(intsName, [llList2String(ld, 1)]); | |||
if (pos != -1) | |||
llSay(0, (string)llList2Integer(ints, pos)); | |||
} | } | ||
} | } | ||
} | |||
++iLine; | ++iLine; | ||
| Line 64: | Line 112: | ||
} | } | ||
} | } | ||
</pre> | </pre> | ||
Revision as of 11:34, 14 September 2007
The below code is some code being written by Xaviar Czervik. It isn't even partly done, and I were a programmer It'd be version 0.00.0.000.0.01, although I don't do that... So, if you're interested on crashing the LSL compiler (This code doesn't compile 99% of the time) check out the code below. And incase you couldn't tell, I don't believe in comments.
key kQuery;
integer iLine = 0;
list stringsName;
list strings;
list intsName;
list ints;
string getType(string s) {
if ((string)((integer)s) == s)
return "int";
return "str";
}
fail(string error) {
llOwnerSay("Run-time Error: " + error);
llResetScript();
}
default {
touch_start(integer i) {
llSay(0, "Starting Program...");
kQuery = llGetNotecardLine("Program", iLine);
}
dataserver(key query_id, string data) {
if (query_id == kQuery) {
if (data == EOF) {
llSay(0, "Ending Program.");
} else {
list ld = llParseString2List(data, [" "], []);
if (llList2String(ld, 0) == "str") {
stringsName += llList2String(ld, 1);
strings += llList2String(ld, 2);
} else if (llList2String(ld, 0) == "int") {
intsName += (integer)llList2String(ld, 1);
ints += (integer)llList2String(ld, 2);
} else if (llList2String(ld, 0) == "?") {
string typeFirst = getType(llList2String(ld, 1));
string typeSecond = getType(llList2String(ld, 3));
integer pass = 0;
if (typeFirst == "str" || typeSecond == "str")
if (llList2String(ld, 2) == "==") {
if (llList2String(ld, 1) == llList2String(ld, 3)
pass = 1;
} else if (llList2String(ld, 2) == "!=") {
if (llList2String(ld, 1) != llList2String(ld, 3)
pass = 1;
} else {
fail("Can not compare two strings using the " + llList2String(ld, 2) + " opperator.");
}
} else {
if (llList2String(ld, 2) == "==") {
if (llList2String(ld, 1) == llList2String(ld, 3)
pass = 1;
} else if (llList2String(ld, 2) == "!=") {
if (llList2String(ld, 1) != llList2String(ld, 3)
pass = 1;
} else if (llList2String(ld, 2) == "<") {
if ((integer)llList2String(ld, 1) < (integer)llList2String(ld, 3)
pass = 1;
} else if (llList2String(ld, 2) == ">") {
if ((integer)llList2String(ld, 1) > (integer)llList2String(ld, 3)
pass = 1;
} else if (llList2String(ld, 2) == "<=") {
if ((integer)llList2String(ld, 1) <= (integer)llList2String(ld, 3)
pass = 1;
} else if (llList2String(ld, 2) == ">=") {
if ((integer)llList2String(ld, 1) >= (integer)llList2String(ld, 3)
pass = 1;
} else {
fail("Can not compare two ints using the " + llList2String(ld, 2) + " opperator.");
}
}
if (llList2String(ld, 4) == ":") {
if (!pass) {
//TODO: Skip to the end of the :, not just then next line.
iLine++;
}
} else {
if (!pass) {
iLine++;
}
}
} else if (llList2String(ld, 0) == "say") {
if (llGetSubString(llList2String(ld, 1), 0, 0) == "\"") {
llSay(0, llGetSubString(llList2String(ld, 1), 1, -2));
} else {
string type = getType(llList2String(ld, 3));
if (type == "str") {
int pos = llListFindList(stringsName, [llList2String(ld, 1)]);
if (pos != -1)
llSay(0, llList2String(strings, pos));
} else {
int pos = llListFindList(intsName, [llList2String(ld, 1)]);
if (pos != -1)
llSay(0, (string)llList2Integer(ints, pos));
}
}
}
++iLine;
kQuery = llGetNotecardLine("My Notecard", iLine);
}
}
}
}