BountyHunterX Posted June 12, 2010 Share Posted June 12, 2010 I'm terrible at keeping track of time while playing my games. My wife is constantly getting on to me because I will play a game and miss things I planned to do or watch. It isn't that I play it too much, it is just that I quit worrying about time when I play games (mainly Final Fantasy XI). What I'm needing is a script that tells me every hour and half hour in the game by way of /tell (will look goofy sending myself the time but I don't care). Didn't know if AutoIT could do that or not. Basically, while I'm playing I need it to send me a tell for 1:00pm 1:30pm 2:00pm 2:30pm etc. It is I either do this or cancel my FFXI account which I don't want to do. Now you see why I said "Game Bot, but not a Game Bot" because it isn't designed to do anything to the game other than tell me the time. Link to comment Share on other sites More sharing options...
picea892 Posted June 12, 2010 Share Posted June 12, 2010 So, what you need is something that doesn't steal the focus and will appear above one of those very persistent full-screen games. I have seen lots of trys putting a GUI in front of a full screen game and very few succeed....depends on game. Generally I think you have two options. 1) Tooltip 2) Draw on window. I demonstrate both in this example. You will need to get the handle to the game in order to draw on that system window. I use the desktop window for this example. expandcollapse popup; #include <GDIPlus.au3> #include <WinAPI.au3> Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled HotKeySet("{ESC}", "_Quit") Global $GuiSizeX = @DesktopWidth, $GuiSizeY = @DesktopHeight Local $hGui = ControlGetHandle("Program Manager", "", "SysListView321");GUICreate("GDIPlus Example", $GuiSizeX, $GuiSizeY) ;GUISetState() ToolTip(Update()) _GDIPlus_Startup() Local $hGraphicGUI = _GDIPlus_GraphicsCreateFromHWND($hGui) Local $hBMPBuff = _GDIPlus_BitmapCreateFromGraphics($GuiSizeX, $GuiSizeY, $hGraphicGUI) Local $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBMPBuff) ;Graphics here _GDIPlus_GraphicsClear($hGraphic, 0x00E8FFE8) _GDIPlus_GraphicsDrawString($hGraphic,Update(), 600, 420) ;End of graphics _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) ;End Double Buffer add-on 2 of 3 _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) sleep(3000) Func _Quit() ;_GDIPlus_BrushDispose($hBrush) ;_GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hGraphicGUI) _WinAPI_DeleteObject($hBMPBuff) _GDIPlus_Shutdown() Exit EndFunc ;==>_Quit ; Func Update() $h = @HOUR $m = @MIN $time=$m If $h<10 then $h=StringRight($h,1) If $h > 12 Then $h = $h - 12 $m = $m & " PM" Else If $h = 12 Then $m = $m & " PM" Else $m = $m & " AM" EndIf EndIf if $h=0 then $h=12 $variable= $h & ":" & $m&@CRLF&GetDayOfWeek() & " " & GetMonth() & " " & @MDAY Return $variable EndFunc Func GetDayOfWeek() Return _WinAPI_GetLocaleInfo(_WinAPI_GetUserDefaultLCID(), 49 + Mod(@WDAY + 5, 7)) EndFunc ;==>GetDayOfWeek Func GetMonth() Return _WinAPI_GetLocaleInfo(_WinAPI_GetUserDefaultLCID(), 67 + @MON) EndFunc ;==>GetMonth Func Getyear() Return StringRight(@YEAR, 2) EndFunc ;==>Getyear Func _WinAPI_GetLocaleInfo($Locale, $LCType) Local $aResult = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", $Locale, "long", $LCType, "ptr", 0, "long", 0) If @error Then Return SetError(1, 0, "") Local $lpBuffer = DllStructCreate("char[" & $aResult[0] & "]") $aResult = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", $Locale, "long", $LCType, "ptr", DllStructGetPtr($lpBuffer), "long", $aResult[0]) If @error Or ($aResult[0] = 0) Then Return SetError(1, 0, "") Return SetError(0, 0, DllStructGetData($lpBuffer, 1)) EndFunc Func _WinAPI_GetUserDefaultLCID() Local $aResult = DllCall("kernel32.dll", "long", "GetUserDefaultLCID") ; Get the default LCID for this user If @error Then Return SetError(1, 0, 0) Return SetError(0, 0, $aResult[0]) EndFunc Link to comment Share on other sites More sharing options...
picea892 Posted June 12, 2010 Share Posted June 12, 2010 (edited) Here's a good example using a GUI. I'm convinced it won't work in this case, but try if you like. Edited June 12, 2010 by picea892 Link to comment Share on other sites More sharing options...
PartyPooper Posted June 12, 2010 Share Posted June 12, 2010 Most full screen games won't allow you to steal focus. The way I see it, you have two options - either run the game in a window or use an audible alert instead. Link to comment Share on other sites More sharing options...
PartyPooper Posted June 12, 2010 Share Posted June 12, 2010 Oh forgot, there is a third option - use multiple monitors. Link to comment Share on other sites More sharing options...
czardas Posted June 12, 2010 Share Posted June 12, 2010 (edited) Most full screen games won't allow you to steal focus. The way I see it, you have two options - either run the game in a window or use an audible alert instead.Audio clock sounds like a really cool idea. You could make it more and more persistant the longer you ignore it. You could call it the nagging clock. Edited June 12, 2010 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Tvern Posted June 12, 2010 Share Posted June 12, 2010 What I'm needing is a script that tells me every hour and half hour in the game by way of /tell (will look goofy sending myself the time but I don't care).I don't think he's asking for a GUI to be shown, but rather using the ingame chat to display a message. @BountyHunterx: I think I recall other people trying to write bots for FF complaining about it preventing them from interacting through scripts. If so, it might be hard to achieve what you want. Here is a test you can run to see if this is possible. While 1 Send("{Enter}") Send("/tell ") Send("You can send text to this control!") Send("{Enter}") Sleep(5000) WEnd I've never played FF, so I'm not sure how the chat system works, but I assumed "enter" to open chat. "/tell " to specify the tell channel, then your text and then "enter" to send your message. If you open the script in scite you will see it starting to type, meaning it works. If you then maximise FF it hopefully types in chat. If it does nothing at all in FF I'd advise you to look at other options. If it does anything at all in FF, even if it is not exactly what you hoped for there is a good chance it will work. Keep in mind that this it probably still against the EULA and you are risking your account. Link to comment Share on other sites More sharing options...
picea892 Posted June 12, 2010 Share Posted June 12, 2010 (edited) Czardas you're on to something.....Here's my take on the nagging clock ;http://www.autoitscript.com/forum/index.php?showtopic=100439&st=0&p=718271&hl=speak%20text&fromsearch=1&#entry718271 #include <TTS.au3> $Default = _StartTTS() If Not IsObj($Default) Then MsgBox(0, 'Error', 'Failed create object') Exit EndIf _SetRate($Default, 2) _Speak($Default, 'Please stop playing computer, I miss you.') sleep(1000) _Speak($Default, 'The kids are hungry, can you stop playing games') sleep(1000) _Speak($Default, 'Dont you think that is enough!') sleep(1000) _Speak($Default, 'Dont you have a life outside Final Fantasy 11') sleep(1000) _Speak($Default, 'Your wife will not approve of this!')TTS.au3 Edited June 12, 2010 by picea892 Link to comment Share on other sites More sharing options...
czardas Posted June 12, 2010 Share Posted June 12, 2010 (edited) LOL I love it. It needs some random sentence building blocks to generate some quite varied remarks. I'll have a think. Edited June 12, 2010 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
czardas Posted June 12, 2010 Share Posted June 12, 2010 Here's some ideas: #include <TTS.au3> $Default = _StartTTS() If Not IsObj($Default) Then MsgBox(0, 'Error', 'Failed create object') Exit EndIf Local $asStart[4] = ["Isn't it time ","Isn't it about time ","Don't you think it's time ","It's about time "] Local $asMid1[4] = ["messing around ","playing ","messing ","fooling around "] Local $asMid2[3] = ["stupid ","silly ","ridiculous "] Local $asEnd[3] = ["game!","machine!","Final Fantasy 11"] _SetRate($Default, 2) For $i = 0 To 9 $phrase = $asStart[Random(0,3,1)]&"you stopped "&$asMid1[Random(0,3,1)] &"with that "& $asMid2[Random(0,2,1)]&$asEnd[Random(0,2,1)] _Speak($Default, $phrase) sleep(1000) Next operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
picea892 Posted June 12, 2010 Share Posted June 12, 2010 Good job! Somehow I find this very therapeutic, I'm not sure why exactly. Actually it might work to keep the significant other off your back. When they start complaining you've been on the computer too long you can make a deal. Tell her "I'll keep playing the computer but will turn on the autonagger. That time saving device will give you some free time to do whatever you want to do....and still nag me." The options are limitless here. Link to comment Share on other sites More sharing options...
czardas Posted June 12, 2010 Share Posted June 12, 2010 (edited) Added some new stuff. Though it was done in a hurry and might need tidying up. Reason => Football.expandcollapse popup#include <TTS.au3> $Default = _StartTTS() If Not IsObj($Default) Then MsgBox(0, 'Error', 'Failed create object') Exit EndIf Local $asStart[4] = ["Isn't it time ","Isn't it about time ","Don't you think it's time ","It's about time "] Local $asMid1[4] = ["messing around ","playing ","messing ","fooling around "] Local $asMid2[3] = ["stupid ","silly ","ridiculous "] Local $asEnd[3] = ["game!","machine!","Final Fantasy 11"] Local $tCur, $iHour, $iMin _SetRate($Default, 2) For $i = 0 To 9 $iHour = @HOUR $iMin = @MIN If $iMin > 30 Then $iHour += 1 $iMin = 60 - $iMin $iMin &= " minutes to " Else $iMin &= " minutes past " EndIf If $iHour > 12 Then $iHour -= 12 If StringLeft($iHour, 1) = "0" Then $iHour = StringTrimLeft($iHour, 1) EndIf If StringLeft($iMin, 1) = "0" Then $iMin = StringTrimLeft($iMin, 1) EndIf If StringLeft($iMin, 2) = "15" Then $iMin = StringReplace($iMin, "15 minutes", "quarter") ElseIf StringLeft($iMin, 2) = "30" Then $iMin = StringReplace($iMin, "30 minutes", "half") ElseIf StringLeft($iMin,2) = "1 " Then $iMin = StringReplace($iMin, "minutes", "minute") EndIf $sayTime = "It's " & $iMin & $iHour _Speak($Default, $sayTime) sleep(1000) $phrase = $asStart[Random(0,3,1)]&"you stopped "&$asMid1[Random(0,3,1)] &"with that "& $asMid2[Random(0,2,1)]&$asEnd[Random(0,2,1)] _Speak($Default, $phrase) sleep(Random(2000,5000,1)) NextUpdate: Code simplified. Edited June 12, 2010 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
BountyHunterX Posted June 12, 2010 Author Share Posted June 12, 2010 Sorry, should have pointed out that I already have several scripts working with FFXI (mostly bots to call the in game macros to level up skills while I'm afk). I just mainly need to know if AutoIT a way of saying if 1 send note to self about time...if 1:30 send time notice, if 2 send time notice etc. I think I got what I want out of those posts though, thanks. Link to comment Share on other sites More sharing options...
czardas Posted June 12, 2010 Share Posted June 12, 2010 (edited) I'm glad you got some ideas out of it. Edited June 12, 2010 by czardas operator64 ArrayWorkshop 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