Lala Milo Posted May 17, 2019 Share Posted May 17, 2019 (edited) Hi everyone, I made a campfire with mesh flame, and my problem is that i'm using 3 scripts to make it work . 1 for the animation texture (that contain the crackling fire sound) , 1 for the light and glow and 1 for the transparent texture when its off, i click on it to turn it on/off it works well, but 3 scripts it's toomuch just for a mesh ! so my question is if it's possible to have thoses 3 script in 1 ? If yes how ? Edited May 17, 2019 by LAHIN Milo Link to comment Share on other sites More sharing options...
Fritigern Gothly Posted May 17, 2019 Share Posted May 17, 2019 Yes, it is possible (and preferred!), and the way to do that is to combine all the scripts into one. I (or we) could help you with that, but we would have to see the scripts. 1 Link to comment Share on other sites More sharing options...
Lala Milo Posted May 17, 2019 Author Share Posted May 17, 2019 Thx for your reply Fritigern the 1st script is Flame with sound : float volume = 0.5; //Set the sound effects volume (0-1) float rate = 0.3; //Set the speed of the animation in frames per second default { touch_start(integer num_detected) { llLoopSound("3643f41e-fc7b-d44c-120a-35a9aecb4de7",volume); llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 1, 1, 0, 1, rate ); state loop; } } The second script is the light and glow : // Touch the object to light it up. // Lighting is configurable. integer light_s = TRUE; vector lightcolor = <1.0, 0.75, 0.5>; float intensity = 1.0; // 0.0 <= intensity <= 1.0 float radius = 10.0; // 0.1 <= radius <= 20.0 float falloff = 0.01; // 0.01 <= falloff <= 2.0 float glow = 0.30; toggle() { float thisglow = 0.0; light_s = !light_s; if (light_s) thisglow = glow; llSetPrimitiveParams([ PRIM_POINT_LIGHT, light_s, lightcolor, intensity, radius, falloff, PRIM_FULLBRIGHT, ALL_SIDES, light_s, PRIM_GLOW, ALL_SIDES, thisglow ]); llSetColor(lightcolor, ALL_SIDES); } default { state_entry() { llSetText("", <1.0, 1.0, 1.0>, 1.0); toggle(); } touch_start(integer total_number) { toggle(); } } The thirsd script is the transparent texture when it's turned off : float transparency = 50.0; float changeBy = 100.0; default { touch_start(integer count) { transparency = transparency + changeBy; if (transparency > 100.0) { transparency = 0.0; } llSetAlpha(1.0 - (transparency / 100.0), ALL_SIDES); } changed(integer change) { if (change & CHANGED_OWNER) { llResetScript(); } } } Link to comment Share on other sites More sharing options...
Fritigern Gothly Posted May 17, 2019 Share Posted May 17, 2019 This is very quick and dirty and leaves LOTS of room for improvement, but it works. All I did was combine the 3 scripts and fix an issue or two to make the script work. Again, there is a lot of room for improvement, but I'm afraid that RL will not allow me to add more time to this. float transparency = 50.0; float changeBy = 100.0; float volume = 1.0; //Set the sound effects volume (0-1) float rate = 0.3; //Set the speed of the animation in frames per second integer light_s = TRUE; vector lightcolor = <1.0, 0.75, 0.5>; float intensity = 1.0; // 0.0 <= intensity <= 1.0 float radius = 10.0; // 0.1 <= radius <= 20.0 float falloff = 0.01; // 0.01 <= falloff <= 2.0 float glow = 0.30; toggle() { float thisglow = 0.0; light_s = !light_s; if (light_s) { thisglow = glow; llLoopSound("3643f41e-fc7b-d44c-120a-35a9aecb4de7",volume); } llSetPrimitiveParams([ PRIM_POINT_LIGHT, light_s, lightcolor, intensity, radius, falloff, PRIM_FULLBRIGHT, ALL_SIDES, light_s, PRIM_GLOW, ALL_SIDES, thisglow ]); llSetColor(lightcolor, ALL_SIDES); } default { state_entry() { llSetText("", <1.0, 1.0, 1.0>, 1.0); toggle(); } touch_start(integer num_detected) { llStopSound(); //Stop the sound before toggle. toggle(); llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 1, 1, 0, 1, rate ); } changed(integer change) { if (change & CHANGED_OWNER) { llResetScript(); } } } Link to comment Share on other sites More sharing options...
Mollymews Posted May 17, 2019 Share Posted May 17, 2019 (edited) another way to get started then something like this maybe integer light_s; vector lightcolor = <1.0, 0.75, 0.5>; float intensity = 1.0; // 0.0 <= intensity <= 1.0 float radius = 10.0; // 0.1 <= radius <= 20.0 float falloff = 0.01; // 0.01 <= falloff <= 2.0 float glow = 0.30; float transparency = 0.5; float rate = 0.5; float volume = 0.5; toggle(integer on) { llSetPrimitiveParams( [ PRIM_POINT_LIGHT, on, lightcolor, intensity, radius, falloff, PRIM_FULLBRIGHT, ALL_SIDES, light_s, PRIM_GLOW, ALL_SIDES, (float)on * glow, PRIM_COLOR, ALL_SIDES, lightcolor, (float)on * transparency, ]); llSetTextureAnim(on|SMOOTH|LOOP, ALL_SIDES, 1, 1, 0.0, 0.0, (float)on * rate); llLoopSound("3643f41e-fc7b-d44c-120a-35a9aecb4de7", (float)on * volume); } default { state_entry() { toggle(light_s = 0); // douse the fire } touch_start(integer n) { toggle(light_s = !light_s); // light or douse the fire on touch } } Edited May 17, 2019 by Mollymews another way Link to comment Share on other sites More sharing options...
Lala Milo Posted May 17, 2019 Author Share Posted May 17, 2019 (edited) @Fritigern Gothly Thank you ! it works, but ... my flame texture don't show up on the mesh . @Mollymews Thank you, I tried your script but it doesnt work.. it says syntax error on 19 & 4 . i hope that i (or we or you ) will find the solution to make it work in only one script Edited May 17, 2019 by LAHIN Milo Link to comment Share on other sites More sharing options...
Mollymews Posted May 18, 2019 Share Posted May 18, 2019 (edited) 12 minutes ago, LAHIN Milo said: @Mollymews Thank you, I tried your script but it doesnt work.. it says syntax error on 19 & 4 . is what happens when type stuff off the top of our head and not use a actual code editor i will have to log in now and test it just looking at it though line 19 has a spurious comma at the end of the line after "transparency" edit: yes. remove the spurious comma at the end of the line Edited May 18, 2019 by Mollymews 1 Link to comment Share on other sites More sharing options...
Fritigern Gothly Posted May 18, 2019 Share Posted May 18, 2019 9 minutes ago, LAHIN Milo said: @Fritigern Gothly Thank you ! it works, but ... my flame texture don't show up on the mesh . That's because your scripts do not contain the flame texture. I worked with what I had 🙂 1 Link to comment Share on other sites More sharing options...
Lala Milo Posted May 18, 2019 Author Share Posted May 18, 2019 (edited) @Mollymews so it works now, but i cant hear the sound of the fire maybe i've to fix something . I increased the volume but cant hear it .. @Fritigern Gothly well in the flame script i gave you before (with the 2 others scripts) the texture show up on the mesh . With the combined scripts it doesnt work . Edited May 18, 2019 by LAHIN Milo Link to comment Share on other sites More sharing options...
Mollymews Posted May 18, 2019 Share Posted May 18, 2019 1 hour ago, LAHIN Milo said: @Mollymews so it works now, but i cant hear the sound of the fire maybe i've to fix something . I increased the volume but cant hear it .. @Fritigern Gothly well in the flame script i gave you before (with the 2 others scripts) the texture show up on the mesh . there's no UUID texture in the script, i have to slide it in the texture tab . first the texture issue, You should apply the fire texture manually to your object with the sound then it may be that the UUID of the sound clip in the script is invalid. If so then best to get your own sound clip, and put it in the script Link to comment Share on other sites More sharing options...
Lala Milo Posted May 18, 2019 Author Share Posted May 18, 2019 (edited) Hi @Mollymews yes that's what i did. i've made my own sound with audacity. I took the UUID and paste it into the script but it doesnt work... i cant hear it ... And for texture issue, i slided the texture into the texture tab in edit menu... Still nothing i even tried to slide the texture in the content object but nothing change. Edited May 18, 2019 by LAHIN Milo Link to comment Share on other sites More sharing options...
Mollymews Posted May 19, 2019 Share Posted May 19, 2019 19 hours ago, LAHIN Milo said: Hi @Mollymews yes that's what i did. i've made my own sound with audacity. I took the UUID and paste it into the script but it doesnt work... i cant hear it ... And for texture issue, i slided the texture into the texture tab in edit menu... Still nothing i even tried to slide the texture in the content object but nothing change. without seeing the object, I don't know Link to comment Share on other sites More sharing options...
Lala Milo Posted May 19, 2019 Author Share Posted May 19, 2019 @Mollymews hum i see ... but if you try on a cube .. put any texture in the edit menu (texture) and any UUID sound into the script you will see Ifnot i can show you in world ... If somebody know why i cant hear the sound .. please let me know Link to comment Share on other sites More sharing options...
Mollymews Posted May 19, 2019 Share Posted May 19, 2019 15 minutes ago, LAHIN Milo said: @Mollymews hum i see ... but if you try on a cube .. put any texture in the edit menu (texture) like Fritigern said we work with what we got in your scripts "glow" is set to 0.30, and "transparency is set to 0.5. If you change "glow" to some other value like 0.01 or 0.03 and "transparency" to say 0.8 or 1.0 then you can better see the manually applied texture Link to comment Share on other sites More sharing options...
Mollymews Posted May 19, 2019 Share Posted May 19, 2019 i had a quick look a the wiki about sound. Seems we can't change the volume of llLoopSound() without stopping the sound first. Try this: llStopSound(); llLoopSound("seagull1", (float)on * volume); to test this the seagull1 sound clip can be taken from Library \ Objects \ DPW Items for Library \ Sea Gulls \ Sea Gull Sounds object, and copied to your object Contents 1 Link to comment Share on other sites More sharing options...
Lala Milo Posted May 19, 2019 Author Share Posted May 19, 2019 yay ! now i can hear the sound ! Thank you for your patience About the glow and transparency , i can see the glow line set to 0.30 but i dont see any line with transparency set to 0.5. I just see transparency to 50.0 . Anyway now everything works fine ! thank you Fritigern Thank you Mollymews ! 👍 1 Link to comment Share on other sites More sharing options...
Mollymews Posted May 19, 2019 Share Posted May 19, 2019 in my script its: float transparency = 0.5: in yours its: float transparency = 50.0; change your 50.0 to say 80.0 or 90.0 or 100.0 or whatever works for you 1 Link to comment Share on other sites More sharing options...
KT Kingsley Posted May 19, 2019 Share Posted May 19, 2019 Remember that scripts use alpha, opacity, measured 0.0 – 1.0, while in the build floater it's transparency, measured 0% – 100%. So, different scales and measured the other way around. 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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