Jump to content

A crazy little script written for fun, (Solved)


Recommended Posts

EDIT: PROBLEM SOLVED!

Words good for searches:

Timer

Crazy Mouse

Mousemove

-------------------------------------------------------------------------------------------------

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)
    
WEnd

Heres 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 = 0

Goes into a loop

While 1

Adds 1 to the time

$time = $time + 1

If 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 )
EndIf

If the seconds = the number that the user typed in, then exit

If $seconds = $dur Then
        Exit
    EndIf

Sleep, move the mouse, then go back to start of loop

Sleep( 1 )

    MouseMove( Random( 0, @DesktopWidth), Random(0, @DesktopHeight),1)
    
WEnd

When 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 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

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

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

Just for fun

Opt("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
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...