Jump to content

Not running the corect .exe, why?


lolp1
 Share

Recommended Posts

Hello, I belive this is running the wrong .exe for some odd reason.

I am trying to make a small tool to log on to my diablo II account for me, this is what I am using:

;====================================================================================
;  .ini reading! 
;====================================================================================
$d2exec = IniRead("global.ini", "Global", "D2Exec", ""); 
$d2path = IniRead("dclone.ini", "Global", "D2Path", "");
$account = IniRead("dclone.ini", "Global", "Account", "");
$password = IniRead("dclone.ini", "Global", "Password", "");
$charpos = IniRead("dclone.ini", "Global", "CharPos", "");

;====================================================================================
;  Define specified mouse usage
;====================================================================================
Func MyClick($button, $x, $y);
MouseMove($x, $y, Random(1, 3));
If $button = "left" then;
    MouseClick("left");
    Else;
    MouseClick("right");
EndIf;
EndFunc;

;====================================================================================
;  Load and login to Diablo II screens
;====================================================================================
Func StartDia();
Run($d2exec, $d2path);
;WinActivate("D2Loader v1.11b - Build On Nov 11 2005");
WinWaitActive("D2Loader v1.11b - Build On Nov 11 2005");
Sleep(200)
WinMove("D2Loader v1.11b - Build On Nov 11 2005", "", -1, -1);
Sleep(200);
Endfunc;

;====================================================================================
;  Log in to your account
;====================================================================================

Func Login();

MouseClick("left", 404,382);
MouseClick("left", 404,382);
$loginscreen = PixelGetColor(325,354);
While $loginscreen <> 1024;
;6535902
    Sleep(100);
    $loginscreen = PixelGetColor(325,354);
    Wend;
MouseClick("left", 483,364);
MouseClick("left", 483,364);
Send($account);
Sleep(600);
Send("{TAB}");
Sleep(500);
Send($password);
Sleep(1000);
Send("{ENTER}");

EndFunc

;====================================================================================
;  Choose your charechter
;====================================================================================


Func ChooseChar();
$charscreen = PixelGetColor( 725,366);
While $charscreen <> 16766810;
    Sleep(1500);
    $charscreen = PixelGetColor( 725,366);
    Wend;
If $charpos = "1" then;
    MouseClick("left", 190,170);
    MouseClick("left", 190,170);
        ElseIf $charpos = "2" then;
        MouseClick("left", 445,170);
        MouseClick("left", 445,170);
            ElseIf $charpos = "3" then;
            MouseClick("left", 190,245);
            MouseClick("left", 190,245);
                ElseIf $charpos = "4" then;
                MouseClick("left", 445,245);
                MouseClick("left", 445,245);
    ElseIf $charpos = "5" then;
    MouseClick("left", 190,351);
    MouseClick("left", 190,351);
        ElseIf $charpos = "6" then;
        MouseClick("left", 445,351);
        MouseClick("left", 445,351);
            ElseIf $charpos = "7" then;
            MouseClick("left", 190,437);
            MouseClick("left", 190,437);
                ElseIf $charpos = "8" then;
                MouseClick("left", 445,437);
                MouseClick("left", 445,437);
endif;
Sleep(200);
EndFunc;
;====================================================================================
;  Call funcs
;====================================================================================

StartDia()
Sleep(100)
LogIn()
Sleep(100)
ChooseChar()

My .ini is:

[global]

[global]
d2exec= "C:\Program Files\Diablo II\Diablo II.exe" -w
d2path= "C:\Program Files\Diablo II\
account=    
password=   
charpos= 1

