Sign in to follow this  
Followers 0
sharrakor

Problem with #include <array.au3>

6 posts in this topic

Hi, I was trying to use an array and make use of the _arrayinsert function. However when I try to run my program, I get this error:

---------------------------

AutoIt Error

---------------------------

Line 67 (File "E:\Program Files (x86)\AutoIt3\Include\array.au3"):

Func _ArrayAdd(ByRef $avArray, $vValue)

Error: "Func" statement has no matching "EndFunc".

---------------------------

OK

---------------------------

I've looked, and it is the first function. It does have an endfunc. Any idea on how to fix this? I can't edit the file in notepad++, but if someone has a working array.au3 they could upload that would probably be easiest. I just downloaded it last night so I have the most current version.

Also, when using _arrayinsert, is it legal to do something like:

for $i=0 to 2 step 1

local $clrval = $i + 5

_arrayinsert($clrarray, $arraycount, $clr($clrval)) ; This is what I'm asking about. Can I have a variable within another variables name? I'm trying to make it add the value stored at $clr5 in the first loop, then 6, then 7. I don't know another way to do it, minus a whole lot of code with a large case/swtich list or a lot of if loops.

next

Here is my (incomplete) function in case anyone needs it.

func checkbags()

#include <array.au3>

local $clrarray[24]

send("{enter}")

local $slot=1

local $ycoor=887

local $arraycounter=0

while $slot < 9

mouseclick("right",1499,$ycoor,1,0)

sleep(1000)

local $clr1,$clr2,$clr3,$clr4 ;can these be constantly "redefined"?

$clr1 = pixelgetcolor(1598,18) ; should be 10855845

$clr2 = pixelgetcolor(1599,18) ; should be 2499877

$clr3 = pixelgetcolor(1434,79) ; should be 4472891

for $i=0 to 2 step 1

local $clrval = $i + 1

_arrayinsert($clrarray, $arraycount, $clr($clrval))

next

if $clr1=10855845 and $clr2=2499877 and $clr3=4472891 then

;it IS an afr essen

send("{T }")

else

;it itsnt.

send("{F }")

endif

$slot+=1

$ycoor+=17

wend

send("{enter}")

endfunc

Thanks, and sorry for so many questions. I'm having a lot of fun learning this stuff though :)

Share this post


Link to post
Share on other sites



Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Stupid mistake. Thanks a lot for the help.

Edited by sharrakor

Share this post


Link to post
Share on other sites

Also, when using _arrayinsert, is it legal to do something like:

for $i=0 to 2 step 1

local $clrval = $i + 5

_arrayinsert($clrarray, $arraycount, $clr($clrval)) ; This is what I'm asking about. Can I have a variable within another variables name? I'm trying to make it add the value stored at $clr5 in the first loop, then 6, then 7. I don't know another way to do it, minus a whole lot of code with a large case/swtich list or a lot of if loops.

KaFu ans ur first ques. I'll ans ur second.

no u can't use something like that, it's illegal. But u can use this:

for $i=0 to 2 step 1
local $clrval = $i + 5
_arrayinsert($clrarray, $arraycount, $clr&$clrval)

u can and the two vars and u'll get the req var. A simple example is this:

$var=5
$car="sat"
$var1=$car&$var
MsgBox(4096,"",$var1)

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

Thanks Manjish. I knew there had to be a better way!

Share this post


Link to post
Share on other sites

Thanks Manjish. I knew there had to be a better way!

You are welcome


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

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