Counting down

Posted by Xinphinity on Mon 08 Apr 2002 08:17 PM — 6 posts, 23,192 views.

USA #0
Me again.

Okay here is the scenario. I get a message that says -

Roundtime: 6 seconds.

I know i can get, and am getting the numeric 6 into a var, but what I want to do is output to the screen in a countdown either

Roundtime: 6...5....4....3...2...1 Done.

Or, ick,
RoundTime: 6
5
4
3
2
1
Done

Any ideas or suggestions on this one?

~Xin
Canada #1
From the main mushclient page, click on the link to 'all functions'. It's on the left side, near the bottom.

On the next page, click the link to list them all alphabetically.

Check out World.AddTimer and World.Note. There are some related timer functions that will be listed when you check out AddTimer.

The tools lie there for you to learn about and use. ...or you could wait for someone to write the script here for you. I don't have time right now.
Australia Forum Administrator #2
You can use world.setstatus to put messages on the status line. This might be helpful here.

I would add a timer, that fires every second. This timer would query a variable (time to go), and draw on the status line. Then when the variable became negative, you would disable the timer.

eg.


dim secs
  secs = world.getvariable ("seconds")
  secs = secs - 1
  if secs < 0 then  
    world.setstatus "Done" 
    world.enabletimer "thistimer", false ' disable timer
  else
    world.setstatus "Time to go = " & secs & " seconds"
    world.setvariable "seconds", secs
  end if
Amended on Tue 09 Apr 2002 10:48 PM by Nick Gammon
USA #3
Nick that was just what I needed.

Except, *bops you*,
it's World.EnableTimer "timer", TRUE|FALSE!!
The code you posted crashed the Client...;)

No big deal the code was still just what i needed.


Thanks much.

~Xin
Australia Forum Administrator #4
Ah that will teach me to code without testing first. :)

I'll amend the post.
USA #5
Well dont do it for me, it was no big deal and a big help.

;)

~Xin