Jump to content

Simple Script.


CStrike
 Share

Recommended Posts

#include<misc.au3>
#include<GUIConstants.au3>
#include<string.au3>

;===============================================================================
;
; Description:   Main Section
; Author(s):      CStrike
; Note(s):       This is currently set to about 500~ damage before it drinks.
;
;===============================================================================

AutoItSetOption("PixelCoordMode", 2)

While 1
   If ProcessExists("Diablo II.exe") = 0 Then
      ExitLoop
   EndIf
   $Color = PixelSearch(70, 394, 70, 395, 0x5C0000)
   If @Error Then
     $Slot = IniRead("HP.ini", "Slot", "CSJuv", "")
      SplashTextOn("", "Created By CStrike [ Status: HP Low ]", 300, 24, 30, 30, 1)
      _BMPK()
   ElseIf NOT @Error Then
      SplashTextOn("", "Created By CStrike [ Status: HP Fine ]", 300, 24, 30, 30, 1)
  EndIf
  Sleep(250)
WEnd
  
;===============================================================================
;
; Description:   _BMPK
; Author(s):      CStrike
; Note(s):       This section Determinds which slot has potions.
;
;===============================================================================

Func _BMPK()

;   { I STILL NEED HELP HERE } ;
    
EndFunc

ok basically what i need help with is i need to set a global type key like um $Slot0, $Slot1, etc.

now what i need it to do is something like this.

Func _BMPK()
$Slot0 = 0
$Slot1 = 0
$Slot2 = 0
$Slot3 = 0
   If WinActive("Diablo II") = 1 Then
        Send("1")
        $Slot0 = +1
        Sleep(300)
    If $Slot0 = 4 Then
        Send("2")
        $Slot1 = +1
        Sleep(300)
    If $Slot1 = 4 Then
        Send("3")
        $Slot2 = +1
        Sleep(300)
    If $Slot2 = 4 Then
        Send("4")
        $Slot3 = +1
        Sleep(300)
    If $Slot4 = 4 Then
        SplashTextOn("", "Out Of Juvs!", 300, 24, 20, 20, 1)
                EndIf
            EndIf
        EndIf
    EndIf
EndIf
Else
    Sleep(1)
EndFunc

So what it needs to do is each time its triggered and presses ("1") it needs to record its been pressed +1 Times. When it has been triggered/pressed four times it has to start pressing ("2") instead of ("1") because the first slot is out of potions.

Each slot can only hold four potions.

but of course that doesn't work but it shows you what I'm trying to do.

Edited by CStrike
Link to comment
Share on other sites

see in the second code box. could you show me an example of how i would fix that.

ive tried this atleast 500 times and i cant seem to get it to work.

Func _BMPK()
$Slot0 = 0
$Slot1 = 0
$Slot2 = 0
$Slot3 = 0
   If WinActive("Diablo II") = 1 Then
        Send("1")
        $Slot0 += 1
        Sleep(300)
    If $Slot0 = 4 Then
        Send("2")
        $Slot1 += 1
        Sleep(300)
    If $Slot1 = 4 Then
        Send("3")
        $Slot2 += 1
        Sleep(300)
    If $Slot2 = 4 Then
        Send("4")
        $Slot3 += 1
        Sleep(300)
    If $Slot4 = 4 Then
        SplashTextOn("", "Out Of Juvs!", 300, 24, 20, 20, 1)
                EndIf
            EndIf
        EndIf
    EndIf
Else
    Sleep(1)
EndIf
EndFunc

Basically at the moment, it drinks the first row of potions but it never starts on the second. Which makes me believe that the counter isnt working right or im doing something horribly wrong.

Edited by CStrike
Link to comment
Share on other sites

$slot0 += 1.

Make sure you define them all at the top of your script (Dim $slot0 = 0, $slot1 = 0....)

I forgot to welcome you to the forums before :) so welcome! :)

EDIT: Every time the function is called, $slot0... is being set back to 0. just define them GLOBALLY (Global rather than Dim) at the top of your script, and you should be able to store those values. :)

Edited by Bert
Link to comment
Share on other sites

heres the full script.

; ------------------------------------------------------------------------------
;
; D2PK BMPK Auto Juver
; Author: CStrike
;
; ------------------------------------------------------------------------------

;===============================================================================
; #includes
;===============================================================================

#include<misc.au3>
#include<GUIConstants.au3>
#include<string.au3>

;===============================================================================
; Defining
;===============================================================================

$Slot0 = 0
$Slot1 = 0
$Slot2 = 0
$Slot3 = 0

