Old 30th May 2005, 16:18   #1
gbr
Senior Member
 
Join Date: Nov 2004
Location: Mumbai ( Bombay ), India
Posts: 143
Need help with MAKI script ...

MAKI script gurus ... please help. How do I do this :

I want to call a function f every n seconds, until a condition c is true.

The function f will of course make sure that condition c becomes true, but the number of times function f needs to be called to make condition c true is not fixed.

What I'm trying to do is move a drawer in steps ( every few ses ), as long as the cursor is on a GuiObject ( or the drawer is fully opened ).

My problem is that after I do a timer.start() to call function f after n secs, how do I pause until f is called ?
I need to do a timer.start() again only after function f has exited and the condition c is not true.

I've explained the problem as well as I can ...
gbr is offline   Reply With Quote
Old 30th May 2005, 19:33   #2
carlosp
Major Dude
 
carlosp's Avatar
 
Join Date: Nov 2002
Location: Hamburg, Germany
Posts: 1,312
use timers. they just repeat an option as long as you want.
carlosp is offline   Reply With Quote
Old 30th May 2005, 20:09   #3
krckoorascic
Senior Member
 
krckoorascic's Avatar
 
Join Date: May 2004
Location: Serbia
Posts: 351
Send a message via ICQ to krckoorascic Send a message via AIM to krckoorascic Send a message via Yahoo to krckoorascic
pause (stop) timer with timer.stop();


krckoorascic is offline   Reply With Quote
Old 31st May 2005, 02:45   #4
gbr
Senior Member
 
Join Date: Nov 2004
Location: Mumbai ( Bombay ), India
Posts: 143
I think I solved the prob, will have to check it out.

The ( incorrect ) code I was using earlier went someting like this :

butn.onEnterArea()
{
while ( condition c == false )
{
timer.setdelay(1);
timer.start();
}
}

timer.onTimer() // this is function f ( mentioned above)
{
timer.stop();

move drawer 1 step;

if ( something )
set condition c = true;
}

The prob was that the while would continue looping even before function f was executed. At least that's what I think, correct me if I'm wrong.

Only a newbie like me would have missed the obvious/simple solution, which I haven't yet tested but am 99% sure it will work.

btw, does the MAKI scripting language allow recursion ?

Thanks.

What ?!!! ... you ... errr ... want to know the solution ?
You'll have to ask.
gbr is offline   Reply With Quote
Old 1st June 2005, 03:02   #5
gbr
Senior Member
 
Join Date: Nov 2004
Location: Mumbai ( Bombay ), India
Posts: 143
Please let me know if there is a skin which has a drawer that opens in steps.
That is, the drawer keeps on opening step-by-step as long as the cursor is over a GuiObject. The drawer closes if the cursor leaves the GuiObject.
I've managed to code this but it's quite tricky. Would like to confirm my code.
gbr is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump