Jump to content

Wondering how to make an information box while the script runs.


Recommended Posts

What I am looking to do is have a small box on the screen that shows current information about the script that is running. In this case, it is for a game, so whenever it mines an ore, I want it to show it as something like "Ore Mined: 15" I would also like for the little info box to show how long the script has been running. I have seen this done with several other scripts but I never quite found out how to do it.

Thanks in advance. (Note I will try to find a picture, that better illustrates what I'm attempting to do just in case I wasn't very clear.)

Link to comment
Share on other sites

Personally I like to use tooltip for things like that when possible. It is fairly unobtrusive and simple to implement.

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

I'm looking for something to be running constantly, is easy to see the progress of the program... and is a bit bigger. But I do thank you very much for the idea.

If the script is in a loop, the tool tip will be displayed as long as the script is running. Have you look into creating a small GUI for this purpose?

Link to comment
Share on other sites

What I am looking to do is have a small box on the screen that shows current information about the script that is running. In this case, it is for a game, so whenever it mines an ore, I want it to show it as something like "Ore Mined: 15" I would also like for the little info box to show how long the script has been running. I have seen this done with several other scripts but I never quite found out how to do it.

Thanks in advance. (Note I will try to find a picture, that better illustrates what I'm attempting to do just in case I wasn't very clear.)

If the script is in a loop, the tool tip will be displayed as long as the script is running. Have you look into creating a small GUI for this purpose?

Not sure how to make a GUI to be honest, so not until you mentioned it. As far as the tool tip, I wanted a large white box with the info if at all possible, not really the small yellow one.

Link to comment
Share on other sites

Not sure how to make a GUI to be honest, so not until you mentioned it. As far as the tool tip, I wanted a large white box with the info if at all possible, not really the small yellow one.

You can display as much info as you want.

Example

$orevar = 1
$othervar = 1

ToolTip("Ore: " & $orevar & @CRLF & "Other Var: " & $othervar, 0 , 0, "")

That is just a example, but as you can see, this allow you display as many Variables, as you wanted, on different lines. This would be 10x easier than building a GUI for everything you wanna display, I use tooltips all the time, it works great.

Edited by logcomptechs
Link to comment
Share on other sites

Another example:

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

While 1
    Sleep(100) ; usually a good idea to put this in so you dont max your cpu
    $pos = MouseGetPos()
    $msg = "x=" & $pos[0] & " y=" & $pos[1] & @CRLF & "Color=x" & Hex(PixelGetColor($pos[0], $pos[1]), 6)
    ToolTip($msg)
WEnd

Func _Terminate()
    Exit 0
EndFunc   ;==>_Terminate

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

You don't create GUI window for each variable, you create controls for that, whether you prefer to handle it via a tree-view control or input boxes...

Edit: To get the amount of time your script is running you can first initialize a variable in the header with TimerInit() and use the TimerDiff() with the first variable you got in TimerInit() to get the differences.

Edited by Authenticity
Link to comment
Share on other sites

Hmm I may be stuck using the tool tip command until I get a hang of GUI theory... so another question is, how could I make using variables an active constantly running timer of how long the script has been running, using the tool tip command. I figure it has something to do with the timer start and hosting it as a variable, but just wanting to be sure.

Link to comment
Share on other sites

HotKeySet('{ESC}', '_EXIT')

Dim $iInit = TimerInit()
Dim $aPos
Dim $sMessage

While 1
    Sleep(20)
    $aPos = MouseGetPos()
    $sMessage = 'X: ' & $aPos[0] & @LF & 'Y: ' & $aPos[1] & @LF & @LF & 'Process execution time: ' & Int(TimerDiff($iInit)/1000) & '(seconds)'
    
    ToolTip($sMessage, @DesktopWidth-200, 0)
WEnd

Func _EXIT()
    Exit
EndFunc

Similar to SpookMeister's post. You can format the time to HH:MM:SS using the Date.au3 library or code yourself function.

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