Sari6t Posted January 16, 2017 Share Posted January 16, 2017 Hi thereI'm a 5 day LSL scripting professional...lol, Anyway I've cobbled together loads of nifty things for a super ambitious project ...TARDIS...and nearly have the materialization thing working. Here is where I am stuck ,or not sure about. What I have duct taped together works well enough....once. What I mean is I can say on a channel "/77 show" and it fades and glow and appears with a working timer and all that. Yay!But.. the second time it gets stuck in a loop of appearing, its like the timer().. llSetTimerEvent isn't stopping. I used a counter that seems to work fine the first time but not after that. I have to manually reset to stop it. I've tried llResetScript() but so far it just kills the timer counter totally. Not sure where its wrong. I'll post the code for it and keep banging away.Thanks in advance :) integer count; // Count function integer channel = 77; // channel number string showcmd="SHOW"; // show command - use uppercase only string hidecmd="HIDE"; // hide command - use uppercase only integer links = LINK_SET; // This is the show and hide that I need but don't know how to use properly show() { } hide() { } default { state_entry() { llListen(channel, "", NULL_KEY, ""); // Listen on a channel llSetTimerEvent(0.0); } // Listen on the channel given at the top and do things listen(integer channel, string name, key id, string message) { string m=llToUpper(llStringTrim(message,STRING_TRIM)); if (m==showcmd) { show(); llSetTimerEvent(0.1); // Wont work without it so far } else if (m==hidecmd) { hide(); } } // Makes wonderful glow and fade of the prim over a set number of seconds. timer() { float glow = 0.0; while(glow < 0.5) { glow+=0.01; llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW, ALL_SIDES, glow]); llSleep(0.01); } glow = 0.5; while(glow > 0.1) { glow-=0.01; llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW, ALL_SIDES, glow]); llSleep(0.01); } // Swapping the fade in and out does what I want in that it reversed the effect. // fade out float alpha = 1.0; while (alpha >= 0.0) { llSetLinkAlpha(LINK_SET, alpha, ALL_SIDES); alpha -= 0.001; } // fade in while (alpha < 1.0) { alpha += 0.001; llSetLinkAlpha(LINK_SET, alpha, ALL_SIDES); } // Down here we have some Prim Params again cause more is better?? llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW, ALL_SIDES, 0.0]); llSetTimerEvent(0.1); ++count; // Start Counting if(count == 3) // this is the timer that might cycle this for me llSetTimerEvent(0.0); // Kill the Event at the set time } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted January 16, 2017 Share Posted January 16, 2017 That's mostly because your counter is never reset. It starts at zero, and then stops at 3. The next time it starts at 3 and never stops. Your told to stop only when count == 3. Link to comment Share on other sites More sharing options...
Sari6t Posted January 16, 2017 Author Share Posted January 16, 2017 Ok thanks, So llSetTimerEvent(0.0); doesn't reset it . So I need to figure out how to reset it to 0 after counting to 3. Ok cool thanks Link to comment Share on other sites More sharing options...
Rolig Loon Posted January 16, 2017 Share Posted January 16, 2017 No, llSetTimerEvent(0.0) stops the timer. You want to reset Count. To do that, you need to set Count = 0 at a logical place in the script. 1 Link to comment Share on other sites More sharing options...
Sari6t Posted January 16, 2017 Author Share Posted January 16, 2017 Got it, thanks Link to comment Share on other sites More sharing options...
Rolig Loon Posted January 16, 2017 Share Posted January 16, 2017 Yay team! :smileyvery-happy: 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