Sign in to follow this  
Followers 0
bvr

Nothing Happening

19 posts in this topic

When I run my script nothing happens, not even an error message?

;Date: September 3rd, 2006
;Software: TradeBot
;Version: 1.0
;Author: Brandon M. Royer
;For: Diablo II LoD patch 1.11

;----Variables
$D2Path = IniRead("Settings.ini", "Global", "D2Path", "")
$D2Exe = IniRead("Settings.ini", "Global", "D2Exe", "")
$D2Parameters = IniRead("Settings.ini", "Global", "D2Parameters", "")
$Account = IniRead(Settings.ini", "Global", "Account", "")
$Password = IniRead(Settings.ini", "Global", "Password", "")
$Character = IniRead(Settings.ini", "Global", "Character", "")
$Message = IniRead(Settings.ini", "Global", "Message", "")

HotKeySet("pause" [, "pause"])

;----Routines----
D2Start()
D2Activate()
D2Login()
D2CharPicker()
ChatRoomMode()
ChatLoop()


;----Delays

;----Loading Diablo II----
Func D2Start()
    Run($D2Path & '\' & $D2Exe & ' ' & $D2Parameters, $D2Path)
    WinWait('Diablo II')
    WinActivate('Diablo II')
    Sleep(500)
    WinMove('Diablo II', '', 0, 0)
    Sleep($D2LoadWait)
EndFunc  ;==>D2Start

;----D2 Activate----
Func D2Activate()
    WinActivate("Diablo II")
    WinMove("Diablo II", "", 0, 0)
EndFunc  ;==>D2Activate

;----Login----
Func D2Login()
    Send("{TAB}")
    Sleep(500)
    Send($Account)
    Sleep(500)
    Send("{TAB}")
    Sleep(500)
    Send($Password)
    Sleep(500)
    Send("{ENTER}")
    Sleep($D2Login)
EndFunc  ;==>D2Login

;----Select Character----
Func D2CharPicker()
    Select
        Case $CharPosition = 1
            Send("{ENTER}")
            
        Case $CharPosition = 2
            Send("{RIGHT}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 3
            Send("{DOWN}")
            Sleep(250)
            Send("{Enter}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 4
            Send("{DOWN}")
            Sleep(250)
            Send("{RIGHT}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 5
            Send("{DOWN}")
            Sleep(250)
            Send("{DOWN}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 6
            Send("{DOWN}")
            Sleep(250)
            Send("{Down}")
            Sleep(250)
            Send("{Right}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 7
            Send("{DOWN}")
            Sleep(250)
            Send("{DOWN}")
            Sleep(250)
            Send("{DOWN}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 8
            Send("{Down}")
            Sleep(250)
            Send("{Down}")
            Sleep(250)
            Send("{Down}")
            Sleep(250)
            Send("{RIGHT}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
    EndSelect
EndFunc  ;==>D2CharPicker

;----Go Into Chat Room
Func ChatRoomMode()
    MouseMove("90, 500)
    Sleep(100)
    MouseClick("left", 90, 500)
    Sleep(5000)
EndFunc  ;==>ChatRoomMode

;----Chat Loop----
While 1
;### Tidy Error: Level error -> "While" Not closed before Func statement.
;### Tidy Error: Level error -> "Func" cannot be inside any IF/Do/While/For/Case/Func statement.
    Func ChatLoop()
        Send(/join LoD Ladder Trading USEast - 1)
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
        Send(/join LoD Ladder Trading USEast - 2
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
        Send(/join LoD Ladder Trading USEast - 3)
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
    EndFunc  ;==>ChatLoop
    WEnd

Share this post


Link to post
Share on other sites



btw, I just fixed the tidy errors, still nothing

Share this post


Link to post
Share on other sites

It's a bug with the Run function when you have a space like 'Program Files' you have to put: Progra~1

C:\Progra~1\Diablo~1\Game.exe


[u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

in the ini or the source? Do I have to rename my game and my folder to that too?

Edited by bmroyer

Share this post


Link to post
Share on other sites

It's a bug with the Run function when you have a space like 'Program Files' you have to put: Progra~1

C:\Progra~1\Diablo~1\Game.exe

Please refrain from claiming a bug when you know not.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

change these

$D2Path = IniRead("Settings.ini", "Global", "D2Path", "")
$D2Exe = IniRead("Settings.ini", "Global", "D2Exe", "")

and see it it works :-)

and this keeps them out of the ini also...never have a error like that.

if ya need I got the old V2 source for syadasti's mephbot :-)

no, I don'tplay D2 anymore but still feeling hooked to it :P

Share this post


Link to post
Share on other sites

its still not workin, btw is this a bug in autoit? I never had this problem with my other bot. I would be interested in the mephbot source, thanks. still trying to get this darn thing to work.

Share this post


Link to post
Share on other sites

Send(/join LoD Ladder Trading USEast - 1)
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
        Send(/join LoD Ladder Trading USEast - 2
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
        Send(/join LoD Ladder Trading USEast - 3)
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

its still not workin, btw is this a bug in autoit? I never had this problem with my other bot. I would be interested in the mephbot source, thanks. still trying to get this darn thing to work.

what do you mean with: Its is still not working ?

How did you fix the shown tidy error ? (maybe update the post with your current code would be helpfull?)

Maybe start doing some debugging to find the reason your script doesn't work ?

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

;Date: September 3rd, 2006
;Software: TradeBot
;Version: 1.0
;Author: Brandon M. Royer
;For: Diablo II LoD patch 1.11

;----Variables
$D2Path = RegRead ( 'HKEY_CURRENT_USER\' & 'Software\Blizzard Entertainment\Diablo II', 'InstallPath' )
$D2Exe = "Diablo II.exe"
$D2Parameters = IniRead("Settings.ini", "Global", "D2Parameters", "")
$Account = IniRead(Settings.ini", "Global", "Account", "")
$Password = IniRead(Settings.ini", "Global", "Password", "")
$Character = IniRead(Settings.ini", "Global", "Character", "")
$Message = IniRead(Settings.ini", "Global", "Message", "")

HotKeySet("pause" [, "pause"])

;----Routines----
D2Start()
D2Activate()
D2Login()
D2CharPicker()
ChatRoomMode()
While 1
ChatLoop()
Wend


;----Delays

;----Loading Diablo II----
Func D2Start()
    Run($D2Path & '\' & $D2Exe & ' ' & $D2Parameters, $D2Path)
    WinWait('Diablo II')
    WinActivate('Diablo II')
    Sleep(500)
    WinMove('Diablo II', '', 0, 0)
    Sleep($D2LoadWait)
EndFunc  ;==>D2Start

;----D2 Activate----
Func D2Activate()
    WinActivate("Diablo II")
    WinMove("Diablo II", "", 0, 0)
EndFunc  ;==>D2Activate

;----Login----
Func D2Login()
    Send("{TAB}")
    Sleep(500)
    Send($Account)
    Sleep(500)
    Send("{TAB}")
    Sleep(500)
    Send($Password)
    Sleep(500)
    Send("{ENTER}")
    Sleep($D2Login)
EndFunc  ;==>D2Login

;----Select Character----
Func D2CharPicker()
    Select
        Case $CharPosition = 1
            Send("{ENTER}")
            
        Case $CharPosition = 2
            Send("{RIGHT}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 3
            Send("{DOWN}")
            Sleep(250)
            Send("{Enter}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 4
            Send("{DOWN}")
            Sleep(250)
            Send("{RIGHT}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 5
            Send("{DOWN}")
            Sleep(250)
            Send("{DOWN}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 6
            Send("{DOWN}")
            Sleep(250)
            Send("{Down}")
            Sleep(250)
            Send("{Right}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 7
            Send("{DOWN}")
            Sleep(250)
            Send("{DOWN}")
            Sleep(250)
            Send("{DOWN}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 8
            Send("{Down}")
            Sleep(250)
            Send("{Down}")
            Sleep(250)
            Send("{Down}")
            Sleep(250)
            Send("{RIGHT}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
    EndSelect
EndFunc  ;==>D2CharPicker

;----Go Into Chat Room
Func ChatRoomMode()
    MouseMove("90, 500)
    Sleep(100)
    MouseClick("left", 90, 500)
    Sleep(5000)
EndFunc  ;==>ChatRoomMode

;----Chat Loop----
    Func ChatLoop()
        Send(/join LoD Ladder Trading USEast - 1)
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
        Send(/join LoD Ladder Trading USEast - 2
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
        Send(/join LoD Ladder Trading USEast - 3)
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
    EndFunc  ;==>ChatLoop

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

When I put your code into scite, I immediately saw that there were many missing quotes. Here is the fixed code.

;Date: September 3rd, 2006
;Software: TradeBot
;Version: 1.0
;Author: Brandon M. Royer
;For: Diablo II LoD patch 1.11

;----Variables
$D2Path = RegRead ( 'HKEY_CURRENT_USER\' & 'Software\Blizzard Entertainment\Diablo II', 'InstallPath' )
$D2Exe = "Diablo II.exe"
$D2Parameters = IniRead("Settings.ini", "Global", "D2Parameters", "")
$Account = IniRead("Settings.ini", "Global", "Account", "")
$Password = IniRead("Settings.ini", "Global", "Password", "")
$Character = IniRead("Settings.ini", "Global", "Character", "")
$Message = IniRead("Settings.ini", "Global", "Message", "")

HotKeySet ("pause", "pause")

;----Routines----
D2Start()
D2Activate()
D2Login()
D2CharPicker()
ChatRoomMode()
While 1
ChatLoop()
Wend


;----Delays

;----Loading Diablo II----
Func D2Start()
    Run($D2Path & '\' & $D2Exe & ' ' & $D2Parameters, $D2Path)
    WinWait('Diablo II')
    WinActivate('Diablo II')
    Sleep(500)
    WinMove('Diablo II', '', 0, 0)
    Sleep($D2LoadWait)
EndFunc  ;==>D2Start

;----D2 Activate----
Func D2Activate()
    WinActivate("Diablo II")
    WinMove("Diablo II", "", 0, 0)
EndFunc  ;==>D2Activate

;----Login----
Func D2Login()
    Send("{TAB}")
    Sleep(500)
    Send($Account)
    Sleep(500)
    Send("{TAB}")
    Sleep(500)
    Send($Password)
    Sleep(500)
    Send("{ENTER}")
    Sleep($D2Login)
EndFunc  ;==>D2Login

;----Select Character----
Func D2CharPicker()
    Select
        Case $CharPosition = 1
            Send("{ENTER}")
            
        Case $CharPosition = 2
            Send("{RIGHT}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 3
            Send("{DOWN}")
            Sleep(250)
            Send("{Enter}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 4
            Send("{DOWN}")
            Sleep(250)
            Send("{RIGHT}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 5
            Send("{DOWN}")
            Sleep(250)
            Send("{DOWN}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 6
            Send("{DOWN}")
            Sleep(250)
            Send("{Down}")
            Sleep(250)
            Send("{Right}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 7
            Send("{DOWN}")
            Sleep(250)
            Send("{DOWN}")
            Sleep(250)
            Send("{DOWN}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
            
        Case $CharPosition = 8
            Send("{Down}")
            Sleep(250)
            Send("{Down}")
            Sleep(250)
            Send("{Down}")
            Sleep(250)
            Send("{RIGHT}")
            Sleep(250)
            Send("{ENTER}")
            Sleep($D2CharSelect)
    EndSelect
EndFunc  ;==>D2CharPicker

;----Go Into Chat Room
Func ChatRoomMode()
    MouseMove(90, 500)
    Sleep(100)
    MouseClick("left", 90, 500)
    Sleep(5000)
EndFunc  ;==>ChatRoomMode

;----Chat Loop----
    Func ChatLoop()
        Send("/join LoD Ladder Trading USEast - 1")
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
        Send("/join LoD Ladder Trading USEast - 2")
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
        Send("/join LoD Ladder Trading USEast - 3")
        Sleep(5000)
        Send($Message)
        Sleep(30000)
        Send($Message)
        Sleep(30000)
    EndFunc  ;==>ChatLoop

after fixing the quotes and testing it I saw that there is no pause function for the pause hotkey. add one.

edit: Upon adding a dummy pause function the script appears to work fine. It tries to run diablo (but gives me an error since my disc isn't in). I don't know if it is all working past that.

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

how do I get the hotkey "pause" to pause the script? Its starting to show errors again so that part is fixed. Why wasn't it showing me errors before when I try to exucute it?

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I have no idea why it was showing errors before, sorry.

A pause function should be as simple as this:

$Paused = 0

Func Pause ( )
   HotKeySet ( "{pause}", "Unpause" )
   $Paused = 1
   While $Paused
      Sleep ( 1 )
   WEnd
EndFunc

Func Unpause ( )
   HotKeySet ( "{pause}", "Pause" )
   $Paused = 0
EndFunc

No gurantees though. I am a little dusty in my scripting.

You need the "$Paused = 0" thing at the very start of your script. The functions can go anywhere.

EDIT: After further inspection of your script you need to change the line that makes the Pause Hotkey also. Modify it so instead of saying "HotKeySet ( 'pause', 'pause' )" it says "HotKeySet ( '{pause}', 'pause' )"

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

how do I get the hotkey "pause" to pause the script? Its starting to show errors again so that part is fixed. Why wasn't it showing me errors before when I try to exucute it?

Open the helpfile on HotKeySet() and look at the example.... should be close.

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

This works perfectly, it pauses and exits. Only problem is that the script does not run now, it just idles.

I have no idea why it was showing errors before, sorry.

A pause function should be as simple as this:

$Paused = 0

Func Pause ( )
   HotKeySet ( "{pause}", "Unpause" )
   $Paused = 1
   While $Paused
      Sleep ( 1 )
   WEnd
EndFunc

Func Unpause ( )
   HotKeySet ( "{pause}", "Pause" )
   $Paused = 0
EndFunc

No gurantees though. I am a little dusty in my scripting.

You need the "$Paused = 0" thing at the very start of your script. The functions can go anywhere.

EDIT: After further inspection of your script you need to change the line that makes the Pause Hotkey also. Modify it so instead of saying "HotKeySet ( 'pause', 'pause' )" it says "HotKeySet ( '{pause}', 'pause' )"

Share this post


Link to post
Share on other sites

nevermind, I had the code in the wrong place, I had it above the script routines in order, works fine now, thanks everyone! Now I just gotta figure out how to know if someone whispers you, then take a screenshot and put the picture in the screenshots folder in the program folder. I will try it tomarrow, if I need help I'll post here. Thanks everyone.

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

try this if you want its very easy to use.

include it, define the account, password, character slot.

after this load d2 and to go to the chat its simple:

Screen_GoTo( $screenCHAT )

and ur there

#include <ARRAY.au3>

global $Char_Mode;forget this one 
global $Char_Account = "Your account"
global $Char_Password = "Your Password"
global $char_slot = 1-8
;1 2
;3 4
;5 6
;7 8
#cs
each screen can have a subscreen. here is a list of the screens with theyre subs and values
    0 = Unknown/not loaded TODO
        sub: 0=unknown screen (most likely black screen or something) 1=d2 not loaded
    1 = Splash screen (on load)
        sub: 0=none
    2 = Main Menu
        sub: 0=none 1=waitscreen (on connection to bnet)
    3 = BattleNet Logon
        sub: 0=none 1=waitscreen (after login)
    4 = Character selection (used for single player too, switch on the game type the user want here)
        sub: 0=none 1=waitscreen (after selecting char) 2=character expired 3=delete char confirmation
    5 = lobby
        sub: 0=none 1=loading 2=create game 3=join game 4=ladder
    6 = chat (can't really do this as lobby subscreen since I dont plan to add the possibility to put 2 subscreen's for 1 screen)
        sub: 0=none 1=loading 2=create game 3=join game 4=ladder 5=channel list
;NOT YET IMPLEMENTED
        screen 0, sub's charselect (waitscreen) chat/lobby (loading)
#ce

#region OOG

;===================================================================================
; SCREEN DECLARATION 
;===================================================================================
; note that step is static (5)
global const $screenNOTLOADED=0, $screenSPLASH=1, $screenMAIN=2, $screenBNETLOGON=3 _
            , $screenCHARSELECT=4, $screenLOBBY=5, $screenCHAT=6;
global $currSCREEN = 0;default not loaded (0 1)

global $sumSPLASH = _ArrayCreate ( 100 , 300 , 600 , 500 ,   1149457517 ), $sumMAIN = _ArrayCreate ( 5 , 5 , 65 , 588 ,  3398165054 ) _
        ,$sumBNETLOGON = _ArrayCreate ( 145 , 5 , 173 , 589 ,    2362940737 ), $sumCHARSELECT = _ArrayCreate ( 175 , 540 , 597 , 592 ,  2157612680 ) _
        ,$sumLOBBY = _ArrayCreate ( 25 , 450 , 234 , 460 ,   1944078855 ), $sumCHAT = _ArrayCreate ( 25 , 450 , 234 , 460 ,  4236653413 );
        
;sub arrays [ name, top, left, right, bottom, sum, repeat ]
;todo: Logon WaitScreen -> fix 
;todo: Char Expired -> fix box is the same as waitscreen
;todo: Loading screen does not work because its not from mother screen 5-6
global $subMAIN = _ArrayCreate( "WaitScreen" ,202 , 373 , 263 , 463 , 4286847345  ) ,$subBNETLOGON = _ArrayCreate( "WaitScreen",251 , 241 , 317 , 338 , 1881148817) _;
        ,$subCHARSELECT = _ArrayCreate( "WaitScreen", 331 , 300  , 372 , 338 , 2645038219 , "CharacterExpired", 331 , 300  , 372 , 338 , 2645038219, "CharacterDeleteConfirm", 358 , 304 , 425 , 335 , 2742100244 ) _
        ,$subLOBBY[24] =  ["Loading Game", 20 , 20 , 721 , 200 , 393217 , "CreateGame", 718 , 152 , 764 , 304 ,   1436639483 , "JoinGame", 546 , 135 , 742 , 164 , 155077074 , "Ladder", 438 , 132 , 481 , 354 ,  341223979 ] _
        ,$subCHAT[30] = [ "Loading Game", 20 , 20 , 721 , 200 , 393217 , "CreateGame", 718 , 152 , 764 , 304 ,   1436639483, "JoinGame", 546 , 135 , 742 , 164 , 155077074 , "Ladder", 438 , 132 , 481 , 354 ,  341223979 , "ChanList", 669 , 150 , 721 , 288 , 154739165 ]

;===================================================================================
; SCREEN FUNCTIONS
;===================================================================================

;===============================================================
; function Screen_GetCurrent( ByRef $Screen, ByRef $sub )
; will return the current screen and it's sub screen (note that sub values always need to be checked against theyre "mother screen"
; $Screen = variable to hold value of current screen
; $Sub = variable to hold value of current sub
;===============================================================
func Screen_GetCurrent(ByRef $Screen, ByRef $sub)
    Select
        
;splash screen detected
        case PixelChecksum( $sumSPLASH[0], $sumSPLASH[1], $sumSPLASH[2], $sumSPLASH[3], 5 ) == $sumSPLASH[4]
        $screen = $screenSPLASH
        $sub = 0;no subscreen here
        
;main screen detected (bnet, single, other multi)
        case PixelChecksum( $sumMAIN[0], $sumMAIN[1], $sumMAIN[2], $sumMAIN[3], 5 ) == $sumMAIN[4]
        $screen = $screenMAIN
        if PixelChecksum( $subMAIN[1], $subMAIN[2], $subMAIN[3], $subMAIN[4], 5 ) ==$subMAIN[5] then 
            $sub = 1
        Else
            $sub = 0
        EndIf
        
;bnet logon
        case PixelChecksum( $sumBNETLOGON[0], $sumBNETLOGON[1], $sumBNETLOGON[2], $sumBNETLOGON[3], 5 ) == $sumBNETLOGON[4]
        $screen = $screenBNETLOGON
        if PixelChecksum( $subBNETLOGON[1], $subBNETLOGON[2], $subBNETLOGON[3], $subBNETLOGON[4], 5 ) == $subBNETLOGON[5] then 
    ;wait screen not yet available
            $sub = 1
        else 
            $sub = 0
        EndIf
        
;character selection
        case PixelChecksum( $sumCHARSELECT[0], $sumCHARSELECT[1], $sumCHARSELECT[2], $sumCHARSELECT[3], 5 ) == $sumCHARSELECT[4]
        $screen = $screenCHARSELECT
        Select
    ;wait screen
            case PixelChecksum( $subCHARSELECT[1], $subCHARSELECT[2], $subCHARSELECT[3], $subCHARSELECT[4], 5 ) == $subCHARSELECT[5]
                $sub = 1
    ;char expired
            case PixelChecksum( $subCHARSELECT[7], $subCHARSELECT[8], $subCHARSELECT[9], $subCHARSELECT[10], 5 ) == $subCHARSELECT[11]
                $sub = 2
    ;char delete confirm
            case PixelChecksum( $subCHARSELECT[13], $subCHARSELECT[14], $subCHARSELECT[15], $subCHARSELECT[16], 5 ) == $subCHARSELECT[17]   
                $sub = 3            
            case Else
                $sub = 0
        EndSelect
        
;bnet lobby
        case PixelChecksum( $sumLOBBY[0], $sumLOBBY[1], $sumLOBBY[2], $sumLOBBY[3], 5 ) == $sumLOBBY[4]
        $screen = $screenLOBBY
        select 
            case PixelChecksum( $subLOBBY[1], $subLOBBY[2], $subLOBBY[3], $subLOBBY[4], 5 ) == $subLOBBY[5];wait
                $sub = 1
            case PixelChecksum( $subLOBBY[7], $subLOBBY[8], $subLOBBY[9], $subLOBBY[10], 5 ) == $subLOBBY[11];create
                $sub = 2
            case PixelChecksum( $subLOBBY[13], $subLOBBY[14], $subLOBBY[15], $subLOBBY[16], 5 ) == $subLOBBY[17];join
                $sub = 3
            case PixelChecksum( $subLOBBY[19], $subLOBBY[20], $subLOBBY[21], $subLOBBY[22], 5 ) == $subLOBBY[23]; ladder
                $sub = 4
            case Else
                $sub = 0
        EndSelect
        
;bnet chat
        case PixelChecksum( $sumCHAT[0], $sumCHAT[1], $sumCHAT[2], $sumCHAT[3], 5 ) == $sumCHAT[4]
            $screen = $screenCHAT
            select 
                case PixelChecksum( $subLOBBY[1], $subLOBBY[2], $subLOBBY[3], $subLOBBY[4], 5 ) == $subLOBBY[5];wait
                    $sub = 1
                case PixelChecksum( $subLOBBY[7], $subLOBBY[8], $subLOBBY[9], $subLOBBY[10], 5 ) == $subLOBBY[11];create
                    $sub = 2
                case PixelChecksum( $subLOBBY[13], $subLOBBY[14], $subLOBBY[15], $subLOBBY[16], 5 ) == $subLOBBY[17];join
                    $sub = 3
                case PixelChecksum( $subLOBBY[19], $subLOBBY[20], $subLOBBY[21], $subLOBBY[22], 5 ) == $subLOBBY[23]; ladder
                    $sub = 4
                case PixelChecksum( $subCHAT[25], $subCHAT[26], $subCHAT[27], $subCHAT[28], 5 ) == $subCHAT[29]; channel list
                    $sub = 5
                case Else
                    $sub = 0
            EndSelect
        case Else
    ;todo check if d2 loaded return 0 if not
            $screen = 0
            $sub = -1;TODO
    EndSelect
EndFunc

;===============================================================
; function Screen_GoTo ( $Screen, [$Sub] )
; $Screen = the screen to go to
; $Sub (optional) = the sub screen to go to ($screenLOBBY and $screenCHAT ONLY)
;===============================================================
func Screen_GoTo( $Screen, $Sub = 0 )
    global $OOG_Timeout = 30000, $OOG_ScreenLoadDelay = 600
    local $ptrSCREEN, $ptrSUB, $Timer=TimerStart(), $LAstScreen = -1
    Screen_GetCurrent( $ptrSCREEN, $ptrSUB )
    while $ptrSCREEN <> $Screen         
        if TimerDiff( $Timer ) > $OOG_Timeout then return false
        sleep ( $OOG_ScreenLoadDelay )
        Screen_GetCurrent( $ptrSCREEN, $ptrSUB )
        if $ptrSUB == 1 or $LAstScreen == $ptrSCREEN Then
            Sleep( $OOG_ScreenLoadDelay )
            ContinueLoop
        EndIf
        switch  $ptrSCREEN
        case 0
    ;TODO
            MsgBox(0, "", "Screen 0 not implemented" )
            return 0
    ;sub=0 then sleep
    ;sub=1 thenload d2
        case 1
    ;TODO
            MsgBox(0, "", "Screen 1 not implemented" )
            return 0
        ;sleep (SplashScreenDelay)
        ;click
            case 2
                switch StringLower( $Char_Mode )
                case "single"
            ;TODO press single button
                case "battle"
                    tempCLICK( 379, 350 )
                case "seq"
            ;TODO is this supported by OOG? I dont think so.
                endswitch
        ;if single player go there check for screen here and continue loop (dont forget to check single in screen 4 also)
            case 3
                tempCLICK( 472, 334 )
                Sleep( $OOG_ScreenLoadDelay )
                for $i = 0 to 20
                    Send( "{BACKSPACE}" )
                    Sleep(20)
                Next
                send( $Char_Account )
                Sleep( $OOG_ScreenLoadDelay )
                Send ( "{TAB}" )
                Sleep( $OOG_ScreenLoadDelay )
                Send( $Char_Password )
                Sleep( $OOG_ScreenLoadDelay )
                Send ( "{ENTER}" )
            case 4
                if $char_slot == 2 or $char_slot == 4 or $char_slot == 6 or $char_slot == 8 then 
                    send( "{RIGHT}" ) 
                    Sleep(1000)
                EndIf
                if $Char_Slot == 3 or $Char_Slot == 4 then 
                    Send( "{DOWN}" )
                    Sleep(1000)
                EndIf
                if $Char_Slot == 5 or $Char_Slot == 6 then 
                    Send( "{DOWN}" )
                    Sleep(1000)
                EndIf
                if $Char_Slot == 7 or $char_slot == 8 then 
                    Send( "{DOWN}" )
                    Sleep(1000)
                EndIf
                Send("{ENTER}")
                Sleep( $OOG_ScreenLoadDelay )
            case 5
                if $screen == $screenCHAT then 
                    tempCLICK( 85, 467 )
                EndIf
            case 6
        ;not needed for now.
        endswitch
        $LAstScreen = $ptrSCREEN
        MouseMove( 800,0, 1 )
        sleep ( $OOG_ScreenLoadDelay )
    WEnd
    if $sub > 0 and $sub <> $ptrSUB then 
        if $screen <> $screenLOBBY and $screen <> $screenCHAT or ( $screen == $screenLOBBY and $sub == 5 ) then 
            return 0
        EndIf
        Screen_GetCurrent( $ptrSCREEN, $ptrSUB )
        if $ptrSCREEN <> $screenLOBBY and $ptrSCREEN <> $screenCHAT then 
            return 0
        EndIf
    EndIf
    while $sub > 0 and $sub <> $ptrSUB
        if TimerDiff( $Timer ) > $OOG_Timeout then 
            msgbox ( 0, "", "TIMEOUT" )
            return 0
        EndIf
        switch $Sub
        case 2
            tempCLICK( 586, 454 )
        case 3
            tempCLICK( 675, 457 )
        case 4
            tempCLICK( 642, 479 )
        case 5
            tempCLICK( 564, 478 )
        endswitch
        Sleep( $OOG_ScreenLoadDelay )
    WEnd
    TimerStop( $timer )
    return 1
EndFunc
func tempCLICK( $x, $y, $speed = 5 )
    MouseMove( $x, $y, 5 )
    Sleep(500)
    MouseDown( "Left" )
    Sleep(30)
    MouseUp( "Left" )
EndFunc
#endregion
Edited by ramadash

Share this post


Link to post
Share on other sites

damn thats complicated

Share this post


Link to post
Share on other sites

not really, you dont need to understand what it does, all you need to do is Screen_GoTo( $screenCHAT ), really, 1 line to get you there :P

anyway Ive forget to tell you, but if you try this you need to set the following options:

Opt( "CaretCoordMode", 2 )

Opt( "ColorMode" , 1 )

Opt( "MouseCoordMode, 2 )

Opt( "PixelCoordMode, 2 )

but I posted this befor seeing that ur script was working so, its up to you.

Share this post


Link to post
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
Sign in to follow this  
Followers 0