Jump to content

I don't know why I'm getting this error


Recommended Posts

HotKeySet("{F11}","close")


$i = 0

Func close()
    $i = 1
EndFunc

Do
    $coord = PixelSearch(0, 270, 350, 0, 0xe4bc5f, 10)
    if $coord[1] > 0 then
        MouseMove($coord[0], coord[1], 0)
        $coord[0] = 0
        $coord[1] = 0
    EndIf
    sleep(20)
until $i = 1

Before anyone asks, this is technically an "aimbot", yes, but I'm just coding it because I have nothing better to do right now during the holidays.

I'm not actually intending to use it, it's on quake 2, which is a game 10 years old, as I said I'd just doing this for the challenge.

However, this is my first time using colour related commands, and I thought this would be a good way to put them into practice.

Every time I run the script it tells me I'm using subscript with a non-array variable when I'm pretty sure it should be.

Everything works fine except for that.

Photoshop User and Noob AutoIt user.
Link to comment
Share on other sites

try this:

HotKeySet("{F11}","close")


$i = 0

Func close()
    $i = 1
EndFunc

Do
    $coord = PixelSearch(0, 270, 350, 0, 0xe4bc5f, 10)
    if $coord[1] > 0 then
        MouseMove($coord[0], $coord[1], 0)
        $coord[0] = 0
        $coord[1] = 0
    EndIf
    sleep(20)
until $i = 1

you didnt set coord[1] as a variable...

Edited by BackStabbed

tolle indicium

Link to comment
Share on other sites

try this:

HotKeySet("{F11}","close")


$i = 0

Func close()
    $i = 1
EndFunc

Do
    $coord = PixelSearch(0, 270, 350, 0, 0xe4bc5f, 10)
    if $coord[1] > 0 then
        MouseMove($coord[0], $coord[1], 0)
        $coord[0] = 0
        $coord[1] = 0
    EndIf
    sleep(20)
until $i = 1

you didnt set coord[1] as a variable...

That looks to be the same as what I already have, which line is different?

And should PixelSearch not automatically set it as an array?

Photoshop User and Noob AutoIt user.
Link to comment
Share on other sites

HotKeySet("{F11}","close")


$i = 0

Func close()
    $i = 1
EndFunc

Do
    $coord = PixelSearch(0, 270, 350, 0, 0xe4bc5f, 10)
    if not @error Then
    if $coord[1] > 0 then
        MouseMove($coord[0], $coord[1], 0)
        $coord[0] = 0
        $coord[1] = 0
    EndIf
    EndIf
    sleep(20)
until $i = 1

I added @error...

and for my post, I told you what I did: coord[1] was not set as a variable with the prefix "$".

tolle indicium

Link to comment
Share on other sites

I added @error...

and for my post, I told you what I did: coord[1] was not set as a variable with the prefix "$".

Thanks.

I did a quick bit of work on it, but now I get a different error.

Here's what I have now

HotKeySet("{F11}","close")
HotKeySet("{F10}","shoot")
HotKeySet("{F9}","deactivate")
HotKeySet("{F8}", "active")


$i = 0
$s = 0
$a = 0

Func shoot()
    if $s = 0 then
        $s = 1
    EndIf
    if $s = 1 then
        $s = 0
    EndIf
EndFunc

func deactivate()
        if $a = 0 then
        $a = 1
    EndIf
    if $a = 1 then
        $a = 0
    EndIf
EndFunc

Func close()
    $i = 1
EndFunc


func active()
    Do
        $coord = Pixelsearch(0, 0, 1280, 1024, 0xE4BC5F, 20 )
        if not @error Then
            if $coord[1] > 0 then
                if $s = 0 then
                    MouseMove($coord[0], coord[1], 0)
                EndIf
                if $s = 1 Then
                    MouseClick( "left", $coord[0], coord[1], 1 , 0)
                EndIf
                $coord[0] = 0
                $coord[1] = 0
            EndIf
        EndIf
        sleep(20)
    until $a = 1
endfunc

Do
    
until $i = 1

I get error parsing function call at line 40.

Do you know why?

Edited by BobiusMaximus
Photoshop User and Noob AutoIt user.
Link to comment
Share on other sites

You forgot what backstabbed told you... coord[1] should be $coord[1] as its supposed to be a variable.

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

You forgot what backstabbed told you... coord[1] should be $coord[1] as its supposed to be a variable.

And i will add to your post corrected lines :P

MouseMove($coord[0], $coord[1], 0)

MouseClick( "left", $coord[0], $coord[1], 1 , 0)

[size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size]

Link to comment
Share on other sites

You forgot what backstabbed told you... coord[1] should be $coord[1] as its supposed to be a variable.

Damnit, that was stupid.

For some reason when I hit F9 it doesn't stop it following a moving player, and F10 isn't changing it between shooting and not.

Anyone know why?

Oh global variables. Woops.

Edited by BobiusMaximus
Photoshop User and Noob AutoIt user.
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...