Jump to content

childhoodbestfriend489

Resident
  • Posts

    63
  • Joined

  • Last visited

Everything posted by childhoodbestfriend489

  1. Debug: llGetPrimitiveParams error: Param 0 error, unknown parameter // :CATEGORY:Building // :NAME:Clone_Prim // :AUTHOR:Clarknova Helvetic // :CREATED:2010-01-10 05:20:56.000 // :EDITED:2013-09-18 15:38:50 // :ID:183 // :NUM:254 // :REV:1.0 // :WORLD:Second Life // :DESCRIPTION: // Clone_Prim // :CODE: /////////////////////////////////////////////////////////////////// // // CLONE PRIMITIVE v 2.31 // // // This script chats out lines of text that can be pasted back // into a blank script to clone the original prim. // // It also produces codeblocks optimized for automated transforms. // // //////////////////////////////////////////////////////////////////// // // HOW TO USE // // // Drag 'n Drop this script into the prim you want to copy. // // It will output a complete script for replicating the object // in Owner-Only chat. Then it will delete itself. // // Copy and paste the chatted script into a *completly blank* // new script // // Then use the Search/Replace function under the Edit menu // to replace the "[HH:MM] :" line prefixes with a blank. // // Just hit the 'Replace All' button. // // It can take 2 minutes or more to print out, so you may have to // do this a few times. // // // The Primitve Paramaters will be chatted out in the oder that // they're featured on the offical Wiki: // // http://wiki.secondlife.com/wiki/LlGetPrimitiveParams // /////////////////////////////////////////////////////////////////// // // WHY? // // Chances are you're not going to need an end-to-end // script to dupe your prim. Shift-drag copy is a lot easier. // // But if you're reading this you probably want some of the code, // so carve out what you need from the output. // // The output code is also commented where appropriate. If you want // To know more about what's going on, read the comments here and // check out the wiki. The wiki's good. // // Many advanced items on the grid transform from one object to // another. Builders have used scrips like this to generate the // code that goes into those products. // // Consider the use of both of llSetPrimitiveParams([]) and // llSetLinkPrimitiveParams([]). A multi-prim prim object can be // metamorphed with a single scipt. // // In my experience you can pack five complete primitive trans- // formations into one script before you run out of bytes. // /////////////////////////////////////////////////////////////////// // // Released nder the terms of the // GNU General Public Liscence v3 // // This source code is free to use / modify / resell // with the following restrictions: // // If you include any portion of -this- script in a product you // distribute you must make the script fully mod/copy/trans for // the next user/owner. You must also liscence it under the GPL // and give attribution to the contributors. // // This does not extend to the code this script generates. That // is yours to liscense as you see fit. // // No warantee expressed or implied. // // For more info see http://www.gnu.org/copyleft/gpl.html // /////////////////////////////////////////////////////////////////// // // Written by // Clarknova Helvetic [2008.01.04] // w/ thanks to Bopete Yossarian // //////////////////////////////////////////////////////////////////// /// Global Functions & Vars to make life easier float pause = .1 ; //// Change this to change the delay between each printed line. //// The laggier the server the more delay you'll need to //// prevent line mix-up. // Object-Specific parameters 2 string string osp(integer p) {return llDumpList2String(llGetPrimitiveParams([p]),","); } // Face-Specific parameters 2 string string fsp(integer p, integer f) { return llDumpList2String(llGetPrimitiveParams([p,f]),","); } // Parameter prefixed and formatted for output string param(string p , integer q) { return p + "," + osp(q); } // General owner chat w\ Sleep function to stop chat lag from screwing up the line order say(string c) { llSleep(pause); llOwnerSay(c); } // Printing out next element to add to the parameter list sayn(string c) { say("\t" + c + " , "); } // Printing out the last element to add to the parameter list saynd(string c) { say("\t" + c + "\n\n\t];"); } // Print out the code to apply the parameters to the object define() { say("\tllSetPrimitiveParams(params);\n\tparams = [];"); } // Handle to insert comments comment(string c) { say("\n\t// " + c ); } /// On with the show... default { state_entry() { say("COPY/PASTE THE CODE BELOW INTO A *BLANK* SCRIPT TO CLONE THIS PRIM: \n\n"); // Announce what we're doing // We're going to change the object's name to a null string to make the output easier to read. string object_name = llGetObjectName(); // Store the object's name so we can set it back when done llSetObjectName(""); // Guess we should transfer the description too string object_desc = llGetObjectDesc(); // Print the script header up to state_entry say("\ndefault\n{\n\tstate_entry()\n\t{\n\tlist params;\n\t\n\n\t// If you are cutting code out to paste into custon functions\n\t// Define \"params\" as a global list and start cutting below this line.\n\n\tparams ="); // Add some comments to the script // [12:56] Tali Rosca: It uses the C-style thing about an assignment also being an expression with a value. // [12:56] Tali Rosca: Why it actually saves memory still baffles my mind, though. // list of the the first: paramater constants as strings, then thier integer value. list Param_Names = ["PRIM_TYPE",PRIM_TYPE,"PRIM_MATERIAL",PRIM_MATERIAL,"PRIM_PHYSICS",PRIM_PHYSICS,"PRIM_TEMP_ON_REZ",PRIM_TEMP_ON_REZ,"PRIM_PHANTOM",PRIM_PHANTOM,"PRIM_POSITION",PRIM_POSITION,"PRIM_ROTATION",PRIM_ROTATION,"PRIM_SIZE",PRIM_SIZE]; // ASIDE: // Prim params are of two types: Object-Specific and Face-Specific. // // I'd Like to group them together according to type, but LsL doesn't // nor does wiki.secondlife, and I am sworn to complete my destiny... // // This is probably for historical reasons (the param order, not my // ultimate destiny). integer i; // You're going to see a lot of use, integer i! integer length; // So are you, integer length! length = (llGetListLength(Param_Names)); // I'm way lazy. Let's make LsL do basic math for us. for ( i = 0 ; i < length ; i = i +2) // This is may answer to list strides. Take that! { if (i > length -3 ) // If we're at the last stride { saynd(param(llList2String(Param_Names,length -2), llList2Integer(Param_Names,length -1))) ; // Fecth the constants out of Param_Names. i = length; } else if (i == 0) // PRIM_TYPE is a special case. But then what isn't? { // Checking if it's a sculptie in a rather extravagant way, // but I also want to check my work. integer j = llList2Integer(Param_Names,i+1); // What's the param we're checking? list r = llGetPrimitiveParams([j]); // What are its values? integer t = llList2Integer(r,0); // What's the first value? if (t == 7) // if it's a sculptie { sayn("[\n\tPRIM_TYPE,"+ (string)t + ",\""+ llList2String(r,1) + "\"," + llList2String(r,2) ); } else sayn("[ \n \n \t" + param(llList2String(Param_Names,i), j)); } else if (i < length -3 && i != length -6 ) sayn(param( llList2String(Param_Names,i), llList2Integer(Param_Names,i+1)) ) ; else if (i < length -3 && i == length -6 ) { say("\t// It's probably not a god idea to have your new prim jump to the old one\n\t// " + param( llList2String(Param_Names,i), llList2Integer(Param_Names,i+1)) + " ] + (params = []) +"); } } Param_Names = []; // Free up some memory // I reallllly want our script to set all of the paramaters at once, with one llSetPrimitiveParams() // call at the end of the script but we can't because of bugs in LsL. // // See https://jira.secondlife.com/browse/SVC-38 for more info. Please vote to fix it.\n\t say(""); comment("Set all of the above paramaters as a group."); define(); say(""); comment("We are breaking the llSetPtimitiveParam([]) calls into blocks, because some params are incompatible with others \n\t// during the same call. This is an LsL bug. See https://jira.secondlife.com/browse/SVC-38 for more info.\n\t// Please vote to fix it. \n"); //// Okay, now for the hard stuff: 4 out of 5 of the Face-Specific params, starting with the hardest: //// PRIM_TEXTURE. Why is PRIM_TEXTURE a pain? Because llSetPrimitiveParams wants it in qoutes, but //// llGetPrimitiveParams doesn't give it to us in quotes. It's a pickle. //// //// The Face-Specific params each need thier own For loop because the number of faces is variable //// from prim to prim. A simple sphere only has one. A tube can have up to 9. integer sides = llGetNumberOfSides(); // So here we find out how many faces we've got comment("This prim has " + (string)sides + " faces.\n"); // Don't care enough to correct for the singular :) /// PRIM_TEXTURE /// say( "\tparams = \n\t[ \n \n "); for (i = 0 ; i < sides ; ++i) { list r =llGetPrimitiveParams([PRIM_TEXTURE,i]); string s = "\"" + llList2String(r,0) + "\"" // First element is the texture key. + "," + llList2String(r,1) + "," + llList2String(r,2) + "," + llList2String(r,3) ; if (i < sides -1) s = s + " , " ; else if (i == sides -1) s = s + "\n\n\t];"; say("\tPRIM_TEXTURE," + (string)i + "," + s ); // Local variables aren't cleared when we leave thier scope. Can you believe that crap? r = []; s = ""; } define(); comment("Note that you -cannot- define textures and colors in the same call!\n\t// If you're cutting out these params for your custom code watch out for this.\n"); /// PRIM_COLOR /// say( "\tparams = \n\t[ \n \n "); for (i = 0 ; i < sides ; ++i) { if (i < sides -1 ) sayn("PRIM_COLOR," + (string)i + "," + fsp(PRIM_COLOR,i)); if (i == sides -1 ) saynd("PRIM_COLOR," + (string)i + "," + fsp(PRIM_COLOR,i)); } define(); /// PRIM_BUMP_SHINY /// say( "\tparams = \n\t[ \n \n "); for (i = 0 ; i < sides ; ++i) { if (i < sides -1 ) sayn("PRIM_BUMP_SHINY," + (string)i + "," + fsp(PRIM_BUMP_SHINY,i) ); if (i == sides -1 ) saynd("PRIM_BUMP_SHINY," + (string)i + "," + fsp(PRIM_BUMP_SHINY,i)); } define(); /// PRIM_FULLBRIGHT /// say( "\tparams = \n\t[ \n \n "); for (i = 0 ; i < sides ; ++i) { sayn("PRIM_FULLBRIGHT," + (string)i + "," + fsp(PRIM_FULLBRIGHT,i)); } //// Now back to an Object-Specific paramaters : Flexible & Shadows //// Remember that I'm going in this screwy order so that our //// Code matches the table on http://wiki.secondlife.com/wiki/LlSetPrimitiveParams sayn(param( "PRIM_FLEXIBLE",21)); sayn("// " + param( "PRIM_CAST_SHADOWS",24)); //// Now for one more Face-Specific paramater /// PRIM_TEXGEN /// // Planar mapping is for correcting the what circular surfaces do to textures // The default value for all faces is 0 ( distored ) // So we will only uncomment lines that carry a value of 1 ( corrected ) // And we make a note of that in the output script here comment("Planar mapping (PRIM_TEXGEN) is for correcting the what circular surfaces do to textures.\n\t// Most builds don't use it, so it's commented out to save bytes in auto-transform code.\n\t// The default value is 1 (distorted).\n\t// if you are metamorphing an object that already had planar mapping (rare)\n\t// uncomment those 0 lines.\n\t// This may not seem like much savings\n\t// but if your script is trying to metamorph between as many as five objects\n\t// those few bytes saved might come in handy at the end.\n\n\t// If your textures are coming out with the offsets all wrong, try uncommenting them."); for (i = 0 ; i < sides ; ++i) { list r = llGetPrimitiveParams([PRIM_TEXGEN,i]); if (llList2Integer(r,-1) == 0) say("\t// PRIM_TEXGEN," + (string)i + "," + llDumpList2String(r," , ") + " , "); if (llList2Integer(r,-1) == 1) say("\tPRIM_TEXGEN," + (string)i + "," + llDumpList2String(r," , ") + " , "); } /// The last paramater is Object-Specific saynd("PRIM_POINT_LIGHT," + osp(PRIM_POINT_LIGHT) ); say("\tllSetPrimitiveParams(params);\tparams = [];"); // Print the final function call, braces & some blank lines say("\n\n\t// If you were cut/pasting this code into a custom transform function\n\t// end your cut above this comment.\n\t// Otherwise ignore this.\n\n\tllSetObjectName(\"" + object_name + "\");\n"); // Make the target's name match this one say("\n\tllSetObjectDesc(\"" + object_name + "\");\n"); // Make the target's desc match this one comment("This next line deletes the script. Comment it out if you want the script to persist"); say("\n\tllRemoveInventory(llGetScriptName());\n\t}\n}\n\n\n"); // Remove the cloning script when done llSetObjectName(object_name); // Change our object's name back. say("Don't forget to remove the \"[HH:MM] :\" timestamp at the beginning of each line. Use Find/Replace :)"); // Remind us to remove prefixes.) llRemoveInventory(llGetScriptName()); // Delete this script. } }
  2. Don't know why cannot fly marking fly override...
  3. Sometime scripts don't work until I delete and recreate them.
  4. I tried keeping message sending related terms before the channel tuning term starts. Now it's working. I don't know why.
  5. I expect that it will show textbox for typing message for every choosen channel. But It is doing it only for 1. integer schannel = 40; integer tuned = 1; integer listener; list buttons; string mode; default { touch_start(integer num) { if (llDetectedKey(0) == llGetOwner()) { llListen(schannel,"",llGetOwner(),""); if(mode != "mute") { buttons = ["Message","Channel","Mute"]; llDialog(llGetOwner(),"Current channel: "+(string)tuned+"\nChoose an option:",buttons,schannel); } else if(mode == "mute") { buttons = ["Message","Channel","Unmute"]; llDialog(llGetOwner(),"Current channel: "+(string)tuned+"\nChoose an option:",buttons,schannel); } } else { llInstantMessage(llDetectedKey(0),"Only owner has access to it."); } } listen(integer channel, string name, key id, string msg) { if (channel == schannel && id == llGetOwner()) { if (msg == "Channel") { mode = "setchan"; llTextBox(llGetOwner(),"Current channel: "+(string)tuned+"\nTune into channel:",schannel); } else if (mode == "setchan" && msg != "Channel") { tuned = (integer)msg; } else if (msg == "Message") { mode = "send"; llTextBox(llGetOwner(),"Current channel: "+(string)tuned+"\nType your message:",schannel); } else if (mode == "send" && msg != "Message") { llSay(tuned,msg); llInstantMessage(llGetOwner(),"\nchannel: "+(string)tuned+"\nsecondlife:///app/agent/"+(string)llGetOwner()+"/about(you): "+msg); } else if (msg == "Mute") { mode = "mute"; llListenRemove(listener); } else if (msg == "Unmute") { mode = ""; listener = llListen(tuned,"","",""); } } if (channel == tuned && id != llGetOwner()) { llInstantMessage(llGetOwner(),"\nchannel: "+(string)tuned+"\nsecondlife:///app/agent/"+(string)id+"/about: "+msg); } } }
  6. (another topic) is there any process to make the scripts reborn sending in object from another object?
  7. Sometimes unexpectedly my cursor replaces text when I type on SL, it also becomes bold. How to change it?
  8. No. 1. is for withdrawing money from alt account without rezing any permanent prim.
  9. 1. Is there any strategy to rez object of another ID in any rez zone? 2.. Is there any script to rez in no rez zone?
  10. Now I have modified the main script again and now I can use that properly. Anyway, is it possible to create notecard in object inventory with any script on sl? And is there any script to show text of notecard, not on hover?
  11. When no prim is resized while recording, scale.x / InitSize.x should be equal to 0, i think but it isn't being so
  12. Is it asutomatically possible to get scale.x from scale? @ Profaitchikenz Haiku
  13. Neither cannot use this script nor communicate with the writer of this script. Now I am trying to modify it. Now, after resetting script in a 2 prim object, the second prim is being too small to see. Failed to find out the reason. // :CATEGORY:Prim // :NAME:Prim_Animator_using_one_script // :AUTHOR:Fred Beckhusen (Ferd Frederix) // :CREATED:2010-10-23 21:23:45.047 // :EDITED:2013-09-18 15:39:00 // :ID:649 // :NUM:881 // :REV:1.0 // :WORLD:Second Life // :DESCRIPTION: // The Single prim animator script Instructions are at http://secondlife.mitsi.com/secondlife/Posts/Prim-Animator // A newer script is at <a href="http://www.outworldz.com/secondlife/posts/prim-compiler/">http://www.outworldz.com/secondlife/posts/prim-compiler/</a> // :CODE: // One Script Prim Animation // ( rev1.1) add llTextBox // Free and Open Source - not for sale but for free use in any build. // Original Script by: Fred Beckhusen (Ferd Frederix) integer runtime = FALSE; // set to TRUE after making the notecard string NOTECARD = "Movement"; // the notecard for this script, you can add more than 1 script and notecard, just change this line to match integer playchannel = 1; // the playback channel, this is the channel you use in LinkMessages integer debug = FALSE; // if set to TRUE, debug info appears // notecard reading string priorname; // the prior animation name so we can spot differences as we read them in integer iIndexLines; // lines in a card integer inotecardIndex = 0; // notecard counter; integer move = 0; // N movements rea from the notecard key kNoteCardLines; // the key of the notecard key kGetIndexLines; // the key of the current line //communications integer dialogchannel ; // dialog boxes integer nPrims; // total number of prims integer PrimsCounter = 0; // how many have checked in integer timercounter = 0; // how many seconds have gone by integer wantname; // flag indicating we are waiting for a name to be chatted // the list of coords list masterlist; // master list of all positions list llastPrimList; // storage of the last prim position we learned string curranimation; // what we are playing integer STRIDE = 5; // size of the master list integer lastSTRIDE = 4; // size of the last prim list integer listener; // temp listener when we are waiting for them to give us a name vector InitSize; // the initial size when the prims were recorded list LoadedAnims; // animations read from the notecard added to the Menu display // in case of hand editing, we wupe out extra stuff at end string Getline(list Input, integer line) { return llStringTrim(llList2String(Input, line),STRING_TRIM); } Record() { if (llStringLength(curranimation) > 0) { integer foundmovement = 0; // will be set if any child moved integer PrimCounter ; // skip past the root prim for (PrimCounter =2; PrimCounter <= nPrims; PrimCounter++ ) { list my_list = llGetLinkPrimitiveParams(PrimCounter,[PRIM_POSITION,PRIM_ROTATION, PRIM_SIZE ]); // position is always in region coordinates, even if the prim is a child or the root prim of an attachment. // rot is always the global rotation, even if the prim is a child or the root prim of an attachment. // get current prim pos, rot and size vector vrealPrimPos = llList2Vector (my_list,0) - llGetPos(); // position subtract Global Pos vrealPrimPos /= llGetRot(); rotation rrealPrimRot = llList2Rot (my_list,1) / llGetRot(); // rotation subtract Global Rot vector vrealPrimSize = llList2Vector (my_list,2); // size // compare it to the last one we had, stride of list is a 4, and it is already sorted integer iindex = (PrimCounter - 2) * lastSTRIDE; // zeroth position is PrimCounter - start, or 2 // get the last thing we remembered about this prim float fprimNum = llList2Integer (llastPrimList, iindex); // must be 0,1,2, in order vector vlastPrimPos = llList2Vector (llastPrimList, iindex+1); rotation rlastPrimRot = llList2Rot (llastPrimList, iindex+2); vector vlastPrimSize = llList2Vector (llastPrimList, iindex+3); // if anything changed on this prim, we must record it. if (vlastPrimPos != vrealPrimPos || rlastPrimRot != rrealPrimRot || vlastPrimSize!= vrealPrimSize ) { foundmovement++; // show owner any changes they mnade if (debug) { llOwnerSay("prim:" + (string) PrimCounter); if (vlastPrimPos != vrealPrimPos) llOwnerSay("pos delta :" + (string) (vrealPrimPos - vlastPrimPos)); if (rlastPrimRot != rrealPrimRot) llOwnerSay("rot delta:" + (string) (llRot2Euler (rrealPrimRot - rlastPrimRot) * RAD_TO_DEG)); if (vlastPrimSize != vrealPrimSize) llOwnerSay("size delta:" + (string) (vrealPrimSize - vlastPrimSize)); } //Save them in the master list of all animations masterlist += curranimation; masterlist += PrimCounter; masterlist += vrealPrimPos; masterlist += rrealPrimRot; masterlist += vrealPrimSize; // save them in the last movement list integer saved = FALSE; integer i; integer imax = llGetListLength(llastPrimList); // save the changes in the last prim list so we can keep our lists smaller for ( i=0; i < imax; i += lastSTRIDE ) { if (llList2Float(llastPrimList,i) == PrimCounter) { llastPrimList = llListReplaceList(llastPrimList,[vrealPrimPos],i+1,i+1); llastPrimList = llListReplaceList(llastPrimList,[rrealPrimRot],i+2,i+2); llastPrimList = llListReplaceList(llastPrimList,[vrealPrimSize],i+3,i+3); if (debug) llOwnerSay("In history at position " + (string) (i/lastSTRIDE)); saved++; } } // never moved before? add it then if (! saved) { if (debug) llOwnerSay("Someone added a new prim and then clicked Record"); llastPrimList += PrimCounter; llastPrimList += vrealPrimPos; llastPrimList += rrealPrimRot; llastPrimList += vrealPrimSize; } } // if } // for if (debug) llOwnerSay("history:" + llDumpList2String(llastPrimList,":")); if (!foundmovement) llOwnerSay("You must move at least one child prim."); } else { llOwnerSay("You must name your animation."); llOwnerSay("Type the new animation name on channel /" + (string) dialogchannel); wantname++; } } // on reset, record the base position in history so we can see changes Clear() { LoadedAnims = []; // wipe out Menu masterlist = []; // wipe all recordings llastPrimList = []; // wipe last animations integer PrimCounter ; // skip 1, which is the root prim integer counter = 0; // save all the current settings in memory for (PrimCounter=2; PrimCounter <= nPrims; PrimCounter++ ) { list my_list = llGetLinkPrimitiveParams(PrimCounter,[PRIM_POSITION,PRIM_ROTATION, PRIM_SIZE ]); // save the local pos and rot, since llGetLinkPrimitiveParams returns global pos and rot vector primpos = llList2Vector (my_list,0) - llGetPos(); rotation primrot = llList2Rot (my_list,1) / llGetRot(); vector primsize = llList2Vector (my_list,2) ; llastPrimList += PrimCounter; llastPrimList += primpos; llastPrimList += primrot; llastPrimList += primsize; counter++; } if(debug) llOwnerSay("Saved " + (string) counter + " prims initial position in history"); } DumpBack () { integer i; integer imax = llGetListLength(masterlist); integer howmany = imax / STRIDE ; llOwnerSay((string) howmany + " movements recorded - copy these and paste them into the notecard"); integer flag = 0; for (i = 0; i < imax; i+= STRIDE) { if ( i == 0 ) llOwnerSay( "|start|" + (string) llGetScale()); string saniName = llList2String(masterlist,i); curranimation = saniName; float fprimNum = llList2Integer(masterlist, i+1); integer iprimNum = (integer) fprimNum; vector vprimPos = llList2Vector(masterlist, i+2); rotation rprimRot = llList2Rot(masterlist, i+3) ; vector vprimSize = llList2Vector(masterlist, i+4); llOwnerSay("|"+ saniName + "|" + (string) iprimNum + "|" + (string) vprimPos + "|" + (string) rprimRot + "|" + (string) vprimSize ); flag++; } if (! flag) llOwnerSay("No recording was made, nothing to play back." ); } rotation calcChildRot(rotation rdeltaRot) { if (llGetAttached()) return rdeltaRot/llGetLocalRot(); else return rdeltaRot/llGetRootRotation(); } PlayBack (string name) { integer i; integer imax = llGetListLength(masterlist); integer linknum = 0; for (i = 0; i < imax; i+= STRIDE) { string saniName = llList2String(masterlist,i); if (saniName == name) { float fprimNum = llList2Float(masterlist,i+1); vector vPos = llList2Vector(masterlist,i+2); rotation rRot = llList2Rot(masterlist,i+3) ; vector vprimSize = llList2Vector(masterlist,i+4) ; vector scale = llGetScale(); float delta = scale.x / InitSize.x ; // see if the root prim has grown or shrunk as a percentage vPos *= delta; // add any difference in size to it positions there vprimSize *= delta; // grow the child prim, too // support negative prim numbers as a delay if (fprimNum < 0) { if (debug) llOwnerSay("Sleeping " + (string) (fprimNum * -1)); llSleep((float) fprimNum * -1); } else { if (fprimNum > 1 ) { // set the local pos and locat rot to the prims orientation and position rRot = calcChildRot(rRot); list actions = [PRIM_POSITION,vPos,PRIM_ROTATION,rRot,PRIM_SIZE,vprimSize]; if (debug) llOwnerSay("Moving prim :" + (string) fprimNum + ":" + llDumpList2String(actions,":")); llSetLinkPrimitiveParamsFast((integer) fprimNum,actions); } } } } } MakeMenu() { list amenu = ["Reset","Record","Help","Name","Notecard","Pause"] + LoadedAnims; llListenRemove(listener); listener = llListen(dialogchannel,"","",""); amenu = llDeleteSubList(amenu,12,99); llDialog(llGetOwner(), "Pick a command",amenu,dialogchannel); } default { state_entry() { InitSize = llGetScale(); // save the size when we recorded the prims nPrims = llGetNumberOfPrims(); // how many we are recording if (debug) llOwnerSay(" Total Prims = " + (string) nPrims); Clear(); string notecardname = llGetInventoryName(INVENTORY_NOTECARD,0); if (llStringLength(notecardname) > 0) { kNoteCardLines = llGetNumberOfNotecardLines(NOTECARD); kGetIndexLines = llGetNotecardLine(NOTECARD,0); } else { llOwnerSay("If you add a notecard, you can save your animations permanently in a notecard named " + NOTECARD); } dialogchannel = (integer) (llFrand(100) +600); } // read notecard on bootup dataserver(key queryid, string data) { if (queryid == kNoteCardLines) { iIndexLines = (integer) data; } if (queryid == kGetIndexLines) { if (data != EOF) { queryid = llGetNotecardLine(NOTECARD, inotecardIndex); list lLine = (llParseString2List(data, ["|"], [])); string aniname = llList2String(lLine,0); string aNum = (string) Getline(lLine,1); // check for the prim size,and save it, the fiorst line will look like this: // [18:06] prim position 1.2: |start|<1.02306, 1.02306, 1.02306> if (inotecardIndex == 0 && aniname == "start") { InitSize = (vector) aNum; } else if (inotecardIndex == 0 && aniname != "start") { llOwnerSay("The notecard " + NOTECARD + " is incorrect, it must begin with 'start|<x,y,z>' with the size of the original prim"); } else { float Num = (float) aNum; vector vPos = (vector) Getline(lLine,3); // global for calcChild() rotation rRot = (rotation) Getline(lLine,4); // global for calcChild() vector Size = (vector) Getline(lLine,5); vector scale = llGetScale(); float delta = scale.x / InitSize.x ; // see if the root prim has grown or shrunk as a percentage if (aniname != priorname) { llOwnerSay("Loading animation " + aniname); priorname = aniname; LoadedAnims += aniname; } if(Num != 1) // skip root prim { masterlist += [aniname]; masterlist += [Num]; masterlist += [vPos]; masterlist += [rRot]; masterlist += [Size]; if (Num > 1) // not the pauses { rRot = calcChildRot(rRot); vPos *= delta; // add any difference in size to it positions there Size *= delta; // grow the child prim, too llSetLinkPrimitiveParamsFast((integer) Num,[PRIM_POSITION,vPos,PRIM_ROTATION,rRot,PRIM_SIZE,Size]); move++; } } } inotecardIndex++; integer InitPerCent = (integer) llRound(( (inotecardIndex+1) / (float) iIndexLines) * 100); llSetText("Initialising... \n" + (string) InitPerCent + "%" , <1,1,1>, 1.0); if (InitPerCent >= 100) llSetText("" , <1,1,1>, 1.0); kGetIndexLines = llGetNotecardLine(NOTECARD,inotecardIndex); } else { llOwnerSay("initialized with " + (string) move + " movements"); llSetText("" , <1,1,1>, 1.0); } } } touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner() && ! runtime) { MakeMenu(); } // add any control code here // example: // llMessageLinked(LINK_SET,playchannel,"All",""); // will play Animation named "All" } listen( integer channel, string name, key id, string message ) { if (channel == dialogchannel) { if (message == "Reset") { Clear(); if (debug) llOwnerSay("Reset = " + llDumpList2String(llastPrimList,":")); MakeMenu(); } else if (message =="Pause") { masterlist += curranimation; masterlist += -1; masterlist += <0,0,0>; // pos masterlist += <0,0,0,1>;// rot masterlist += <0,0,0>; // size MakeMenu(); } else if (message == "Record") { Record(); MakeMenu(); } else if (message == "Name") { llOwnerSay("Type the current animation name on channel /" + (string) dialogchannel); wantname++; MakeMenu(); llTextBox(llGetOwner(),"Enter an Animation Name",dialogchannel); } else if (message =="Menu") { MakeMenu(); } else if (message == "Notecard") { DumpBack(); MakeMenu(); } else if (message == "Help") { llLoadURL(llGetOwner(),"View online help", "http://secondlife.mitsi.com/secondlife/Posts/Prim-Animator"); } else if (wantname) { curranimation = message; LoadedAnims += message; MakeMenu(); llOwnerSay("Recording is ready for animation '" + curranimation + "'"); llOwnerSay("Position all child prims, then select the Menu item 'Record', and repeat as necessary. When finished, click 'PlayBack' to play back the animation, or click the animation name. Click 'Name' to start a new animation sequence"); wantname = 0; PrimsCounter = 0; timercounter = 0; llSetTimerEvent(1.0); } else { if (llListFindList(LoadedAnims,[message]) != -1) { PlayBack(message); MakeMenu(); } } } } link_message(integer sender_num, integer num, string message, key id) { if (num == playchannel) { if (debug) llOwnerSay("playback animation " + message); PlayBack(message); } } }
  14. Tried to make a puppeteer recorder but isn't show preview (playback): string filename; integer n; list size; list pos; list rot; integer c; list s; list prim; integer delay = 1; rec() { c++; n = llGetNumberOfPrims(); integer x; while(x<=(n-1)) { s += (list)c; prim += (list)x; size += llGetLinkPrimitiveParams(x,[PRIM_SIZE]); pos += llGetLinkPrimitiveParams(x,[ PRIM_POSITION ]); rot += llGetLinkPrimitiveParams(x,[PRIM_ROTATION]); x++; } } default { touch_start(integer total_number) { llDialog(llGetOwner(),"choose",["Name","Record","Preview","Dump"],489); llListen(489,"",llGetOwner(),""); } listen(integer channel, string name, key id, string msg) { if (msg=="Name") { llTextBox(llGetOwner(),"choose",490); llListen(490,"",llGetOwner(),""); } else if (channel==490) { filename = msg; } else if (msg=="Record" && filename != "") { rec(); } else if (msg=="Record" && filename == "") { llInstantMessage(llGetOwner(),"Process requires a name."); } else if (msg=="Dump" && c>0) { llInstantMessage(llGetOwner(),filename+"|"+(string)(n*c)); integer x; while(x<n*c) { llInstantMessage(llGetOwner(),llList2String(s,x)+"|"+llList2String(prim,x)+"|"+llList2String(pos,x)+"|"+llList2String(size,x)+"|"+llList2String(rot,x)); x++; } } else if (msg=="Dump" && c==0) { llInstantMessage(llGetOwner(),"No record found"); } else if (msg=="Preview" && c==0) { integer x; while(x<n*c) { integer p; while(p<n) { llSetLinkPrimitiveParams(x,[PRIM_SIZE,(vector)llList2String(size,x)]); llSleep(delay); llSetLinkPrimitiveParams(x,[PRIM_POSITION,(vector)llList2String(pos,x)]); llSleep(delay); llSetLinkPrimitiveParams(x,[PRIM_ROTATION,llEuler2Rot((vector)llList2String(rot,x))]); llSleep(delay); p++; if (p=n) { p = 0; } } x++; } } } }
  15. So, the thing is llList2List, got it, thanks.
  16. when every lines of a notecard contains text|text|text how to add each text in one of three lists?
  17. Looking for a function with which i can make an object doing something if it's not static.
  18. I think so too, thanks a loat @panterapolnocy
  19. suppose note card contains: Place|Surl now how to use if then else to get Surl in a channel?
  20. @redpurple Carpaccio But you used v*llGetRot() instead v+llRot2Euler(llGetRot()), Why?
  21. @redpurple Carpaccio Couldn't understand you reply at that time. Now it's clear and working, thanks.
  22. Need an example page link for move <...> @ redpurple Carpaccio
×
×
  • Create New...