For some reason, it seems to load diablo II, but it does not load it correctly. I don't know what is happening, but I don't think it is loading the right path, it loads Diablo II, but says my Version is invalid. How ever when I run the .exe ("C:\Program Files\Diablo II\Diablo II.exe" -w) From the path ("C:\Program Files\Diablo II\) it works fine, any idea?

Link to comment
Share on other sites

typo on the ini read...

;====================================================================================
;  .ini reading!
;====================================================================================
$d2exec = IniRead("global.ini"<<<<  TYPO  <<<<<<<<<<<<<<<<<, "Global", "D2Exec", "");
$d2path = IniRead("dclone.ini", "Global", "D2Path", "");
$account = IniRead("dclone.ini", "Global", "Account", "");
$password = IniRead("dclone.ini", "Global", "Password", "");
$charpos = IniRead("dclone.ini", "Global", "CharPos", "");

goodluck

Link to comment
Share on other sites

Problem solved. I don't really know what is changed, but when I mov it in my diablo II directory, it works, but not when it is out. Since I like to under-stand how all my code works, if someone can explain why I would apperciate it.

EDIT:

;====================================================================================
;  .ini reading!
;====================================================================================
$d2exec = IniRead("global.ini"<<<<  TYPO  <<<<<<<<<<<<<<<<<, "Global", "D2Exec", "");
$d2path = IniRead("dclone.ini", "Global", "D2Path", "");
$account = IniRead("dclone.ini", "Global", "Account", "");
$password = IniRead("dclone.ini", "Global", "Password", "");
$charpos = IniRead("dclone.ini", "Global", "CharPos", "");

That is not a typo.

Edited by lolp1
Link to comment
Share on other sites

;====================================================================================
;  .ini reading!
;====================================================================================
$d2exec = IniRead("global.ini", "Global", "D2Exec", "");
$d2path = IniRead("dclone.ini", "Global", "D2Path", "");
$switches = IniRead ( "dclone.ini", "Global", "Switches", "");
$account = IniRead("dclone.ini", "Global", "Account", "");
$password = IniRead("dclone.ini", "Global", "Password", "");
$charpos = IniRead("dclone.ini", "Global", "CharPos", "");

;====================================================================================
;  Define specified mouse usage
;====================================================================================
Func MyClick($button, $x, $y);
MouseMove($x, $y, Random(1, 3));
If $button = "left" then;
    MouseClick("left");
    Else;
    MouseClick("right");
EndIf;
EndFunc;

;====================================================================================
;  Load and login to Diablo II screens
;====================================================================================
Func StartDia();
Run($d2path & $d2exec & " " & $switches, $d2path);
;WinActivate("D2Loader v1.11b - Build On Nov 11 2005");
WinWaitActive("D2Loader v1.11b - Build On Nov 11 2005");
Sleep(200)
WinMove("D2Loader v1.11b - Build On Nov 11 2005", "", -1, -1);
Sleep(200);
Endfunc;

;====================================================================================
;  Log in to your account
;=================================

Func Login();

MouseClick("left", 404,382);
MouseClick("left", 404,382);
$loginscreen = PixelGetColor(325,354);
While $loginscreen <> 1024;
;6535902
    Sleep(100);
    $loginscreen = PixelGetColor(325,354);
    Wend;
MouseClick("left", 483,364);
MouseClick("left", 483,364);
Send($account);
Sleep(600);
Send("{TAB}");
Sleep(500);
Send($password);
Sleep(1000);
Send("{ENTER}");

EndFunc

;====================================================================================
;  Choose your charechter
;====================================================================================


Func ChooseChar();
$charscreen = PixelGetColor( 725,366);
While $charscreen <> 16766810;
    Sleep(1500);
    $charscreen = PixelGetColor( 725,366);
    Wend;
If $charpos = "1" then;
    MouseClick("left", 190,170);
    MouseClick("left", 190,170);
        ElseIf $charpos = "2" then;
        MouseClick("left", 445,170);
        MouseClick("left", 445,170);
            ElseIf $charpos = "3" then;
            MouseClick("left", 190,245);
            MouseClick("left", 190,245);
                ElseIf $charpos = "4" then;
                MouseClick("left", 445,245);
                MouseClick("left", 445,245);
    ElseIf $charpos = "5" then;
    MouseClick("left", 190,351);
    MouseClick("left", 190,351);
        ElseIf $charpos = "6" then;
        MouseClick("left", 445,351);
        MouseClick("left", 445,351);
            ElseIf $charpos = "7" then;
            MouseClick("left", 190,437);
            MouseClick("left", 190,437);
                ElseIf $charpos = "8" then;
                MouseClick("left", 445,437);
                MouseClick("left", 445,437);
endif;
Sleep(200);
EndFunc;
;====================================================================================
;  Call funcs
;====================================================================================

StartDia()
Sleep(100)
LogIn()
Sleep(100)
ChooseChar()

[global]
d2exec= "Diablo II.exe"
d2path= "C:\Program Files\Diablo II\"
switches = "-w -ns"
account=     
password=   
charpos= 1
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...