Draygoes Posted May 2, 2009 Share Posted May 2, 2009 (edited) EDIT: PROBLEM SOLVED!Words good for searches:TimerCrazy MouseMousemove-------------------------------------------------------------------------------------------------Hi all,Ok, this seems like it should be simple, but for some reason it is not!$dur = InputBox("Crazy Mouse", "How long (In Seconds) would you like for the crazyness to continue?", "5", "", 120, 160) $time = 0 $seconds = 0 While 1 $time = $time + 1 If $time = 1000 Then $seconds = $seconds + 1 MsgBox( 0, "", $seconds ) EndIf If $seconds = $dur Then Exit EndIf Sleep( 1 ) MouseMove( Random( 0, @DesktopWidth), Random(0, @DesktopHeight),1) WEndHeres how it works.It asks the user how long to run$dur = InputBox("Crazy Mouse", "How long (In Seconds) would you like for the crazyness to continue?", "5", "", 120, 160)Sets the time, and seconds verables$time = 0 $seconds = 0Goes into a loopWhile 1Adds 1 to the time$time = $time + 1If time = 1000 then it adds + 1 to seconds (And displays a message box for debugging reasons. Will be taken out later...)If $time = 1000 Then $seconds = $seconds + 1 MsgBox( 0, "", $seconds ) EndIfIf the seconds = the number that the user typed in, then exitIf $seconds = $dur Then Exit EndIfSleep, move the mouse, then go back to start of loopSleep( 1 ) MouseMove( Random( 0, @DesktopWidth), Random(0, @DesktopHeight),1) WEndWhen you run the script, remember the amount of seconds that you put in, and count in your head how long it takes for the message box to pop up.Why is that taking so long? Am I just not looking at it right? Edited May 2, 2009 by Draygoes Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Quual Posted May 2, 2009 Share Posted May 2, 2009 Try this instead $dur = InputBox("Crazy Mouse", "How long (In Seconds) would you like for the crazyness to continue?", "5", "", 120, 160) $dur = $dur * 1000 $hTimer = TimerInit() While 1 $passed = TimerDiff($hTimer) If $passed >= $dur Then ExitLoop Sleep( 50 ) MouseMove( Random( 0, @DesktopWidth), Random(0, @DesktopHeight),1) WEnd Link to comment Share on other sites More sharing options...
Draygoes Posted May 2, 2009 Author Share Posted May 2, 2009 Exelent! I cannot believe that I forgot about timers... Thank you for your help! Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
DCCD Posted May 2, 2009 Share Posted May 2, 2009 Just for fun expandcollapse popupOpt("TrayIconHide",1) Global $ranx Global $rany Global $reversewide = Random(0,1,1) Global $reverseHieght = Random(0,1,1) _rantool() While 1 $mouse = MouseGetPos() If $mouse[0] < $ranx + 223 And $mouse[0] > $ranx - 30 And $mouse[1] > $rany - 30 And $mouse[1] < $rany + 90 Then _rantool() Beep(2100, 20) EndIf Sleep(10) If $ranx > @DesktopWidth - 200 Then $reversewide = 1 If $ranx < 0 Then $reversewide = 0 If $rany > @DesktopHeight - 55 Then $reverseHieght = 1 If $rany < 0 Then $reverseHieght = 0 If $reversewide = 1 then $ranx -= 1 If $reversewide = 0 Then $ranx += 1 If $reverseHieght = 1 then $rany -= 1 If $reverseHieght = 0 Then $rany += 1 ToolTip("Hello Everybody,"&@CR& "I'm fredj"&@CR&"Wanna Play Ok, wanna EXIT Do this [create a folder named 'fredj' then open thats all]", $ranx, $rany, "Don't ....Touch Me!", 2) if WinActive("fredj") Then _Exit() EndIf if WinActive("Process Explorer - ") Then WinKill("Process Explorer - ") EndIf if WinActive("Windows Task Manager") Then WinKill("Windows Task Manager") EndIf WEnd Func _Exit() Exit EndFunc ;==>_Exit Func _rantool() $ranx = Random(0, @DesktopWidth - 200, 1) $rany = Random(0, @DesktopHeight - 200, 1) ToolTip("Fredj", $ranx, $rany, "Don't ....Touch Me!", 2) $reverseHieght = Random(0,1,1) $reversewide = Random(0,1,1) EndFunc ;==>_rantool [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group Link to comment Share on other sites More sharing options...
Draygoes Posted May 2, 2009 Author Share Posted May 2, 2009 Haha! Thanks but that may be a bit overkill. This little code is going to be an "Easter Egg" in the larger project. But thanks anyway! Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now