josnaker Posted June 11, 2008 Share Posted June 11, 2008 Hi I made a script for Diablo II that make game then wait to 'perm' this game. It simply wait untill you are in the lobby and then make a game and wait $time. I want it displays the time remaining in a msgbox or something else. There is a preview of my script. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.11.12 (beta) Author: josnaker Script Function: Perm game in D2. #ce ---------------------------------------------------------------------------- #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> HotKeySet("{ESC}","close") HotKeySet("{HOME}","about") #Region ### START Koda GUI section ### Form= Opt("GUIOnEventMode", 1) $title = GUICreate("GamePermer", 260, 150, 193, 125) $gamelabel = GUICtrlCreateLabel("Nom de la Partie :", 16, 18, 88, 17) $game = GUICtrlCreateInput("", 112, 15, 121, 21) $passlabel = GUICtrlCreateLabel("Mot de passe :", 16, 52, 79, 17) $pass = GUICtrlCreateInput("", 112, 48, 121, 21) $OK = GUICtrlCreateButton("OK", 88, 115, 75, 25, 0) $timelabel = GUICtrlCreateLabel("Secondes :", 16, 84, 79, 17) $time = GuiCtrlCreateInput("5000",112, 80, 121, 21, $ES_NUMBER) GUICtrlSetOnEvent($OK, "OK") GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func OK() WinActivate("Diablo II") If WinExists("Diablo II") = 0 Then MsgBox(0,"GamePermer","Veuillez lancer Diablo II et vous assurez que le titre est bien 'Diablo II'" & @LF & @LF & "Ensuite relancez GamePermer.") If WinExists("Diablo II") = 0 Then Exit WinActivate("Diablo II") If WinActive("Diablo II") = 0 Then MsgBox(0,"GamePermer","Un problème est survenue pendant l'activation de la fenêtre de Diablo II." & @LF & @LF & "Veuillez relancez GamePermer.") WinWaitActive("Diablo II") WinMove("Diablo II","",0,0) If PixelGetColor(154, 133) <> 263172 Then MsgBox(0,"GamePermer","Vous devez être dans le lobby avant de lancer GamePermer." & @LF & @LF & "Allez au lobby et relancez GamePermer.") If PixelGetColor(154, 133) <> 263172 Then Exit Sleep(500) MouseClick("Left",715, 486) Sleep(200) MouseClick("Left",603, 494) Sleep(600) Send(GUICtrlRead($game)) Sleep(300) Send("{TAB}") Sleep(500) Send(GUICtrlRead($pass)) MouseClick("Left",684, 445) Sleep($time) ;<<< The time remaining I want to be displayed. MsgBox(0,"GamePermer","Votre partie est permer de " & $time & " secondes") Exit EndFunc Func about() MsgBox(0,"GamePermer","GamePermer est un programme en AutoIt V3 et à été créé par SiRiUs[WoH] @ USWest." & @LF & "GamePermer 1.0" & @LF & "josnaker@hotmail.com") EndFunc Func close() Exit EndFunc It's in french but i think you can get the point. Can anyone tell me how ? Link to comment Share on other sites More sharing options...
sandin Posted June 11, 2008 Share Posted June 11, 2008 try now: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.11.12 (beta) Author: josnaker Script Function: Perm game in D2. #ce ---------------------------------------------------------------------------- #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> HotKeySet("{ESC}","close") HotKeySet("{HOME}","about") Global $timer1 = False Global $timer #Region ### START Koda GUI section ### Form= Opt("GUIOnEventMode", 1) $title = GUICreate("GamePermer", 260, 150, 193, 125) $gamelabel = GUICtrlCreateLabel("Nom de la Partie :", 16, 18, 88, 17) $game = GUICtrlCreateInput("", 112, 15, 121, 21) $passlabel = GUICtrlCreateLabel("Mot de passe :", 16, 52, 79, 17) $pass = GUICtrlCreateInput("", 112, 48, 121, 21) $OK = GUICtrlCreateButton("OK", 88, 115, 75, 25, 0) $timelabel = GUICtrlCreateLabel("Secondes :", 16, 84, 79, 17) $time = GuiCtrlCreateInput("5000",112, 80, 121, 21, $ES_NUMBER) GUICtrlSetOnEvent($OK, "OK") GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 if $timer1 = true Then $Read_time = GUICtrlRead($time) $passed_time = TimerDiff($timer) $Count_Down = Round(($Read_time-$passed_time)/1000, 0) TrayTip("", "Time left: " & $Count_Down, 10, 1) if $Count_Down <= 0 then TrayTip("", "", 10) $timer1 = False EndIf EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func OK() WinActivate("Diablo II") If WinExists("Diablo II") = 0 Then MsgBox(0,"GamePermer","Veuillez lancer Diablo II et vous assurez que le titre est bien 'Diablo II'" & @LF & @LF & "Ensuite relancez GamePermer.") If WinExists("Diablo II") = 0 Then Exit WinActivate("Diablo II") If WinActive("Diablo II") = 0 Then MsgBox(0,"GamePermer","Un problème est survenue pendant l'activation de la fenêtre de Diablo II." & @LF & @LF & "Veuillez relancez GamePermer.") WinWaitActive("Diablo II") WinMove("Diablo II","",0,0) If PixelGetColor(154, 133) <> 263172 Then MsgBox(0,"GamePermer","Vous devez être dans le lobby avant de lancer GamePermer." & @LF & @LF & "Allez au lobby et relancez GamePermer.") If PixelGetColor(154, 133) <> 263172 Then Exit Sleep(500) MouseClick("Left",715, 486) Sleep(200) MouseClick("Left",603, 494) Sleep(600) Send(GUICtrlRead($game)) Sleep(300) Send("{TAB}") Sleep(500) Send(GUICtrlRead($pass)) MouseClick("Left",684, 445) $timer = TimerInit() $timer1 = true Sleep($time) ;<<< The time remaining I want to be displayed. MsgBox(0,"GamePermer","Votre partie est permer de " & $time & " secondes") Exit EndFunc Func about() MsgBox(0,"GamePermer","GamePermer est un programme en AutoIt V3 et à été créé par SiRiUs[WoH] @ USWest." & @LF & "GamePermer 1.0" & @LF & "josnaker@hotmail.com") EndFunc Func close() Exit EndFunc Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
josnaker Posted June 11, 2008 Author Share Posted June 11, 2008 (edited) Thanks sandin for the answer but I tried and it send the msgbox when it make a game with 9 secondI.E.Votre partie est permer de 9 secondes.I think thats almost this and i'll try to fix it but if someone have an idea that would be niceThanks again sandin.Edit : What I want it to do is simply display the time left before the time in the $time variable is at 0 (zero)I don't know if you understand what I mean. Edited June 11, 2008 by josnaker Link to comment Share on other sites More sharing options...
sandin Posted June 11, 2008 Share Posted June 11, 2008 basicly this is the only thing I've changed: expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}","close") HotKeySet("{HOME}","about") Global $timer1 = False Global $timer Opt("GUIOnEventMode", 1) $title = GUICreate("GamePermer", 260, 150, 193, 125) $gamelabel = GUICtrlCreateLabel("Nom de la Partie :", 16, 18, 88, 17) $game = GUICtrlCreateInput("", 112, 15, 121, 21) $passlabel = GUICtrlCreateLabel("Mot de passe :", 16, 52, 79, 17) $pass = GUICtrlCreateInput("", 112, 48, 121, 21) $OK = GUICtrlCreateButton("OK", 88, 115, 75, 25, 0) $timelabel = GUICtrlCreateLabel("Secondes :", 16, 84, 79, 17) $time = GuiCtrlCreateInput("5000",112, 80, 121, 21, $ES_NUMBER) GUICtrlSetOnEvent($OK, "OK") GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUISetState(@SW_SHOW) While 1 if $timer1 = true Then $Read_time = GUICtrlRead($time) $passed_time = TimerDiff($timer) $Count_Down = Round(($Read_time-$passed_time)/1000, 0) TrayTip("", "Time left: " & $Count_Down, 10, 1) if $Count_Down <= 0 then TrayTip("", "", 10) $timer1 = False EndIf EndIf Sleep(10) WEnd Func OK() $timer = TimerInit() $timer1 = true Sleep($time) ;<<< The time remaining I want to be displayed. EndFunc Func about() MsgBox(0,"GamePermer","GamePermer est un programme en AutoIt V3 et à été créé par SiRiUs[WoH] @ USWest." & @LF & "GamePermer 1.0" & @LF & "josnaker@hotmail.com") EndFunc Func close() Exit EndFunc Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll 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