Timer Question

Non-platform specific questions.

Timer Question

Postby Just4Fun » Sat Apr 17, 2004 2:30 am

How do I track a timer's count?

I have created a periodic timer that repeats 30 times. I want to disable a mouse down event when the timer reaches its last count of 30.

I know this is easy but my brain is refusing to help. :oops: :oops:

TlA
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby makslane » Sat Apr 17, 2004 4:32 am

Create a new variable to track this count.
On timer event, use something like this:

timerCount = timerCount + 1;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ingsan » Sat Apr 17, 2004 2:47 pm

Hi :)

On your TimerActor (ASCII or bitmap) :

Add Event CreateActor
Add Action Script and write :
    int timerCount =30;
    Create Timer(yourTimer);

Add Event Timer
Add Action Script and write :
    timerCount--;

Add Event Draw Actor
Add Action Script and write :

    if(timerCount<0)
    {
    DisableMouseDownAction;
    }
or
    if(timerCount==0)
    {
    DisableMouseDownAction;
    }


i always use this code and it works well :wink:
See you :mrgreen:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby jazz_e_bob » Sat Apr 17, 2004 3:16 pm

consider your code stolen :wink:

jazz
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby Just4Fun » Sat Apr 17, 2004 4:49 pm

ingsan,
Once again, you saved my day. :) Thank you. I really do need to see the steps in order to make sense of things. Your complete listing of the code helps me so much.
The only place I got a little confused was that I needed to set up the "timerCount" as a global variable. Once I figured that out, everything went perfectly.
I may have another simple little demo ready before long.
Everyone is so helpful here. I'm actually even learning some of the scripting! :D
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby ingsan » Sat Apr 17, 2004 7:33 pm

i'm happy to help, guys :) Really
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest