Jump to content

What is wrong here


Tabris Daxter
 Share

You are about to reply to a thread that has been inactive for 4776 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hey all,

I'm trying to make a "simple" holodeck

CODE FOLLOWS

 

list dialoglst = ["DEPLOY","REZ"];
string dialogmsg = "COMBINED DEPLOY";
list params = [];
list propdata = [];
key ToucherID;
//chat
integer gChanBroadcast;
integer gdialogBroadcast;
integer gListenChan;
integer listen_id;
integer listen_id2;
//Notecard Variables.
string gNotecard;
integer gLineNum = 0;
list gNotecardDataTEX;
list gNotecardDataPOS;
//dataserver stuff
key gQueryId; //Textures

default
{
    state_entry()
    {
        gdialogBroadcast = llListen(556677,"","","");
    }
    
    touch_start(integer bad_touch)
    {
        ToucherID = llDetectedKey(0);
        llDialog(ToucherID, dialogmsg,dialoglst, gdialogBroadcast);
        listen_id = llListen( gdialogBroadcast, "", ToucherID, "");
        llSetTimerEvent(30);
    }
    
    timer()
    { 
        //TIME'S UP!
        llListenRemove(listen_id);
        llSetTimerEvent(0.0);
    }
    
    listen(integer lchan, string lname, key lid, string lmsg)
    {
        if (lchan == gdialogBroadcast && lmsg == "DEPLOY")
        {
            llOwnerSay("PING");
            if (llGetSubString(llGetInventoryName(INVENTORY_NOTECARD,0),0,2) == "TEX")
           {
               gNotecard = llGetInventoryName(INVENTORY_NOTECARD,0);
               gQueryId = llGetNotecardLine(gNotecard, gLineNum);
            }
        }
        
    }
    
    /*link_message(integer Sender_Num, integer num, string Str, key id)
    {
        if (id == "tex" && Str == "change")
        {
            llOwnerSay("Redecorating");
            integer Pointer = 0;
            while(Pointer < llGetListLength(gNotecardDataTEX))
            {
                Pointer++;
                //llWhisper(666777888,llList2CSV());
                llOwnerSay(llList2CSV(gNotecardDataTEX));
            }
        }
        else if (id == "pos" && Str == "rez")
        {
            llOwnerSay("Rezzing");
            integer Pointer = 0;
            while(Pointer < llGetListLength(gNotecardDataPOS))
            {
            string Sname = llList2String(gNotecardDataPOS, Pointer++);
            rotation Rot = (rotation) llList2String(gNotecardDataPOS, Pointer++);
            vector Pos = (vector) llList2String(gNotecardDataPOS, Pointer++);
            //llOwnerSay(Sname + "\n" + (string) Pos + "\n" + (string) Rot);
            llRezObject(Sname, llGetPos() + Pos, ZERO_VECTOR, llGetRot() * Rot,             99);
            }
        }
    }*/
    
    dataserver(key lqueryid, string ldata)
    {
        if (gQueryId == lqueryid)
        {
            if (ldata != EOF)
                {
                    list tmp = llParseString2List(ldata, ["="], []);
                    string setting = llList2String(tmp,0);
                    list CSV = llCSV2List(llList2String(tmp,1));
                     if (setting == "TEX")
                        {
                            
                            //llMessageLinked(LINK_THIS, 254,"change","tex");
                            //llOwnerSay(llDeleteSubString(llList2CSV(tmp),0,3));
                            gNotecardDataTEX += llDeleteSubString(llList2CSV(CSV),0,3);
                            llWhisper(666777888,llList2CSV(gNotecardDataTEX));
                        }
                        else if (setting == "POS")
                        {
                            llOwnerSay("Finished Objects, Deploying");
                            //llMessageLinked(LINK_THIS, 254,"rez","pos");
                            //llOwnerSay(llDeleteSubString(llList2CSV(tmp),0,3));
                            gNotecardDataPOS += llList2CSV(CSV);
                            //llOwnerSay(llList2String(gNotecardDataPOS,0));
                            integer Pointer = 0;
                            while(Pointer < llGetListLength(gNotecardDataPOS))
                                {
                                    string Sname = llList2String(gNotecardDataPOS, Pointer++);
                                    rotation Rot = (rotation) llList2String(gNotecardDataPOS, Pointer++);
                                    vector Pos = (vector) llList2String(gNotecardDataPOS, Pointer++);
                                    //llOwnerSay(Sname + "\n" + (string) Pos + "\n" + (string) Rot);
                                   // llRezObject(Sname, llGetPos() + Pos, ZERO_VECTOR, llGetRot() * Rot,99);
                                   llOwnerSay(llDumpList2String(gNotecardDataPOS,"\n"));
                                }
                        }
                        
                    //gNotecardData += ldata;             
                    gQueryId = llGetNotecardLine(gNotecard, ++gLineNum);
                    llSetText((string)gLineNum,<0.0,0.0,0.0>,0);
                }
        }
    }
}

 

 

