DX2 timer interference

Saturday, January 10, 2004 by digital_trucker | Discussion: Stardock Software

I've got two differently named objects. One is a clock with a second hand whose position is updated by a timed event. The other is a gauge with a pointer whose position is updated by a timed event. The timers have different names. When the gauge script is active the clock's hand 'stutters'. if I disable the gauge script, the clock hand works fine.

The following is the clock hand script:

'Called when the script is executed
Sub Object_OnScriptEnter
object.SetTimer 3333,1000
End Sub
Sub Object_OnTimer3333
Object.Rotation = Second(Now)*6
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit

End Sub


The following is the gauge pointer script:

'Called when the script is executed
Sub Object_OnScriptEnter
Object.SetTimer 10, 100
Dim CPULoad
Dim NeedleDestination
End Sub

Sub Object_OnTimer10
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select LoadPercentage from Win32_Processor",,48)
For Each objItem In colItems
CPULoad = objItem.LoadPercentage
Next
NeedleDestination = 235+(CPULoad*2.5)
Object.Rotation = NeedleDestination
End Sub

'Called when the script is terminated
Sub Object_OnScriptExit
Object.KillTimer 10
End Sub


Why do they interfere with each other?

digital_trucker
Reply #1 Sunday, January 11, 2004 2:03 AM
btw, why were the docs located at the link below locked up? They were very handy in help me to learn how to script DX doodads.

https://www.stardock.com/products/desktopx/docs/
kongit
Reply #2 Sunday, January 11, 2004 3:50 AM
go here for the documentation, that page probably just got moved: https://www.stardock.com/products/desktopx/development.html

as for your problem I looked at this a while earlier in the evening and didn't see anything wrong with the script. the only discrepancy was that one object had a kill timer in the exit sub and the other doesn't, but I can't see how that would affect anything. I am sure others have read this and have no idea what's wrong, just like me.
digital_trucker
Reply #3 Sunday, January 11, 2004 3:59 AM
That link does the same thing as the link I posted above.
digital_trucker
Reply #4 Sunday, January 11, 2004 4:08 AM
Well, after much testing, I've determined that it's nothing to do with the timer. I rewrote the gauge code to eliminate the timer, and it still has that effect on the clock hand.
kongit
Reply #5 Sunday, January 11, 2004 4:39 AM
my link is good I just tried it again. and I still have no idea what's wrong. its probably a bug or complexity within desktopx.
digital_trucker
Reply #6 Sunday, January 11, 2004 5:16 AM
Your link doesn't go to the same place. If you look at the links on that page of yours, there are links shown to where I wanted to go...and they do the same thing.

As far as the code, I've come to the conclusion that the problem is simply that VBScript is too slow to handle this kind of operation smoothly. Looks like I'm going to have to learn to code dll's to do what I want to do. Any tips on where to start to learn how to code dll's?

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01