Jump to content

how to detect a game program closing


50trimtsi
 Share

Recommended Posts

Hi, this is my first post. I am a beginner. I hope this hasnt been posted before. I couldnt figure out how to do this or find any info. I am trying to make a script that will auto log me back into my MMO game when I get DC'd during the night. I have written the codes to open program, log me in and set up a shop, but I do not know how to incorporate the ability to make the script continuously monitor that the game is open or closed and then initiate the relog procedure I have written. I know it must be quite simple and probably pixel based, but dont know how to go about doing it. I hope I didnt make this sound more confusing than it should be!! Thanks to anybody that can offer some help :)

Edited by 50trimtsi
Link to comment
Share on other sites

maybie you could try this:

AdlibEnable("adlibfunc", 10)
func adlibfunc ()
    if Not WinExists("your MMO window name") Then
        ;your code for starting your MMO
    EndIf
EndFuncoÝ÷ Úí+ºÚ"µÍYX[XJ    ][ÝÐYX[É][ÝËL
B[ÈYX[È

BZYÝØÙÜÑ^ÝÊ  ][ÝÞ[ÝSSÉÌÎNÜÈ^H[I][ÝÊH[BNÞ[ÝÛÙHÜÝ[È[ÝSSÂQ[Y[[oÝ÷ ÚØ^¢yr¦ºén­¶¬ËajÛ(ã;l±¬­«r¢è(´0¢Èzíèæ§uÚ²}ý¶Èn¶Ø^Ç¥½ë£  È~Øb²+-ʨ|ÃÊ·öºek(§f²n'­+Å©©ì""ìb²Û¢é]éiʺÚ"µÍÌÍÝ[YHH
ÍÙXÈVÌHZ[BÌÍÝ[YH[Y[]

BYX[XJ  ][ÝØYX[É][ÝËL
B[ÈYX[È

BZYÝÚ[^ÝÊ   ][ÝÞ[ÝSSÈÚ[ÝÈ[YI][ÝÊH[BNÞ[ÝÛÙHÜÝ[È[ÝSSÂQ[ÙBBRY[YY    ÌÍÝ[YIÝÉÌÍÝ[YH[ÝÚ]ÈÛÙH[ÝØÜÚ[Ù[[ÈHØ[YH]H
ÙXËBBUÚ[]]J   ][ÝÞ[ÝSSÈÚ[ÝÈ[YI][ÝÊBBBTÙ[
    ][ÝÞÑSTI][ÝÊHÝÈØ^HYHSSÈÚÝÜÈHÜÚ[ÝÈ  ][ÝÞ[ÝHHØÛÛXÝY   ][ÝÈ[ÝØÜÚ[ÛXÚÈ[BBIÌÍÝ[YH[Y[]

HÈÈÙ]ÈH[YBQ[YQ[Y[[
Link to comment
Share on other sites

the only problem about this is that some MMO's say that you got DC inside of the game, and doesn't shut themselves down.

Some games also only have "inGame" popups, and so wont actually create a separate window, In some cases a game will just spit you back out to the login screen with no message at all. I usually just setup a Script to check the Screen every 30-60seconds for a unique symbol or word on the disconnect or login screen.

This Thread has an Example of howto use Pixelchecksum to search the entire screen.AutoIt Forum Link.

Edited by ofLight

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Link to comment
Share on other sites

Wow guys, thanks so much for the detailed and speedy responses, I really appreciate it. The game will say disconnected and then the window and process close down completely. I will look into your examples later tonight and get back to you. Thanks again in advance!!!!

Link to comment
Share on other sites

Ok, well I am trying out the code for process detection...it seems like the easiest by far for what I need.....But its not working and I am not sure what I am doing wrong. After completion, I try to run the script, but nothing happens!! any ideas what might cause this? I dont get any errors, just no running script.I know that the portion I wrote did work until trying to incorporate the process coding. This is where I must have messed up. I am going to post the current code. Not sure how to make it look like urs did in forum tho... Please dont laugh LOL I am a beginner :)

; 2moons Auto Login After Disconnect
AdlibEnable("Adlibfunc", 10)
Func Adlibfunc ()
    if Not ProcessExists("dekaron.exe") Then
        Sleep(200000)
        Run("C:\Program Files\Acclaim\2Moons\minilauncher.exe")
        Sleep(12000)
        MouseClick("Left", 1144,690,1)
        Sleep(100000)
        MouseClick("Left", 558,635,1)
        Sleep(3000)
        MouseClick("Left", 576,786,1)
        Sleep(3000)
        MouseClick("Left", 591,743,1)
        Sleep(3000)
        ControlSend ( "2Moons", "", "", "MyUsername")
        Sleep(3000)
        ControlSend ( "2Moons", "", "", "{TAB}")
        Sleep(2000)
        ControlSend ( "2Moons", "", "", "MyPassword")
        Sleep(2000)
        ControlSend ( "2Moons", "", "", "{ENTER}")
        Sleep(21000)
        MouseClick("Left", 826,81,1)
        Sleep(4000)
        MouseClick("Left", 576,746,1)
        Sleep(120000)
        MouseClick("Left", 1128,753,1)
        Sleep(10000)
        MouseClick("Left", 213,390,1)
        Sleep(3000)
        ControlSend ( "2Moons", "", "", "DarkKnight Discounts")
        Sleep(4000)
        MouseClick("Left", 272,396,1)
        MouseClick("Left", 272,396,1)
        Sleep(2000)
        MouseClick("Left", 996,25,1)
    EndIf
EndFunc
Edited by 50trimtsi
Link to comment
Share on other sites

if that's your full code, ofcourse it will not work, couse it will close automaticly after you launch it, couse it doesn't have infinite loop inside of it to keep it running. Here's an example:

;~ HotKeySet( "{F11}" , "_Start")
;~ HotKeySet( "{F10}" , "_Stop")
Opt("TrayMenuMode", 1)
Opt("WinTitleMatchMode", 2)

$tray_exit = TrayCreateItem("Exit")
Opt("TrayOnEventMode",1)
TrayItemSetOnEvent($tray_exit, "_Exit")
TraySetState()
TrayTip("2Moons auto launcher", "Press F11 to start, or F10 to stop script", 5)

call("_start")

Func Adlibfunc ()
    if Not ProcessExists("dekaron.exe") Then
        Sleep(200000)
        ShellExecute("minilauncher.exe", "", "C:\Program Files\Acclaim\2Moons\")
        Sleep(12000)
        MouseClick("Left", 1144,690,1)
        Sleep(100000)
        MouseClick("Left", 558,635,1)
        Sleep(3000)
        MouseClick("Left", 576,786,1)
        Sleep(3000)
        MouseClick("Left", 591,743,1)
        Sleep(3000)
        ControlSend ( "2Moons", "", "", "MyUsername")
        Sleep(3000)
        ControlSend ( "2Moons", "", "", "{TAB}")
        Sleep(2000)
        ControlSend ( "2Moons", "", "", "MyPassword")
        Sleep(2000)
        ControlSend ( "2Moons", "", "", "{ENTER}")
        Sleep(21000)
        MouseClick("Left", 826,81,1)
        Sleep(4000)
        MouseClick("Left", 576,746,1)
        Sleep(120000)
        MouseClick("Left", 1128,753,1)
        Sleep(10000)
        MouseClick("Left", 213,390,1)
        Sleep(3000)
        ControlSend ( "2Moons", "", "", "DarkKnight Discounts")
        Sleep(4000)
        MouseClick("Left", 272,396,1)
        MouseClick("Left", 272,396,1)
        Sleep(2000)
        MouseClick("Left", 996,25,1)
    EndIf
EndFunc

func _Exit ()
    Exit
EndFunc

func _start ()
    AdlibEnable("Adlibfunc", 10)
    TrayTip("2Moons notice:", "script has been started", 5)
EndFunc

;~ func _stop ()
;~  AdlibDisable()
;~  TrayTip("2Moons notice:", "script has been stopped", 5)
;~ EndFunc

While 1
    Sleep(10)
WEnd
Link to comment
Share on other sites

Thank you very much for taking the time to help me!! It is officially working beautifully. Now I am going to take the time to study your added code and figure out exactly what you wrote and why. This way I can get a much better understanding of things. Thanks again. I REALLY appreciate it. Cant thank you enough!!!! Matt

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