;===============================================================================
;
; Description:   Main Section
; Author(s):      CStrike
; Note(s):       This is currently set to about 500~ damage before it drinks.
;
;===============================================================================

AutoItSetOption("PixelCoordMode", 2)

While 1
   If ProcessExists("Diablo II.exe") = 0 Then
      ExitLoop
   EndIf
   $Color = PixelSearch(70, 394, 70, 395, 0x5C0000)
   If @Error Then
     $Slot = IniRead("HP.ini", "Slot", "CSJuv", "")
      SplashTextOn("", "Created By CStrike [ Status: HP Low ]", 300, 24, 30, 30, 1)
      _BMPK()
   ElseIf NOT @Error Then
      SplashTextOn("", "Created By CStrike [ Status: HP Fine ]", 300, 24, 30, 30, 1)
  EndIf
  Sleep(250)
WEnd
  
;===============================================================================
;
; Description:   _BMPK
; Author(s):      CStrike
; Note(s):       This section Determinds which slot has potions.
;
;===============================================================================

Func _BMPK()
   If WinActive("Diablo II") = 1 Then
        Send("1")
        $Slot0 += 1
        Sleep(300)
    If $Slot0 = 4 Then
        Send("2")
        $Slot1 += 1
        Sleep(300)
    If $Slot1 = 4 Then
        Send("3")
        $Slot2 += 1
        Sleep(300)
    If $Slot2 = 4 Then
        Send("4")
        $Slot3 += 1
        Sleep(300)
    If $Slot4 = 4 Then
        SplashTextOn("", "Out Of Juvs!", 300, 24, 20, 20, 1)
                EndIf
            EndIf
        EndIf
    EndIf
Else
    Sleep(1)
EndIf
EndFunc

Thanks for the welcome and thanks for all the help your giving.

Im from New Zealand so were not that far apart.

Ok well, it drinks the first 4 from Slot1, then it drinks the first from Slot2 but it doesnt continue to drink from Slot2 after that.

Edited by CStrike
Link to comment
Share on other sites

Dont worry, its not for normal D2. Its for a BMPK realm (Juvs from akara etc)

; ------------------------------------------------------------------------------
;
; D2PK BMPK Auto Juver
; Author: CStrike
;
; ------------------------------------------------------------------------------

;===============================================================================
; #includes
;===============================================================================

#include<misc.au3>
#include<GUIConstants.au3>
#include<string.au3>

;===============================================================================
; Defining
;===============================================================================

$Slot0 = 0
$Slot1 = 0
$Slot2 = 0
$Slot3 = 0
$Slot4 = 0

;===============================================================================
;
; Description:   Main Section
; Author(s):      CStrike
; Note(s):       This is currently set to about 500~ damage before it drinks.
;
;===============================================================================

AutoItSetOption("PixelCoordMode", 2)

While 1
   If ProcessExists("Diablo II.exe") = 0 Then
      ExitLoop
   EndIf
   $Color = PixelSearch(70, 394, 70, 395, 0x5C0000)
   If @Error Then
     $Slot = IniRead("HP.ini", "Slot", "CSJuv", "")
      SplashTextOn("", "Created By CStrike [ Status: HP Low ]", 300, 24, 30, 30, 1)
      _BMPK()
   ElseIf NOT @Error Then
      SplashTextOn("", "Created By CStrike [ Status: HP Fine ]", 300, 24, 30, 30, 1)
  EndIf
  Sleep(250)
WEnd
  
;===============================================================================
;
; Description:   _BMPK
; Author(s):      CStrike
; Note(s):       This section Determinds which slot has potions.
;
;===============================================================================

Func _BMPK()
   If WinActive("Diablo II") = 1 Then
    If $Slot0 = 4 Then
        _Slot0()
    If $Slot1 = 4 Then
        _Slot1()
    If $Slot2 = 4 Then
        _Slot2()
    If $Slot3 = 4 Then
        _Slot3()
    If $Slot4 = 4 Then
        _Slot4()
Else
    Sleep(1)
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunc

Func _Slot0()
    Send("1")
    $Slot0 += 1
    Sleep(300)
EndFunc

Func _Slot1()
    Send("2")
    $Slot1 += 1
    Sleep(300)
EndFunc

Func _Slot2()
    Send("3")
    $Slot2 += 1
    Sleep(300)
EndFunc

Func _Slot3()
    Send("4")
    $Slot3 += 1
    Sleep(300)
EndFunc

Func _Slot4()
    SplashTextOn("", "Out Of Juvs!", 300, 24, 20, 20, 1)
EndFunc

Theres no error, but i dont think its going to the function because its not pressing "1" or "2" or "3" or "4"

