Jump to content

Issues with ToolTip


Go to solution Solved by Musashi,

Recommended Posts

Hey guys, I'm following some guide on youtube and I'm stuck at a certain command "ToolTip"

when used alone it shows a tooltip but I tried to use the script from the video and it somehow doesn't work, I tried the prod auto correct and it didn't detect any error.

 

 

HotKeySet("{F2}", "GG")
$wait = 1000
$left = 0
$right = 0


Func GG()
   While 1
   Progress($left, $right)
   Send("{LEFT}")
   Sleep($wait)
   $left = $left + 1
   Progress($left, $right)
   Send("{RIGHT}")
   Sleep($wait)
   $right = $right + 1
   Progress($left, $right)
WEnd
EndFunc


Func Progress($left, $right)
   Local $hotkey = ""
   if @HotKeyPressed = "{F2}" Then
      $hotkey = "You Are gooood"
   EndIf


   ToolTip("Hotkey: " & $hotkey & " " & @hotkeypressed & @CRLF & _
   "Left: " & $left & @CRLF & _
   "right: " & $right & @CRLF & _
   "Time: " & time($left, $right), _
                           400, 500, "_____Thanks so much!_____")

EndFunc


Func time($left, $right)

   $totalSecs = (($left - $right) * $wait) / 1000
   $hrs = Floor($totalSecs / 3600)
   $mins = Floor( ( ($totalSecs / 3600) - $hrs ) *60)
   $secs = Floor( ( ($totalSecs / 60) - Floor(($totalSecs / 60)) ) * 60)
   Return $hrs & " HR: " & $mins & "MIN: " & $secs & " S"

   EndFunc

Where is the error in the code ? why is it not showing the tooltip ?

Edited by xkazz
Link to comment
Share on other sites

  • Solution
11 hours ago, xkazz said:

Where is the error in the code ? why is it not showing the tooltip ?

The script ends immediately right after the start ( before you can press F2). You will need e.g. a main loop.

HotKeySet("{ESC}", "_Terminate")
HotKeySet("{F2}", "GG")

Local $wait = 1000, $left = 0, $right = 0

; -------------- Main-Loop -----------------
While 1
    Sleep(100)
WEnd
; -------------------------------------------


Func GG()
    While 1
        Progress($left, $right)
        Send("{LEFT}")
        Sleep($wait)
        $left = $left + 1
        Progress($left, $right)
        Send("{RIGHT}")
        Sleep($wait)
        $right = $right + 1
        Progress($left, $right)
    WEnd
EndFunc   ;==>GG


Func Progress($left, $right)
    Local $hotkey = ""
    If @HotKeyPressed = "{F2}" Then
        $hotkey = "You Are gooood"
    EndIf


    ToolTip("Hotkey: " & $hotkey & " " & @HotKeyPressed & @CRLF & _
            "Left: " & $left & @CRLF & _
            "right: " & $right & @CRLF & _
            "Time: " & time($left, $right), _
            400, 500, "_____Thanks so much!_____")

EndFunc   ;==>Progress


Func time($left, $right)
    $totalSecs = (($left - $right) * $wait) / 1000
    $hrs = Floor($totalSecs / 3600)
    $mins = Floor((($totalSecs / 3600) - $hrs) * 60)
    $secs = Floor((($totalSecs / 60) - Floor(($totalSecs / 60))) * 60)
    Return $hrs & " HR: " & $mins & "MIN: " & $secs & " S"
EndFunc   ;==>time

Func _Terminate()
    ConsoleWrite("! Script terminated by user" & @CRLF)
    Exit;
EndFunc   ;==>_Terminate

 

 

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

On 7/28/2021 at 5:51 AM, Musashi said:

The script ends immediately right after the start ( before you can press F2). You will need e.g. a main loop.

HotKeySet("{ESC}", "_Terminate")
HotKeySet("{F2}", "GG")

Local $wait = 1000, $left = 0, $right = 0

; -------------- Main-Loop -----------------
While 1
    Sleep(100)
WEnd
; -------------------------------------------


Func GG()
    While 1
        Progress($left, $right)
        Send("{LEFT}")
        Sleep($wait)
        $left = $left + 1
        Progress($left, $right)
        Send("{RIGHT}")
        Sleep($wait)
        $right = $right + 1
        Progress($left, $right)
    WEnd
EndFunc   ;==>GG


Func Progress($left, $right)
    Local $hotkey = ""
    If @HotKeyPressed = "{F2}" Then
        $hotkey = "You Are gooood"
    EndIf


    ToolTip("Hotkey: " & $hotkey & " " & @HotKeyPressed & @CRLF & _
            "Left: " & $left & @CRLF & _
            "right: " & $right & @CRLF & _
            "Time: " & time($left, $right), _
            400, 500, "_____Thanks so much!_____")

EndFunc   ;==>Progress


Func time($left, $right)
    $totalSecs = (($left - $right) * $wait) / 1000
    $hrs = Floor($totalSecs / 3600)
    $mins = Floor((($totalSecs / 3600) - $hrs) * 60)
    $secs = Floor((($totalSecs / 60) - Floor(($totalSecs / 60))) * 60)
    Return $hrs & " HR: " & $mins & "MIN: " & $secs & " S"
EndFunc   ;==>time

Func _Terminate()
    ConsoleWrite("! Script terminated by user" & @CRLF)
    Exit;
EndFunc   ;==>_Terminate

 

Thank you it worked. There is a little issue with the seconds in the time and I'll fix it.

 

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