Switchable llSetTextureAnim?
|
|
Basement Desade
Registered User
Join date: 14 Jul 2006
Posts: 91
|
08-29-2008 17:48
I'm trying to switch between a 16 image texture, which, when applied to a prim becomes a VU meter with a dancing needle, and another, single image texture, which is a shot of the same meter at rest. I have a script that animates the 16 image texture just fine, as long as it is just fine to have the VU meter "on" all the time. However, since I need it to turn off, I cobbled this together: default {
state_entry() { llListen(4,"", NULL_KEY, ""); }
listen(integer channel, string name, key id, string message) { if (message == "Lights on") {llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 4, 4, 0.0, 16.0, 12.0); llSetTexture("animated texture UUID here",ALL_SIDES); } { if (message == "Lights off") {llSetTextureAnim(0| 0,0, 0, 0, 0.0, 0.0, 0.0);} llSetTexture("static texture UUID here",ALL_SIDES);} } }
This works, sort of. When the device containing the prim with the texture anim is switched off, it switches to the static texture, and when it is turned back on, the texture animates, BUT, it seems to then be still using the texture meant for the static state.In any event, the animation shows portions of a much larger texture. It is difficult to tell at that point what texture it is actually using. Is what I am trying to do even possible? I read in the wiki that to stop the texture anim in the script, all I had to do was to leave out the "ANIM_ON." I have tried several permutations of this, but am having no luck getting the prim to switch back to the proper texture for the animation, or at least with the proper repeats and alignment. I suspect this is another thing entirely, though, and perhaps I am not correctly telling it which texture to use in the animated state. I wouldn't call myself anything like a scripter, and I figure I am either missing something which would be obvious to a real scripter, or I am trying to do something that is impossible. Any help would be greatly appreciated.
|
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
08-29-2008 19:28
{llSetTexture("static texture UUID here",ALL_SIDES); llSetTextureAnim(FALSE, 0,0, 0, 0, 0.0, 0.0, 0.0);} try setting the texture before animating it and remove the pipe And I just use TRUE or FALSE to start or stop.
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
08-29-2008 19:30
why not just switch to the single frame that closest resembles the off state and set it to a 1 frame animation?
default {
state_entry() { llListen(4,"", NULL_KEY, ""); llSetTexture("animated texture UUID here",ALL_SIDES); llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 4, 4, 0, 1, .001); }
listen(integer channel, string name, key id, string message) { if (message == "Lights on") llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 4, 4, 0, 16, 12.0); if (message == "Lights off") llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 4, 4, 0, 1, .001); } }
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
08-29-2008 23:36
hmm, try switching the 2 lines in each command, might help to set the texture before setting the animation?
|
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
08-30-2008 00:56
I've seen this before. And it was answered.
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
08-30-2008 00:59
From: Kornscope Komachi I've seen this before. And it was answered. My suggestion didn't actually work.. so I deleted it.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Basement Desade
Registered User
Join date: 14 Jul 2006
Posts: 91
|
08-30-2008 10:15
From: Kornscope Komachi I've seen this before. And it was answered. I looked, and I didn't find it. Could you provide a link, please?
|
|
Basement Desade
Registered User
Join date: 14 Jul 2006
Posts: 91
|
08-30-2008 10:16
From: Ruthven Willenov hmm, try switching the 2 lines in each command, might help to set the texture before setting the animation? Yes, I tried that. It didn't have any effect. Thanks, though.
|
|
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
|
08-30-2008 13:04
I don't know why it won't change textures for you, but you don't have to change textures. Include in your 16 frames the "off" state and set your offsets and repeats so that frame shows. When your animation stops it should return to the default "off" state without having to change textures.
|
|
Basement Desade
Registered User
Join date: 14 Jul 2006
Posts: 91
|
08-30-2008 17:29
Thanks, Anya. I had read somewhere that the anim would negate the prim texture settings. and had already thought of your suggestion, but rejected it because I assumed it wouldn't work. There I go assuming things again.  After you suggested it, I tried it, and it works just fine. I guess the anim only affects the prim settings when it is in effect. Which seems obvious in retrospect, but when it comes to scripting, seldom is anything very obvious to me at this point in time.  Thanks again for pointing this out to me. I knew it would be something simple and obvious, if there was a solution at all. 
|