NOTECARD FOLLOWS

 

TEX=1,87dfd082-f83b-673b-e86b-5fa2d64bedf8,<1.000000, 1.000000, 0.000000>,<0.000000, 0.000000, 0.000000>,0.000000,<0.111596, 0.143980, 0.475304>,1.000000
TEX=2,1a846dac-dfa5-cfbc-5d53-0389575b2545,<1.000000, 1.000000, 0.000000>,<0.000000, 0.000000, 0.000000>,0.000000,<0.746924, 0.975448, 0.677933>,1.000000
TEX=3,948f4aa8-8d5e-71e0-03c2-b20b117bcdea,<1.000000, 1.000000, 0.000000>,<0.000000, 0.000000, 0.000000>,0.000000,<0.557596, 0.853893, 0.974349>,1.000000
TEX=4,4411f334-838e-8a2e-dffa-14571c89db7d,<1.000000, 1.000000, 0.000000>,<0.000000, 0.000000, 0.000000>,0.000000,<0.983629, 0.524983, 0.721262>,1.000000
TEX=5,b7990774-5ee5-f9fe-79f7-bc1dfe345b25,<1.000000, 1.000000, 0.000000>,<0.000000, 0.000000, 0.000000>,0.000000,<0.210421, 0.717405, 0.081727>,1.000000
TEX=6,6d7056ab-1d42-26e6-92d9-80d2c705c5ea,<1.000000, 1.000000, 0.000000>,<0.000000, 0.000000, 0.000000>,0.000000,<0.211569, 0.406867, 0.393395>,1.000000
POS=125.125,<0.000000, 0.000000, 0.000000, 0.000000>,<-3.000000, -3.000000, 0.274902>
POS=128.126,<0.000000, 0.382683, 0.000000, -0.076120>,<0.000000, -2.000000, 0.274902>
POS=130.128,<0.382683, 0.000000, 0.000000, -0.076120>,<2.000000, 0.000000, 1.000000>
POS=125.131,<0.000000, 0.000000, 0.000000, 0.000000>,<-3.000000, 3.000000, 2.000000>

 

 

now here is the problem i'm having,

in line 100 - 116 ( the dataserver event starting with else if (setting == "POS"))

it's meant to separate the list into the component parts and feed it into llRezObject() however it's not separating the values

 

any help/ feedback apprecieated.

 

(i know the formatting SUCKS cleaning it up when i get it to work)

Link to comment
Share on other sites

make sure there are no spaces or mispelling in your notcard data, by forcing it to lower case, and removing all spaces... that's not the problem here, but you reall should do those checks

second and this is where your problem is here, csv (comma seperated value) to list is breaking up your position vectors and rotations, because.....

(wait for it....)
they have commas in them!

instead you want to use something like
notCSV = llParseString2List( llList2String( tmp, 1 ), ["<"], [] );
and then pull your values out with
(rotation)("<" + llList2String( notCSV, 0 ))
(vector)("<" + llList2String( notCSV, 1 ))
and while you're at it save yourself a headache and record them in the notecard in the order they'll be used in the script... position, then rotation

ETA:
original unspaced post was made from withing SL testing new ideas, sorry about that

Link to comment
Share on other sites

Void, from the wiki

 


 

Vectors & Rotations

Anything between "<" and ">" is considered a single value regardless of the existence of a comma between.

This ensures that vectors and rotations get treated as a single value, with no additional cleanup needed afterward.

Note, though, that for every "<" there needs to be a corresponding ">" or it will consume the rest of the string. For example,

