Sign in to follow this  
Followers 0
vivec45

Please help

3 posts in this topic

#1 ·  Posted (edited)

HotKeySet("!{F1}", "start")
HotKeySet("!{F2}", "getcolor")
HotKeySet("!{F3}", "CloseScript")
HotKeySet("!{F5}", "WinMovee")
HotKeySet("!{F6}", "target")
HotKeySet("!{F7}", "showtarget")

;hostile coords
$hostx = 104
$hostoney = 160
$hosttwoy = 189
$hostthreey = 222
$hostfoury = 263
$hostfivey = 301
$hostsixy = 336
$hostseveny = 372
$target = 0
$targethold = 0

Func setvar(ByRef $var, $value)
    $var = $value
    return $var
EndFunc

Func cast($side)
    ;Cast skill on $side ($side = left or right)
EndFunc

Func tppk($target)
    if $target = 0 Then
        Sleep(1)
     elseif $target = 1 Then
         MouseClick("left", $hostx, $hostoney, 1, 0)

     elseif $target = 2 Then
         MouseClick("left", $hostx, $hosttwoy, 1, 0)

     elseif $target = 3 Then
         MouseClick("left", $hostx, $hostthreey, 1, 0)

     elseif $target = 4 Then
         MouseClick("left", $hostx, $hostfoury, 1, 0)

     elseif $target = 5 Then
         MouseClick("left", $hostx, $hostfivey, 1, 0)
         
     elseif $target = 6 Then
         MouseClick("left", $hostx, $hostsixy, 1, 0)
         
     elseif $target = 7 Then
         MouseClick("left", $hostx, $hostseveny, 1, 0)
     EndIf
EndFunc

Func WinMovee()
    WinMove("Diablo II", "", 0, 0)
EndFunc

Func getcolor()
    $color = PixelGetColor(347, 162)
    MsgBox( 0, "Return Color", "Color: " & $color )
EndFunc

Func CloseScript()
Exit
EndFunc

Func start()
    Send("{p}")
    tppk($targethold)
EndFunc

Func target()
$target = InputBox("Set hostile target", "Enter a target (1-7): ", "", "", "", "", "", "", 0)
if $target = "" OR $target = 0 OR $target > 7 Then
    Sleep(1)
Else
    ToolTip("Current target: " & $target, 1, 1)
    Sleep(2000)
    ToolTip("")
    setvar($targethold, $target)
    EndIf
EndFunc

Func showtarget()
if $target = "" OR $target = 0 OR $target > 7 Then
    Sleep(1)
Else
    ToolTip("Current target: " & $targethold, 1, 1)
    Sleep(2000)
    ToolTip("")
EndIf
EndFunc

While 1
Sleep(1)
WEnd

anyone see whats wrong with this? it was working fine the other day, all of a sudden it wont send mouseclicks.. I tried placing one of the mouseclick statements by itself in start(), it works fine then, must be something with the tppk($target) statement, lemme know..

Thanks.

Edited by vivec45

Share this post


Link to post
Share on other sites



It works fine for me.

What I do:

Alt + F6: Set target to 2

Alt + F1: Pressed P and clicks mouse

I made some minor changes of things that I can see going wrong in your situation. Only function start has changed:

HotKeySet("!{F1}", "start")
HotKeySet("!{F2}", "getcolor")
HotKeySet("!{F3}", "CloseScript")
HotKeySet("!{F5}", "WinMovee")
HotKeySet("!{F6}", "target")
HotKeySet("!{F7}", "showtarget")

;hostile coords
$hostx = 104
$hostoney = 160
$hosttwoy = 189
$hostthreey = 222
$hostfoury = 263
$hostfivey = 301
$hostsixy = 336
$hostseveny = 372
$target = 0
$targethold = 0

While 1
    Sleep(1)
WEnd

Func setvar(ByRef $var, $value)
    $var = $value
    return $var
EndFunc

Func cast($side)
    ;Cast skill on $side ($side = left or right)
EndFunc

Func tppk($target)
    if $target = 0 Then
        Sleep(1)
     elseif $target = 1 Then
         MouseClick("left", $hostx, $hostoney, 1, 0)

     elseif $target = 2 Then
         MouseClick("left", $hostx, $hosttwoy, 1, 0)

     elseif $target = 3 Then
         MouseClick("left", $hostx, $hostthreey, 1, 0)

     elseif $target = 4 Then
         MouseClick("left", $hostx, $hostfoury, 1, 0)

     elseif $target = 5 Then
         MouseClick("left", $hostx, $hostfivey, 1, 0)
         
     elseif $target = 6 Then
         MouseClick("left", $hostx, $hostsixy, 1, 0)
         
     elseif $target = 7 Then
         MouseClick("left", $hostx, $hostseveny, 1, 0)
     EndIf
EndFunc

Func WinMovee()
    WinMove("Diablo II", "", 0, 0)
EndFunc

Func getcolor()
    $color = PixelGetColor(347, 162)
    MsgBox( 0, "Return Color", "Color: " & $color )
EndFunc

Func CloseScript()
    Exit
EndFunc

Func start()
    Sleep(10)
    ; alt key is still down here, because the user cant release it fast enough
    Send("{ALT up}")
    ; alt key is now up
    Send("{p}")
    tppk($targethold)
EndFunc

Func target()
    $target = InputBox("Set hostile target", "Enter a target (1-7): ", "", "", "", "", "", "", 0)
    if $target = "" OR $target = 0 OR $target > 7 Then
        Sleep(1)
    Else
        ToolTip("Current target: " & $target, 1, 1)
        Sleep(2000)
        ToolTip("")
        setvar($targethold, $target)
    EndIf
EndFunc

Func showtarget()
    if $target = "" OR $target = 0 OR $target > 7 Then
        Sleep(1)
    Else
        ToolTip("Current target: " & $targethold, 1, 1)
        Sleep(2000)
        ToolTip("")
    EndIf
EndFunc

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