Link to comment
Share on other sites

I dont think that is the problem.

; ------------------------------------------------------------------------------
;
; D2PK BMPK Auto Juver
; Author: CStrike
;
; ------------------------------------------------------------------------------

;===============================================================================
; #includes
;===============================================================================

#include<misc.au3>
#include<GUIConstants.au3>
#include<string.au3>

;===============================================================================
; Defining
;===============================================================================

Global $Slot0 = 0
Global $Slot1 = 0
Global $Slot2 = 0
Global $Slot3 = 0
Global $Slot4 = 0

;===============================================================================
;
; Description:   Main Section
; Author(s):      CStrike
; Note(s):       This is currently set to about 500~ damage before it drinks.
;
;===============================================================================

AutoItSetOption("PixelCoordMode", 2)

While 1
   If ProcessExists("Diablo II.exe") = 0 Then
      ExitLoop
   EndIf
   $Color = PixelSearch(70, 394, 70, 395, 0x5C0000)
   If @Error Then
     $Slot = IniRead("HP.ini", "Slot", "CSJuv", "")
      SplashTextOn("", "Created By CStrike [ Status: HP Low ]", 300, 24, 30, 30, 1)
      _BMPK()
   ElseIf NOT @Error Then
      SplashTextOn("", "Created By CStrike [ Status: HP Fine ]", 300, 24, 30, 30, 1)
  EndIf
  Sleep(250)
WEnd
  
;===============================================================================
;
; Description:   _BMPK
; Author(s):      CStrike
; Note(s):       This section Determinds which slot has potions.
;
;===============================================================================

Func _BMPK()
   If WinActive("Diablo II") = 1 Then
    If $Slot0 = 4 Then
        _Pot0()
    If $Slot1 = 4 Then
        _Pot1()
    If $Slot2 = 4 Then
        _Pot2()
    If $Slot3 = 4 Then
        _Pot3()
    If $Slot4 = 4 Then
        _Pot4()
Else
    Sleep(1)
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunc

Func _Pot0()
    Send("1")
    $Slot0 += 1
    Sleep(300)
EndFunc

Func _Pot1()
    Send("2")
    $Slot1 += 1
    Sleep(300)
EndFunc

Func _Pot2()
    Send("3")
    $Slot2 += 1
    Sleep(300)
EndFunc

Func _Pot3()
    Send("4")
    $Slot3 += 1
    Sleep(300)
EndFunc

Func _Pot4()
    SplashTextOn("", "Out Of Juvs!", 300, 24, 20, 20, 1)
EndFunc

Basically with the function below the If statements do not seem to work.

Func _BMPK()
   If WinActive("Diablo II") = 1 Then
    If $Slot0 = 4 Then
        _Pot0()
    If $Slot1 = 4 Then
        _Pot1()
    If $Slot2 = 4 Then
        _Pot2()
    If $Slot3 = 4 Then
        _Pot3()
    If $Slot4 = 4 Then
        _Pot4()
Else
    Sleep(1)
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunc

When i run it it doesn't go to the

"_Pot1" or "_Pot2" functions etc.

I think ive done something wrong with the functions below.

Func _BMPK()
   If WinActive("Diablo II") = 1 Then
    If $Slot0 = 4 Then
        _Pot0()
    If $Slot1 = 4 Then
        _Pot1()
    If $Slot2 = 4 Then
        _Pot2()
    If $Slot3 = 4 Then
        _Pot3()
    If $Slot4 = 4 Then
        _Pot4()
Else
    Sleep(1)
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunc

Func _Pot0()
    Send("1")
    $Slot0 += 1
    Sleep(300)
EndFunc

Func _Pot1()
    Send("2")
    $Slot1 += 1
    Sleep(300)
EndFunc

Func _Pot2()
    Send("3")
    $Slot2 += 1
    Sleep(300)
EndFunc

Func _Pot3()
    Send("4")
    $Slot3 += 1
    Sleep(300)
EndFunc

Func _Pot4()
    SplashTextOn("", "Out Of Juvs!", 300, 24, 20, 20, 1)
EndFunc
Edited by CStrike
Link to comment
Share on other sites

kinda

Slot0 uses potion slot 1 which is why theres a Send("1")

the potion buttons are "1,2,3,4" which is why theres Send("1"),Send("2"),Send("3"),Send("4")

Basicly when the _BMPK function is called its not moving to the Slot0-5 Functions like its supposed to.

So ultimately what i want is:

When Slot0 (Potion slot 1) = 4, It starts using Slot1 (Potion Slot 2) and when that is = to 4 it moves onto Slot2 (Potion Slot 3) and so on.

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