•  llCSV2List("<>,>,a") returns ["<>", ">", "a"] (Second ">" is isolated)
•  llCSV2List("<<>,>,a") returns ["<<>,>", "a"] (Regularly paired)
•  llCSV2List("<<<>,>,a") returns ["<<<>,>,a"] (Third "<" lost its opposite one)

 


 

thats why i use llCSV2List() and it's opposite llList2CSV().

 

i finally figured it out.

it was here gNotecardDataPOS = CSV; (this is the fixed version) i was i think converting the list to a string and back too many times and buggered it up somewhere, i was also trimming out substring too many tims and it was messing with the names and values.

i've fixed the rezzing bit, now onto the textures /facepalm

Link to comment
Share on other sites

ok. 90% of the code works now.

i'm still having problems with rezzing.

below is the relevent sections of code instead of posting the whole thing again as not much has changed.

the Data server event

 

 dataserver(key lqueryid, string ldata)
{
if (gQueryId == lqueryid)
{
if (ldata != EOF)
{
list tmp = llParseString2List(ldata, ["="], []);
string setting = llList2String(tmp,0);
if (setting == "TEX")
{
llWhisper(666777888,ldata);
}
//here to
else if (setting == "POS")
{
//gNotecardDataPOS = llDeleteSubString(ldata,0,3);
gNotecardDataPOS = llList2String(tmp,1);
llMessageLinked(LINK_SET,255,"Ready","POS");
}
//here is the relevent code for the position data
gQueryId = llGetNotecardLine(gNotecard, ++gLineNum);


}
}
}

 

 

instead of doing ALL the processing here i'm just extracting the data.

below is where i'm processing it.

 

 

link_message(integer Sender_Num, integer num, string Str, key id)    {        if (id =="POS" && Str == "Ready")        {            //llOwnerSay("Starting Rez");            integer Pointer = 0;            list POSLISTTemp = llCSV2List(gNotecardDataPOS);            //llOwnerSay(gNotecardDataPOS);            while(Pointer < llGetListLength(POSLISTTemp))                {                    string Sname = llList2String(POSLISTTemp, Pointer++);                    vector Pos = (vector) llList2String(POSLISTTemp, Pointer++);                     rotation Rot = (rotation) llList2String(POSLISTTemp, Pointer++);                                llRezObject(Sname, llGetPos() + Pos, ZERO_VECTOR, llGetRot() * Rot,99);                                    }            llSetText("DONE",<0.0,1.0,1.0>,1);        }}

 

 

here is the notecard data.

POS=foo,<-0.817398, -2.522522, 1.779785>,<-0.999962, 0.000000, 0.000000, -0.991272>,
POS=foo,<0.256226, -2.533379, -0.725098>,<0.000000, 0.000000, 0.000000, 0.000000>,
POS=foo,<-1.941086, -2.544228, 3.023682>,<-0.999962, 0.000000, 0.000000, -0.991272>,
POS=foo,<0.256226, -2.544228, 3.023682>,<-0.999962, 0.000000, 0.000000, -0.991272>,
POS=foo,<-0.817398, -2.533379, 0.518799>,<0.000000, 0.000000, 0.000000, 0.000000>,
POS=foo,<-1.941086, -2.533379, -0.725098>,<0.000000, 0.000000, 0.000000, 0.000000>

and finally the error message.

Master Builder: Could not find object ''.

 

i think i have narrowed the problem down to somewhere in the loop for rezzing as when i had it [llOwnerSay((string)llGetListLength(POSLISTTemp));] for the first 5 runs it would show 4 list items and on the 6th it would show 3 (the right number).

i think it is picking up the ENTER after the end of each line as a record BUT when i take it out and make it one continous line it will not read right.

POST is long enough

Link to comment
Share on other sites

I don't know if this will fix the problem, but to stop the carriage return being an issue, check that the line actually contains some data.   I would do it like this,

 

       if (ldata != EOF)                {		if(llStringTrim(ldata,STRING_TRIM)!=""){  // then go ahead and process it                    list tmp = llParseString2List(ldata, ["="], []);                    string setting = llList2String(tmp,0);		.....			}		}

 

 

and then either process it or, if it's a blank line, ask for the next line of data.  

I don't know, off the top of my head, how best to handle it the way you're doing it, though.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4776 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...