1.

Solve : VBA Timer??

Answer»

I'm making a puzzle game in PowerPoint in which each level you have to press a button while avoiding obstacles. Most of the general stuff is being programmed in VBA. However, in each level there will be a timer that will silently count down from 60 to 0. Once the level is complete, it will add the amount of seconds left to the score.

The Sleep function totally stops execution of PowerPoint, so I can't use that for the delay in the countdown (I've tried, and I had to press the windows key and close PowerPoint 'cause it wasn't responding).

How can I have a silent timer that won't FREEZE everything?Think this is what your looking for: http://www.tushar-mehta.com/powerpoint/ppt_timer/index.htm

Never heard of making a game in pp though. If you are going to need more functionality, I think you should use a real programming language. Quote from: Linux711 on January 14, 2012, 12:49:17 PM

Think this is what your looking for: http://www.tushar-mehta.com/powerpoint/ppt_timer/index.htm
That doesn't have any support for VBA as FAR as I know. D:
Quote from: Linux711 on January 14, 2012, 12:49:17 PM
Never heard of making a game in pp though. If you are going to need more functionality, I think you should use a real programming language.
VBA is just as much of a programming language as ActionScript; just think of it having a visual interface like Flash does.

Are you not understanding? VBA (Visual Basic with an A; I don't know what it stands for ) is a programming language implemented into Microsoft Office programs that can be used for Macros, subroutines that can simplify tasks and do other stuff.
In PowerPoint, macros can be run by action buttons, animations, and so forth to do more than just cleaning up empty text boxes.

By the way, you can make a game in PowerPoint without macros, but it'll be simple stuff like MAZE games using the mouse and Jeopardy.

Also, that thing costs money.
VBA stands for Visual Basic for Applications.


You could use the SSubTmr from VBAccelerator. download, register DLL, use Tools->References (In the VBA EDITOR)and add it. (VBAccelerator Subclassing and Timer Assistant)

Then you can use it, say in a UserForm:

Code: [Select]Private WithEvents timerobj As SSubTimer6.CTimer
Private StartTime As Date
Private Sub timerobj_ThatTime()
    Label1.Caption = Now()-StartTime
End Sub

Private Sub UserForm_Initialize()
    Set timerobj = new CTimer
    timerobj.Interval=300
    StartTime=Now()
End Sub
It won't work in a code module; would need to either be in it's own class or a UserForm (I believe it will also work in a Slide). Basically you use the timer to periodically update the display of a label, or other element.


Discussion

No Comment Found