Computer:jaycoonlanguage

From Second Life Wiki
Revision as of 09:25, 11 June 2007 by Jayco121 Bing (talk | contribs)
Jump to navigation Jump to search

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)

integer open  = FALSE; //initialised: Starts un initialised
string notecard;
key datanotecardlin;
key datanotecardtext;
integer lines;
string process;
string line;
string notcard;
list ints;
list strings;
default
{
    state_entry()
    {
        llListen(0,"","","");
        llListen(4,"","","");        
    }
    listen(integer chan, string name, key id, string message)
    {
        if(message == "os:load progs") //Init start here
        {
            llSay(4,"prog:jaycoonlanguage");
        }
        if(message == "bios:startjaycoonlanguage")
        {
            open = TRUE;
        }
        if(message == "close" && open)
        {
            open = FALSE;
        } //init done
        if(~llSubStringIndex(message, "notecard:") && open == TRUE)
        {
            notecard = llDeleteSubString(message,0,9); //set notecard
             
        }
        if(message == "compile" && notecard != "" && open)
        {
            //start compiling
           datanotecardlin = llGetNumberOfNotecardLines(notecard);
            process = "lines";
            integer contvar = 0;
            while (contvar <= lines)
            {
              datanotecardtext = llGetNotecardLine(notecard,contvar);
               if(~llSubStringIndex(line,"print:"))
                {
                     line = llDeleteSubString(line,0,6);        
                    if(~llListFindList(ints,[line]))
                    {
                        llSay(0,llList2String( ints,llListFindList(ints,[line])));
                    }
                    if(~llListFindList(strings,[line]))
                    {
                        llSay(0,llList2String( ints,llListFindList(strings,[line])));
                    }
                    llSay(0,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 data, string function)
    {
        if(data == datanotecardlin)
        {
            lines = (integer)function;
        }    
        if(data == datanotecardtext)
        {
            line = function;
            
            
        }
        
    }
}