Jump to content

joeyblueyes

Resident
  • Posts

    44
  • Joined

  • Last visited

Everything posted by joeyblueyes

  1. Innula Zenovka wrote: You can't do what you're trying to, at least not directly. The script and the texture need to be in the same prim if the script is to read the texture's uuid (which is what it's doing). So, one option, it seems to me, is to have a script in each prim and have the script in the root send a link message to tell the the script in the child prim when to read the next texture and apply it (actually, I think it would look better if the script sends the message to LINK_SET and responds to the link message, too). The other option would be to have the script in the root prim change the textures in the child prim by using llSetLinkTexture or llSetLInkPrimitiveParamsFast. Thanks for your reply, Innula! I'm not exactly sure how to impliment your first option, as I'm still quite green when it comes to scripting, but as for the second option, I did use llSetLinkTexture, and it works to change the texture in the Child, but only still with the textures stored in the Root! I thought about llSetLInkPrimitiveParamsFast, but even with that, wouldn't I still be limited to just calling the Root prim textures? Can you give me an idea on how to possibly use your 1st option? Thanks for your help!!!
  2. Hi All, I have 2 linked prim and each has (lets say) 5 textures each stored in its inventory! When the linked object is touched, a menu appears. Using 1 button for each prim in the menu, I would like to cycle through the textures in "that prim's" inventory! In the Root Prim, I have the following code: textureIndex++; numTextures = llGetInventoryNumber(INVENTORY_TEXTURE); if(textureIndex == numTextures) textureIndex = 0; textureName = llGetInventoryName(INVENTORY_TEXTURE, textureIndex); if (textureName != "") llSetTexture(textureName, side); The above is working fine and cycling through all of the Textures stored in the "Root Prim"..... Good so far... The problem is that I would like another button to cycle textures FOR the "Child Prim" FROM the "Child Prim's" Inventory! I tried the following code similar to above: textureIndex++; numTextures = llGetInventoryNumber(INVENTORY_TEXTURE); if(textureIndex < 0) textureIndex = numTextures - 1; textureName = llGetInventoryName(INVENTORY_TEXTURE, textureIndex); if (textureName != "") llSetLinkTexture(LINK_ALL_CHILDREN, textureName, ALL_SIDES); Using "llSetLinkTexture", I can successfully cycle textures on the Child Prim, however, it uses the textures stored in the Root Prim's Inventory! Seems that if there were a "llGetLinkInventoryNumber" & "llGetLinkInventoryName", then this would work fine! Can someone please point me in the right direction to get the textures stored in the Child Prim's Inventory? Thanks in advance! :-)
  3. Qie Niangao wrote: Perhaps this known bug, just fixed in a beta viewer? Thank you Qie! That sure does look like the issue I'm having! I guess if I really think about it, I've seen things like this here and there, but of course notice more on my own scripts! Guess I need to give the beta a try, but looks like it's not my script at all! Thanks again Qie & Rolig
  4. Nope, no timer in the script anyway! There is a steam script and a fire particle script in prims close by, but I made sure nothing else was running, and the issue remains! I went into preferences and saw that my "Max Particle Count" was set to around 4k, but that hasn't been changed recently, and other particle effects seem fine! If I lower this setting below 1k, the flashing issue decreases to almost non-existant, but I of course loose view of most particles.... Hmmm ???
  5. Added a snapshot to better show what I'm describing!
  6. I have a Particle Script for a shower water effect, and it is working well and looks good, but.... It seems to "flash" almost like a mini lightning effect, and also see some particle "clumps" at times that drop from the emitter also..... Is this my viewer? I'm using the latest 3.4.4 (I think). Sometimes the flash is very little, sometimes a lot! Any ideas are greatly appreciated! Thanks.... Below are my particle settings in case it helps... :-) llParticleSystem([ PSYS_PART_FLAGS, PSYS_PART_FOLLOW_SRC_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK | PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK, PSYS_SRC_ACCEL, <0,0,-3.0>, PSYS_PART_START_SCALE, <1.0,2.25,.1>, PSYS_PART_END_SCALE, <3.0,2.25,.1>, PSYS_PART_START_COLOR, <0.425,0.425,0.43>, PSYS_PART_END_COLOR, <0.75,0.8,0.925>, PSYS_PART_START_ALPHA, 0.75, PSYS_PART_END_ALPHA, 0.65, PSYS_PART_MAX_AGE, 1.0, PSYS_SRC_TEXTURE, "3ac01b9f-76a7-c8ad-cf2e-52226b6e46ba", PSYS_SRC_BURST_RATE, 0.02, PSYS_SRC_BURST_PART_COUNT, 8, PSYS_SRC_BURST_RADIUS, 0.45, PSYS_SRC_BURST_SPEED_MAX, 2.6, PSYS_SRC_BURST_SPEED_MIN, 2.5, PSYS_SRC_ANGLE_BEGIN, 0.2, PSYS_SRC_ANGLE_END, 0.2, PSYS_SRC_MAX_AGE, 0.0, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE]);
  7. Ok, well I think I'm gonna finalize this..... I'm gonna just leave the lighting as a button mounted to the outside if the tub! I now noticed that even with the code commented in the lighting section that makes the script compile, it now messes with the Steam function.... So...... Rolig (and everyone else), thank you so much for all of your help and time on this! I have learned a lot of new things, and now can go on to break something else! ;-) Thank You so much once again! :matte-motes-sunglasses-3:
  8. Rolig Loon wrote: Why are you still using a mix of l and i as indices in this doLight function? I'm actually not! I'm using "l", but just haven't changed the "i" in the commented section yet! If I could get the error to go away, of course I'll update the rest with "l".... All of the working code is using "l", so as not to conflict with "i" that is used elsewhere...
  9. Thank you Rolig! This stack overflow error is relentless.... :-( I changed the code as below: vector lColorOff = <222, 187, 153>; // Color of the prim when the light is off (255 = white)vector lColorOn = <190, 0, 0>; // These are the RGB values as you see in the color pickerinteger lLinkBulbs = TRUE; // Set all linked "bulb" prims to emit light TRUE = yes, FALSE = fullbrightfloat lIntensity = 0.6; // Light intesity (doh)float lFalloff = 0.5; // Light falloff (double doh)float lRadius = 6.0; // Light radius (oh c`mon, like you didn`t guess that one coming...)float lGlow = 0.45; // Glow amount, steps of 0.05float lGlowDefault = 0.05; // Amount of glow when the light is offdoLight(){ integer l = llGetNumberOfPrims(); while( l ) // That is, while i > 0 { if (llGetLinkName(l) == "bulb") { // We love burning electricity, ON! if (lState == 1 || (lState == 2 && sunDir.z < 0)) { llSetLinkPrimitiveParamsFast( l, [PRIM_FULLBRIGHT, ALL_SIDES, TRUE]); }// if (!lLinkBulbs && (lState == 1 || (lState == 2 && sunDir.z < 0))) { // llSetLinkPrimitiveParams( 1, [PRIM_POINT_LIGHT,TRUE, (lColorOn/255), lIntensity, lRadius, lFalloff]); // }// if (lLinkBulbs && (lState == 1 || (lState == 2 && sunDir.z < 0))) { // llSetLinkPrimitiveParams( i, [PRIM_POINT_LIGHT,TRUE, (lColorOn/255), lIntensity, lRadius, lFalloff, PRIM_GLOW, ALL_SIDES, lGlow, PRIM_COLOR, ALL_SIDES, (lColorOn/255), 1]); // }/* // Ok, we`re kindof green...off if (lState == 0 || (lState == 2 && sunDir.z > 0)) { llSetLinkPrimitiveParams( i, [PRIM_FULLBRIGHT, ALL_SIDES, FALSE]); } if (!lLinkBulbs && (lState == 0 || (lState == 2 && sunDir.z > 0))) { llSetLinkPrimitiveParams( 1, [PRIM_POINT_LIGHT,FALSE, (lColorOn/255), lIntensity, lRadius, lFalloff]); } if (lLinkBulbs && (lState == 0 || (lState == 2 && sunDir.z > 0))) { llSetLinkPrimitiveParams( i, [PRIM_POINT_LIGHT, FALSE, <0.0,1.0,0.0>,1.0, 10.0, 0.5, PRIM_GLOW, ALL_SIDES, lGlowDefault, PRIM_COLOR, ALL_SIDES, (lColorOff/255), 1]); }*/ } --l; }} I uncommented the first conditional statement to test, and I STILL get the error, However, if I comment the following...... // vector lColorOff = <222, 187, 153>; // Color of the prim when the light is off (255 = white)// vector lColorOn = <190, 0, 0>; // These are the RGB values as you see in the color picker The error goes away, and the script compiles just fine...... BUT.... Of course I do need to define the above lines...... AND Even with the above lines commented, if I make a call to the doLight() function, The Error Returns! OMG... This is crazy!
  10. Rolig Loon wrote: Two things...... First, you have four bogus lines in your user-defined function doLight. //THIS one >> /*// As complicated as this looks, bad joke, we can`t be arsed to copy the dialog text 10 times list dM = ["Glow", "Show Settings", "Exit", "Intensity", "Falloff", "Radius", "Light On", "Light Off", "Light Sun"];list dPM = ["--", "++", "Back"];//THIS one >> */// No, it`s not the God function, christ...doLight(){ integer l = llGetNumberOfPrims(); for (; l >= 1; --l) { if (llGetLinkName(l) == "bulb") { // We love burning electricity, ON!// if (lState == 1 || (lState == 2 && sunDir.z < 0)) { // llSetLinkPrimitiveParamsFast( l, [PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);// }// if (!lLinkBulbs && (lState == 1 || (lState == 2 && sunDir.z < 0))) { // llSetLinkPrimitiveParams( 1, [PRIM_POINT_LIGHT,TRUE, (lColorOn/255), lIntensity, lRadius, lFalloff]); // }// if (lLinkBulbs && (lState == 1 || (lState == 2 && sunDir.z < 0))) { // llSetLinkPrimitiveParams( i, [PRIM_POINT_LIGHT,TRUE, (lColorOn/255), lIntensity, lRadius, lFalloff, PRIM_GLOW, ALL_SIDES, lGlow, PRIM_COLOR, ALL_SIDES, (lColorOn/255), 1]); // }//THIS one >> /* // Ok, we`re kindof green...off if (lState == 0 || (lState == 2 && sunDir.z > 0)) { llSetLinkPrimitiveParams( i, [PRIM_FULLBRIGHT, ALL_SIDES, FALSE]); } if (!lLinkBulbs && (lState == 0 || (lState == 2 && sunDir.z > 0))) { llSetLinkPrimitiveParams( 1, [PRIM_POINT_LIGHT,FALSE, (lColorOn/255), lIntensity, lRadius, lFalloff]); } if (lLinkBulbs && (lState == 0 || (lState == 2 && sunDir.z > 0))) { llSetLinkPrimitiveParams( i, [PRIM_POINT_LIGHT, FALSE, <0.0,1.0,0.0>,1.0, 10.0, 0.5, PRIM_GLOW, ALL_SIDES, lGlowDefault, PRIM_COLOR, ALL_SIDES, (lColorOff/255), 1]); }//THIS one >>*/ } }} The sequences /*"and */ have no meaning in LSL, so the compiler doesn't know what to do with them. Get rid of those lines. When I do, it compiles just fine. The second problem is less significant at the moment. You're not calling this function anywhere in your script. It's just sitting there, doing nothing but causing a compile error. You also have a raft of other unused global variables, BTW. The code for the lighting is only partial ATM, just to test for the error. With the lines commented, it does compile fine, but ifv I Call the function, I get the error again!
  11. Ok, well it is messy from so much trial & error, but the only Lighting code added so far is at the top of the script, and with what is commented out now, it is compiling fine without errors! I hope there is a simple solution, as I've spent so much time on this... :-( integer PINK1 = 1; //0001 binaryinteger BLUE1 = 2; //0010 binaryinteger PINK2 = 4; //0100 binaryinteger BLUE2 = 8; //1000 binaryinteger a;integer alive;integer b;integer b0;integer ballusers;integer c;integer ch;integer chat = 1;integer group;integer hear;integer i;integer line;integer menu;integer menuusers;integer redo = 1;integer rez;integer swap;integer visible;float alpha;string cmd;string pose;string pose0;key owner;key user;key user0;list buttons;list buttonindex;list commands;list menus;list balls;list users;// Lighting Control ******** START ********vector sunDir; // Vector as we use a function//integer cmdChannel = -900101; // Dialog channel we recieve commands oninteger lState = 2; // 0 = off, 1 = on, 2 = sun controlledinteger dState = 0; // 0 = main, 1 = intensity, 2 = falloff, 3 = radius, 4 = glowkey User;integer listner;vector lColorOff = <222, 187, 153>; // Color of the prim when the light is off (255 = white)vector lColorOn = <190, 0, 0>; // These are the RGB values as you see in the color pickerinteger lLinkBulbs = TRUE; // Set all linked "bulb" prims to emit light TRUE = yes, FALSE = fullbrightfloat lIntensity = 0.6; // Light intesity (doh)float lFalloff = 0.5; // Light falloff (double doh)float lRadius = 6.0; // Light radius (oh c`mon, like you didn`t guess that one coming...)float lGlow = 0.45; // Glow amount, steps of 0.05float lGlowDefault = 0.05; // Amount of glow when the light is off/*// As complicated as this looks, bad joke, we can`t be arsed to copy the dialog text 10 times list dM = ["Glow", "Show Settings", "Exit", "Intensity", "Falloff", "Radius", "Light On", "Light Off", "Light Sun"];list dPM = ["--", "++", "Back"];*/// No, it`s not the God function, christ...doLight(){ integer l = llGetNumberOfPrims(); for (; l >= 1; --l) { if (llGetLinkName(l) == "bulb") { // We love burning electricity, ON!// if (lState == 1 || (lState == 2 && sunDir.z < 0)) { // llSetLinkPrimitiveParamsFast( l, [PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);// }// if (!lLinkBulbs && (lState == 1 || (lState == 2 && sunDir.z < 0))) { // llSetLinkPrimitiveParams( 1, [PRIM_POINT_LIGHT,TRUE, (lColorOn/255), lIntensity, lRadius, lFalloff]); // }// if (lLinkBulbs && (lState == 1 || (lState == 2 && sunDir.z < 0))) { // llSetLinkPrimitiveParams( i, [PRIM_POINT_LIGHT,TRUE, (lColorOn/255), lIntensity, lRadius, lFalloff, PRIM_GLOW, ALL_SIDES, lGlow, PRIM_COLOR, ALL_SIDES, (lColorOn/255), 1]); // }/* // Ok, we`re kindof green...off if (lState == 0 || (lState == 2 && sunDir.z > 0)) { llSetLinkPrimitiveParams( i, [PRIM_FULLBRIGHT, ALL_SIDES, FALSE]); } if (!lLinkBulbs && (lState == 0 || (lState == 2 && sunDir.z > 0))) { llSetLinkPrimitiveParams( 1, [PRIM_POINT_LIGHT,FALSE, (lColorOn/255), lIntensity, lRadius, lFalloff]); } if (lLinkBulbs && (lState == 0 || (lState == 2 && sunDir.z > 0))) { llSetLinkPrimitiveParams( i, [PRIM_POINT_LIGHT, FALSE, <0.0,1.0,0.0>,1.0, 10.0, 0.5, PRIM_GLOW, ALL_SIDES, lGlowDefault, PRIM_COLOR, ALL_SIDES, (lColorOff/255), 1]); }*/ } }}// Lighting Control ******** END ********// Particle Script 0.5 ******** START ********integer keystate = 0 ;// Mask Flags - set to TRUE to enableinteger glow = FALSE; // Make the particles glowinteger bounce = FALSE; // Make particles bounce on Z plane of objectinteger interpColor = TRUE; // Go from start to end colorinteger interpSize = TRUE; // Go from start to end sizeinteger wind = TRUE; // Particles effected by windinteger followSource = FALSE; // Particles follow the sourceinteger followVel = FALSE; // Particles turn to velocity direction// Choose a pattern from the following:// PSYS_SRC_PATTERN_EXPLODE// PSYS_SRC_PATTERN_DROP// PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY// PSYS_SRC_PATTERN_ANGLE_CONE// PSYS_SRC_PATTERN_ANGLEinteger pattern = PSYS_SRC_PATTERN_EXPLODE;// Select a target for particles to go towards// "" for no target, "owner" will follow object owner // and "self" will target this object// or put the key of an object for particles to go tokey target = "";// Particle paramatersfloat age = 1.0; // Life of each particlefloat maxSpeed = 0.2; // Max speed each particle is spit out atfloat minSpeed = 0.5; // Min speed each particle is spit out atstring texture = "4f714019-c1cf-6b16-994f-44b217022f1a"; // Texture used for particles, default used if blank//float startAlpha = 0.1; // Start alpha (transparency) valuefloat endAlpha = 0.0; // End alpha (transparency) valuevector startColor = <9.9,9.9,9.9>; // Start color of particles <R,G,B>vector endColor = <9,9,9>; // End color of particles <R,G,B> (if interpColor == TRUE)vector startSize = <1.30,1.30,0.0>; // Start size of particles vector endSize = <1.5,1.5,0.0>; // End size of particles (if interpSize == TRUE)vector push = <.2,0,3>; // Force pushed on particles// System paramatersfloat rate = 0.0; // How fast (rate) to emit particlesfloat radius = 1.0; // Radius to emit particles for BURST patterninteger count = 59; // How many particles to emit per BURST float outerAngle = 0; // Outer angle for all ANGLE patternsfloat innerAngle = 0.1; // Inner angle for all ANGLE patternsvector omega = <0,0,0>; // Rotation of ANGLE patterns around the sourcefloat life = 0; // Life in seconds for the system to make particlesinteger flags;list sys;integer type;vector tempVector;rotation tempRot;string tempString;//integer i;updateParticles(){ flags = 0; if (target == "owner") target = llGetOwner(); if (target == "self") target = llGetKey(); if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK; if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK; if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK; if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK; if (wind) flags = flags | PSYS_PART_WIND_MASK; if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK; if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK; if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK; sys = [ PSYS_PART_MAX_AGE,age, PSYS_PART_FLAGS,flags, PSYS_PART_START_COLOR, startColor, PSYS_PART_END_COLOR, endColor, PSYS_PART_START_SCALE,startSize, PSYS_PART_END_SCALE,endSize, PSYS_SRC_PATTERN, pattern, PSYS_SRC_BURST_RATE,rate, PSYS_SRC_ACCEL, push, PSYS_SRC_BURST_PART_COUNT,count, PSYS_SRC_BURST_RADIUS,radius, PSYS_SRC_BURST_SPEED_MIN,minSpeed, PSYS_SRC_BURST_SPEED_MAX,maxSpeed, PSYS_SRC_TARGET_KEY,target, PSYS_SRC_INNERANGLE,innerAngle, PSYS_SRC_OUTERANGLE,outerAngle, PSYS_SRC_OMEGA, omega, PSYS_SRC_MAX_AGE, life, PSYS_SRC_TEXTURE, texture,// PSYS_PART_START_ALPHA, startAlpha, PSYS_PART_END_ALPHA, endAlpha ]; // llParticleSystem(sys);}// Particle Script 0.5 ******** END ********//menu partly based on Menu Engine by Zonax Delorean (BSD License)//llDialog(user, menuname, buttons(from index to nextindex-1), channel) doMenu() { b0 = llList2Integer(buttonindex, menu); //position of first button for this (sub)menu b = llList2Integer(buttonindex, menu+1); //position of first button for next (sub)menu llDialog(user, llList2String(menus,menu), llList2List(buttons, b0, b - 1), ch - 1); c = llList2Integer(balls,menu); //ballcolors if © { //if submenu includes ballcolor(s): if (!rez) rezBalls(); //if no balls present: create balls llSay(ch,(string)(c & 3)); //ball1color: mask with 3 = 0011 binary llSay(ch+1,(string)(c >> 2)); //ball2color: shift 2 bits to the right if (ballusers) setBalls("GROUP"); //if group access only } llResetTime(); //if (user != llGetOwner()) llOwnerSay("("+llKey2Name(user)+" selects "+llList2String(menus,menu)+")"); //owner will receive info}say(string str) { if (menuusers) llWhisper(0,str); else llOwnerSay(str);}setBalls(string cmd) { llSay(ch,cmd); //msg to balls llSay(ch+1,cmd);}rezBalls() { setBalls("DIE"); llRezObject("~ball",llGetPos(),ZERO_VECTOR,ZERO_ROTATION,ch); llRezObject("~ball",llGetPos(),ZERO_VECTOR,ZERO_ROTATION,ch+1); llMessageLinked(LINK_THIS,0,"REPOS",NULL_KEY); //msg to pos llMessageLinked(LINK_THIS,0,"POSE","0"); //msg to pos/pose rez = 1; alive = 2; pose = pose0; llSetTimerEvent(60); if (chat) say("Balls ready");}default { state_entry() { // Particle Script 0.5 ******** START ******** //updateParticles(); keystate = 0 ; //target = llGetLinkKey(2) ; updateParticles() ; //llParticleSystem([]) ; // Particle Script 0.5 ******** END ******** //llSetScriptState("~run", TRUE); llResetOtherScript("~pos"); llResetOtherScript("~pose"); llResetOtherScript("~pose1"); llResetOtherScript("~pose2"); ch = (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim setBalls("DIE"); alpha = llGetAlpha(0); //store object transparancy (alpha) if (alpha < 0.1) alpha = 0.5; else visible = 1; //if invisible store a visible alpha llMessageLinked(LINK_THIS,1,"OK?",NULL_KEY); //msg to memory: ask if ready } link_message(integer from, integer num, string str, key id) { if (num == 2) { if (str == "OK") state load; //memory ready } }} state load { state_entry() { llGetNotecardLine(".MENUITEMS",0); //read first line of menuitems notecard } dataserver(key query_id, string data) { if (data == EOF) state on; i = llSubStringIndex(data,"//"); //remove comments if (i != -1) { if (i == 0) data = ""; else data = llGetSubString(data, 0, i - 1); } while (llGetSubString(data, -1, -1) == " ") data = llDeleteSubString(data, -1, -1); //remove spaces from end if (data != "") { i = llSubStringIndex(data," "); cmd = data; if (i != -1) { //split command from data cmd = llGetSubString(data, 0, i - 1); data = llGetSubString(data, i+1, -1); } list ldata = llParseString2List(data,[" | "," | "," | "," | "," |","| ","|"],[]); data = llList2String(ldata, 0); if (cmd == "MENU") { if (a < 2) { llOwnerSay("warning: first item in .MENUITEMS must be: POSE stand"); llOwnerSay("warning: second item in .MENUITEMS must be: POSE default"); } llOwnerSay("loading data for '"+data+"'"); if (llList2String(ldata, 1) == "GROUP") menu = 1; //access to submenus else if (llList2String(ldata, 1) != "OWNER") menu = 2; //0=owner 1=group 2=all pose = llList2String(ldata, 2); if (pose == "PINK") rez = PINK1; else if (pose == "BLUE") rez = BLUE1; pose = llList2String(ldata, 3); if (pose == "PINK") rez += PINK2; else if (pose == "BLUE") rez += BLUE2; menus += [ data ]; balls += [ rez ]; buttonindex += [ b ]; users += [ menu ]; rez = 0; b0 = 0; menu = 0; } else if (b0 < 12) { //maximum 12 buttons per menu if (cmd == "POSE") { llMessageLinked(LINK_THIS,1,data,(string)a); //msg to memory llMessageLinked(LINK_THIS,9+a,llList2String(ldata, 1),llList2String(ldata, 2)); //msg to pose if (!a) pose0 = data; cmd = (string)a; ++a; } else if (cmd == "REDO") { if (llList2String(ldata, 1) != "OFF") redo = 1; } else if (cmd == "CHAT") { if (llList2String(ldata, 1) != "OFF") chat = 1; } else if (cmd == "BALLUSERS") { if (llList2String(ldata, 1) == "GROUP") ballusers = 1; } else if (cmd == "MENUUSERS") { if (llList2String(ldata, 1) == "GROUP") menuusers = 1; else if (llList2String(ldata, 1) != "OWNER") menuusers = 2; } commands += [ cmd ]; buttons += [ data ]; ++b; ++b0; } } ++line; llGetNotecardLine(".MENUITEMS",line); //read next line of menuitems notecard } state_exit() { buttonindex += [ b ]; //enter last buttonindex commands += [ "" ]; //empty command for undefined buttons (-1) llOwnerSay("READY"); llOwnerSay((string)b+" menuitems loaded ("+llGetScriptName()+": "+(string)llGetFreeMemory()+" bytes free)"); llMessageLinked(LINK_THIS,1,"LOADED",(string)a); //msg to memory llMessageLinked(LINK_THIS,9+a,"LOADED",NULL_KEY); //msg to pose }}state on { state_entry() { owner = llGetOwner(); llSetTimerEvent(0); llListenRemove(hear); hear = llListen(ch - 1, "", NULL_KEY, ""); //listen for pressed buttons } touch_start(integer i) { user0 = llDetectedKey(0); if (user0 == owner || (menuusers == 1 && llDetectedGroup(0)) || menuusers == 2) { //0=owner 1=group 2=all if (user0 != user) { if (llGetTime() < 60) { llDialog(user0, "\n"+llKey2Name(user)+" has just selected the menu, do you want to continue?", ["Yes","Cancel"], ch - 1); return; } user = user0; group = llDetectedGroup(0); } menu = 0; doMenu(); //mainmenu } } listen(integer channel, string name, key user0, string button) { if (user0 != user) { if (button == "Yes") { user = user0; group = llSameGroup(user0); menu = 0; doMenu(); } else if (button != "Cancel") { llDialog(user0, "\nSelection cancelled because "+llKey2Name(user)+" has just selected the menu, do you want to operate the menu again?", ["Yes","Cancel"], ch - 1); } return; } b = llListFindList(buttons,[ button ]); //find position of cmd string cmd = llList2String(commands,b); //get command// llSay(0,button+" "+cmd); //debug if (cmd == "Steam-On") { llParticleSystem(sys); llSay(0,"Steam ON"); } else if (cmd == "Steam-Off") { llParticleSystem([]); llSay(0,"Steam OFF"); } if (cmd == "Steam-HI") { llParticleSystem(sys + [PSYS_PART_START_ALPHA, 0.5]); llSay(0,"Steam ON HI"); } else if (cmd == "Steam-MED") { llParticleSystem(sys + [PSYS_PART_START_ALPHA, 0.3]); llSay(0,"Steam ON MED"); } else if (cmd == "Steam-LOW") { llParticleSystem(sys + [PSYS_PART_START_ALPHA, 0.1]); llSay(0,"Steam ON LOW"); } if (cmd == "TOMENU") { menu = llListFindList(menus,[ button ]); //find submenu if (menu == -1) return; i = llList2Integer(users, menu); if (user == owner || (i == 1 && group) || i == 2) { //0=owner 1=group 2=all doMenu(); return; } if (i == 1) llDialog(user0, "\n"+button+" menu deactivated\n(access by group only)", ["OK"], ch - 1); else llDialog(user0, "\n"+button+" menu deactivated\n(access by owner only)", ["OK"], ch - 1); menu = 0; return; } else if (cmd == "BACK") { menu = 0; doMenu(); //mainmenu return; } else if ((integer)cmd > 0) { //POSE llMessageLinked(LINK_THIS,0,"POSE",cmd); //msg to pos/pose if (chat) say(button); pose = button; } else if (cmd == "SWAP") { llMessageLinked(LINK_THIS,0,"SWAP",NULL_KEY); //msg to pos/pose swap = !swap; } else if (cmd == "STAND") { llMessageLinked(LINK_THIS,0,"POSE","0"); //STAND msg to pos/pose if (chat) say(button); menu = 0; pose = pose0; } else if (cmd == "STOP") { llMessageLinked(LINK_THIS,0,"POSE","0"); //STAND msg to pos/pose if (chat) say(button); setBalls("DIE"); if (chat && rez) say("Balls removed"); rez = 0; llSetTimerEvent(0); return; } else if (cmd == "ADJUST") { setBalls("ADJUST"); } else if (cmd == "HIDE") { setBalls("0"); } else if (cmd == "SHOW") { setBalls("SHOW"); } else if (cmd == "DUMP") { llMessageLinked(LINK_THIS,1,"DUMP",NULL_KEY); } else if (cmd == "INVISIBLE") { visible = !visible; llSetAlpha((float)visible*alpha, ALL_SIDES); } else if (cmd == "REDO") { redo = !redo; if (redo) say(button+" ON"); else say(button+" OFF"); } else if (cmd == "CHAT") { chat = !chat; if (chat) say(button+" ON"); else say(button+" OFF"); } else if (cmd == "BALLUSERS") { ballusers = !ballusers; if (ballusers) { llOwnerSay(button+" GROUP"); setBalls("GROUP"); } else { llOwnerSay(button+" ALL"); setBalls("ALL"); } } else if (cmd == "MENUUSERS") { if (user == owner) { if (!menuusers) { menuusers = 1; llOwnerSay(button+" GROUP"); } else if (menuusers == 1) { menuusers = 2; llOwnerSay(button+" ALL"); } else if (menuusers == 2) { menuusers = 0; llOwnerSay(button+" OWNER"); } } else llWhisper(0,button+" (can be switched by owner only)"); } else if (cmd == "RESET") { llMessageLinked(LINK_THIS,0,"POSE","0"); //STAND msg to pos/pose setBalls("DIE"); //llSleep(0.5); if (chat) say(button); llResetScript(); } else if (cmd == "OFF") { llMessageLinked(LINK_THIS,0,"POSE","0"); //STAND msg to pos/pose setBalls("DIE"); //llSleep(0.5); if (user == owner) { llOwnerSay(button); llResetOtherScript("~run"); llResetScript(); } llDialog(user0, "\n"+button+" button deactivated\n(access by owner only)", ["OK"], -1); return; } else if (llGetSubString(cmd, 0, 0) == "Z" || (cmd == "SAVE")) { //SAVE //Z-adjust llMessageLinked(LINK_THIS,0,cmd,pose); //msg to pos/pose doMenu(); return; } if (redo) doMenu(); } link_message(integer from, integer num, string str, key id) { if (str == "PRIMTOUCH") { user0 = id ; integer detected_group = num; if (user0 == owner || (menuusers == 1 && detected_group) || menuusers == 2) { //0=owner 1=group 2=all if (user0 != user) { if (llGetTime() < 60) { llDialog(user0, "\n"+llKey2Name(user)+" has just selected the menu, do you want to continue?", ["Yes","Cancel"], ch - 1); return; } user = user0; group = llDetectedGroup(0); } menu = 0; doMenu(); //mainmenu } return; } if (num != 2) return; if (str == "ALIVE") { ++alive; } else if (str == "DIE") { //suicide msg from ball setBalls("DIE"); menu = 0; rez = 0; llSetTimerEvent(0); } } on_rez(integer r) { if (owner != llGetOwner()) llResetScript(); } timer() { if (alive > 1) { alive = 0; llSay(ch,"LIVE"); //msg to balls: stay alive llSay(ch+1,"LIVE"); } else { //balls not rezzed properly anymore rezBalls(); llSay(ch,(string)(c & 3)); //ball1color: mask with 3 = 0011 binary llSay(ch+1,(string)(c >> 2)); //ball2color: shift 2 bits to the right if (ballusers) setBalls("GROUP"); //if group access only } } } Thank you again.....
  12. Well, I am completely at a loss! I've tried all we've discussed, and used a variable that I'm sure was not otherwise used, but still I get the same error when the conditional "if" is used.... :-( Is there possibly some easy way to call the DoLight() function from a menu button without adding the scripts together? They work fine when separate, so this worul of course solve my conflict issue.... Thanks for your patience and help!
  13. Ok, you are correct! "i" is used elsewhere in the script by other menu functions, so could I just use something else in this case like set an "integer a" or something, or is "i" a special part of the function? Sorry for the noobie question... LOL
  14. Rolig Loon wrote: Well, the most obvious problem is that you are running your for loop down to zero, but there's no link #0 in the linkset. The root is #1 and the numbers go up from there. I don't see any reason why that should give you a stack/heap error, though. I assume that your variables lState and sunDir are both global, BTW. Incidentally, not that it makes any difference in a slow-changing script like this, but llSetLinkPrimitiveParams has a 0.2 second delay every time it is executed. In general, I avoid it and use SLPPF, which has no delay, instead. Ok, thanks! I will try changing the for-loop from 0, and also give the SLPPF a try as well.... Just strange that the "if" part of the whole thing is what is causing the error! I can say if(jellybeans), and still get the same.... LOL I'm currently using a button on the outside of the tub that controls the lights, and this works fine, but I just would like to have it in the menu with everything else if possible! I'll give the above a try and hope for the best! Thanks for your continued help, Rolig! :-)
  15. Rolig Loon wrote: It means that you are running out of run-time memory. In a simple script lik this, the probable answer is that you have some loop running that the script can't get out of. Try putting a diagnostic llOwnerSay statement inside any loop you may have, and see what's happening. Thank you again, Rolig! I did some process of elimination, and narrowed to down to a function in the lighting script that I'm trying to combine in the menu script! The lighting script controls 4 lights that are linked and all have the name "bulb". When it's used and not combined with the menu script, it works fine, so something is clashing, but I'm at a loss to what it is! Below is the function that clashes.... doLight(){ integer i = llGetNumberOfPrims(); for (; i >= 0; --i) { if (llGetLinkName(i) == "bulb") { if (lState == 1 || (lState == 2 && sunDir.z < 0)) { llSetLinkPrimitiveParams( i, [PRIM_FULLBRIGHT, ALL_SIDES, TRUE]); } } }} I've narrowed it down further.... The conditional "if" is what is causing the error! I used llSetLinkPrimitiveParams by itself, and it compiles just fine. I even substituted a totally unrelated "if" statement there and the error returns, so.... just by having this conditional, I get the error! Any ideas? Thanks again....
  16. Ok, back with one more question.... I'm now pushing it, and trying to combine a lighting control script within the menu script! I'm getting the following error: Tub [script:~menu] Script run-time error Stack-Heap Collision Is there something simple that is causing this? Wont compile, nor work as long as this error exists.... Thanks again.....
  17. Thank you so much again, Rolig! I guess it really does make sense to combine the scripts, and sure I'll see that much clearer when fully writing my own! Seems I was kind of close already to your example, so just needed to add: if (cmd == "Steam-HI") { llParticleSystem(sys + [PSYS_PART_START_ALPHA, 0.5]); llSay(0,"Steam ON HI"); } else if (cmd == "Steam-MED") { llParticleSystem(sys + [PSYS_PART_START_ALPHA, 0.3]); llSay(0,"Steam ON MED"); } else if (cmd == "Steam-LOW") { llParticleSystem(sys + [PSYS_PART_START_ALPHA, 0.1]); llSay(0,"Steam ON LOW"); } Then just comment our the hard coded Alpha setting in the particle params, and it is working like a charm! :-) Think I will also take your advice and visit the Particle labs, as it prob would be helpful to know more about it! Thanks once again, everyone..... But I;m sure I'll be back... LOL ;-)
  18. Thanks everyone for your fast replies, and help, and sorry for my delay in replying! I did combine my partical steam script with the menu script, and using the conditionals on menu button presses, the steam turns on and off nicely with llParticleSystem(sys) & llParticleSystem([]). So thanks for that help and understanding! Of course this works easily because it is all contained within the same script, but just wondering how I would have done this if I had left the code as 2 separate scripts (menu & steam)? Would I have used llLinkParticleSystem( integer link, list rules ) from the menu script? And if so, can someone please give me an idea of how I would have formatted it? Now, I would like to also take this one step further too.... I would like to have a LOW, MED & HI steam particle setting, and of course I can achieve this with changing the float startAlpha value, but I can't seem to do this..... If I try to use conditionals in the "scope" where the startAlpha is currently defined, I get a syntax error, and if I try to specisfy the conditionals anywhere else, then I get the error that startAlpha is not defined in the scope! I tried setting the default value in the scope, and using button press conditionals later in the code, but it seems that the value does not change :-( Thinking this is probably something real simple that I'm missing, and any help is appreciated! Thanks again for all of your replies.... :matte-motes-sunglasses-3:
  19. Hi All, I'm real new to LSL scripting, but trying to play with some existing scripts to learn! Here is what I'm trying to do.... I built a hot tub and added a menu. In that menu I have a button called "Steam" . I added a steam particle script that works well with steam coming off the tub water, but I would like to be able to turn the steam on and off! Using llGetScriptState to check the running state of the script and llSetScriptState to toggle from running to not running, this works fine, "except" of course it does not turn off the steam effect! Question #1 - Is there another way to completely stop the script from running, since toggling the running status does not do it? In the steam script, I found that I can set "float startAlpha = 0.2" to "float startAlpha = 0.0" to make the steam invisible and it appears to be off, but I'm not sure how to set this value remotely from the menu! Question #2 - Is there a way to use the status of the steam script (running or not), and use a conditional "if" to set the startAlpha value? Thanks in advance... :-)
×
×
  • Create New...