# big mess kinda....

## Recommended Posts

need some help getting errors not sure how to fix...

```While 1
MouseMove( 236 , 470 )
Sleep(3500)

\$Color1 = PixelGetColor( 236 , 470 )
If \$Color1 = 5985882 Then
\$RANDOM = Random(0, 4, 1)
Select
Case \$RANDOM = 0
\$x = 325
\$y = 470
Case \$RANDOM = 1
\$x = 361
\$y = 470
Case \$RANDOM = 2
\$x = 425
\$y = 470
Case \$RANDOM = 3
\$x = 392
\$y = 470
Case \$RANDOM = 4
\$x = 463
\$y = 470
EndSelect
MouseClick("left",\$x,\$y)
Else
\$Color2 = PixelGetColor( 356 , 312 )
If \$Color2 = 16646144 Then
Check_Open_Room()
Else
EndIf
WEnd

; ========================
; Functions
; ========================

Func Check_Open_Room()
\$CRoom1 = PixelGetColor( 557 , 150 )
If \$CRoom1 = 10079264 Then
MouseClick("left", 694, 150)
EndFunc
Else
\$CRoom2 = PixelGetColor( 557 , 168 )
If \$CRoom2 = 10079264 Then
MouseClick("left", 694, 168)
EndFunc
Else
\$CRoom3 = PixelGetColor( 557 , 186 )
If \$CRoom3 = 10079264 Then
MouseClick("left", 694, 186)
EndFunc
Else
\$CRoom4 = PixelGetColor( 557 , 204 )
If \$CRoom4 = 10079264 Then
MouseClick("left", 694, 204)
EndFunc
Else
\$CRoom5 = PixelGetColor( 557 , 222 )
If \$CRoom5 = 10079264 Then
MouseClick("left", 694, 222)
EndFunc
Else
\$CRoom6 = PixelGetColor( 557 , 240 )
If \$CRoom6 = 10079264 Then
MouseClick("left", 694, 240)
EndFunc
Else
\$CRoom7 = PixelGetColor( 557 , 258 )
If \$CRoom7 = 10079264 Then
MouseClick("left", 694, 258)
EndFunc
Else
\$CRoom8 = PixelGetColor( 557 , 276 )
If \$CRoom8 = 10079264 Then
MouseClick("left", 694, 276)
EndFunc
Else
\$CRoom9 = PixelGetColor( 557 , 294 )
If \$CRoom9 = 10079264 Then
MouseClick("left", 694, 294)
EndFunc
Else
\$CRoom10 = PixelGetColor( 557 , 312 )
If \$CRoom10 = 10079264 Then
MouseClick("left", 694, 312)
EndFunc
Else
EndFunc```

ERROR: missing EndIf.

WEnd

^

REF: missing EndIf.

If \$Color1 = 5985882 Then

~~~~~~~~~~~~~~~~~~~~~~~~~^

ERROR: missing EndIf.

EndFunc

^

REF: missing EndIf.

If \$CRoom1 = 10079264 Then

~~~~~~~~~~~~~~~~~~~~~~~~~~^ ERROR: syntax error

Else

^

it looks to me like it will work.....

For the Check open room part i need it to look for a pixel at that point if it finds it lick the button to go in for that room.... if it doesnt look at the next room....

any help would be great

##### Share on other sites

All If...Else need an EndIf .

You have too many EndFunc statements ... maybe you want ExitFunc at those spots.

Maybe this output from Tidy helps you?:

```While 1
MouseMove(236, 470)
Sleep(3500)

\$Color1 = PixelGetColor(236, 470)
If \$Color1 = 5985882 Then
\$RANDOM = Random(0, 4, 1)
Select
Case \$RANDOM = 0
\$x = 325
\$y = 470
Case \$RANDOM = 1
\$x = 361
\$y = 470
Case \$RANDOM = 2
\$x = 425
\$y = 470
Case \$RANDOM = 3
\$x = 392
\$y = 470
Case \$RANDOM = 4
\$x = 463
\$y = 470
EndSelect
MouseClick("left", \$x, \$y)
Else
\$Color2 = PixelGetColor(356, 312)
If \$Color2 = 16646144 Then
Check_Open_Room()
Else
EndIf
;### Tidy Error: Level error -> WEnd is closing previous If
WEnd

; ========================
; Functions
; ========================

;### 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 Check_Open_Room()
\$CRoom1 = PixelGetColor(557, 150)
If \$CRoom1 = 10079264 Then
MouseClick("left", 694, 150)
;### Tidy Error: Level error -> EndFunc is closing previous If
EndFunc  ;==>Check_Open_Room
;### Tidy Error: Level error -> Else is closing previous Func
Else
\$CRoom2 = PixelGetColor(557, 168)
If \$CRoom2 = 10079264 Then
MouseClick("left", 694, 168)
;### Tidy Error: Level error -> EndFunc is closing previous If
EndFunc  ;==>Check_Open_Room
;### Tidy Error: Level error -> Else is closing previous Func
Else
\$CRoom3 = PixelGetColor(557, 186)
If \$CRoom3 = 10079264 Then
MouseClick("left", 694, 186)
;### Tidy Error: Level error -> EndFunc is closing previous If
EndFunc  ;==>Check_Open_Room
;### Tidy Error: Level error -> Else is closing previous Func
Else
\$CRoom4 = PixelGetColor(557, 204)
If \$CRoom4 = 10079264 Then
MouseClick("left", 694, 204)
;### Tidy Error: Level error -> EndFunc is closing previous If
EndFunc  ;==>Check_Open_Room
;### Tidy Error: Level error -> Else is closing previous Func
Else
\$CRoom5 = PixelGetColor(557, 222)
If \$CRoom5 = 10079264 Then
MouseClick("left", 694, 222)
;### Tidy Error: Level error -> EndFunc is closing previous If
EndFunc  ;==>Check_Open_Room
;### Tidy Error: Level error -> Else is closing previous Func
Else
\$CRoom6 = PixelGetColor(557, 240)
If \$CRoom6 = 10079264 Then
MouseClick("left", 694, 240)
;### Tidy Error: Level error -> EndFunc is closing previous If
EndFunc  ;==>Check_Open_Room
;### Tidy Error: Level error -> Else is closing previous Func
Else
\$CRoom7 = PixelGetColor(557, 258)
If \$CRoom7 = 10079264 Then
MouseClick("left", 694, 258)
;### Tidy Error: Level error -> EndFunc is closing previous If
EndFunc  ;==>Check_Open_Room
;### Tidy Error: Level error -> Else is closing previous Func
Else
\$CRoom8 = PixelGetColor(557, 276)
If \$CRoom8 = 10079264 Then
MouseClick("left", 694, 276)
;### Tidy Error: Level error -> EndFunc is closing previous If
EndFunc  ;==>Check_Open_Room
;### Tidy Error: Level error -> Else is closing previous Func
Else
\$CRoom9 = PixelGetColor(557, 294)
If \$CRoom9 = 10079264 Then
MouseClick("left", 694, 294)
;### Tidy Error: Level error -> EndFunc is closing previous If
EndFunc  ;==>Check_Open_Room
;### Tidy Error: Level error -> Else is closing previous Func
Else
\$CRoom10 = PixelGetColor(557, 312)
If \$CRoom10 = 10079264 Then
MouseClick("left", 694, 312)
;### Tidy Error: Level error -> EndFunc is closing previous If
EndFunc  ;==>Check_Open_Room
;### Tidy Error: Level error -> Else is closing previous Func
Else
EndFunc  ;==>Check_Open_Room```
Edited by JdeB

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

Well when your done with the script, at least you can say you got the coords and the pixel colors.

```While 1
MouseMove( 236 , 470 )
Sleep(3500)

\$Color1 = PixelGetColor( 236 , 470 )
If \$Color1 = 5985882 Then
\$RANDOM = Random(0, 4, 1)
Select
Case \$RANDOM = 0
\$x = 325
\$y = 470
Case \$RANDOM = 1
\$x = 361
\$y = 470
Case \$RANDOM = 2
\$x = 425
\$y = 470
Case \$RANDOM = 3
\$x = 392
\$y = 470
Case \$RANDOM = 4
\$x = 463
\$y = 470
EndSelect
MouseClick("left",\$x,\$y)
Else
\$Color2 = PixelGetColor( 356 , 312 )
If \$Color2 = 16646144 Then
Check_Open_Room()
Else
EndIf
WEnd

; ========================
; Functions
; ========================

Func Check_Open_Room()
Local \$CRoom1 = PixelGetColor( 557 , 150 )
Local \$CRoom2 = PixelGetColor( 557 , 168 )
Local \$CRoom3 = PixelGetColor( 557 , 186 )
Local \$CRoom4 = PixelGetColor( 557 , 204 )
Local \$CRoom5 = PixelGetColor( 557 , 222 )
Local \$CRoom6 = PixelGetColor( 557 , 240 )
Local \$CRoom7 = PixelGetColor( 557 , 258 )
Local \$CRoom8 = PixelGetColor( 557 , 276 )
Local \$CRoom9 = PixelGetColor( 557 , 294 )
Local \$CRoom10 = PixelGetColor( 557 , 312 )

Select
Case \$CRoom1 = 10079264
MouseClick("left", 694, 150)
Case \$CRoom2 = 10079264
MouseClick("left", 694, 168)
Case \$CRoom3 = 10079264
MouseClick("left", 694, 186)
Case \$CRoom4 = 10079264
MouseClick("left", 694, 204)
Case \$CRoom5 = 10079264
MouseClick("left", 694, 222)
Case \$CRoom6 = 10079264
MouseClick("left", 694, 240)
Case \$CRoom7 = 10079264
MouseClick("left", 694, 258)
Case \$CRoom8 = 10079264
MouseClick("left", 694, 276)
Case \$CRoom9 = 10079264
MouseClick("left", 694, 294)
Case \$CRoom10 = 10079264
MouseClick("left", 694, 312)
EndSelect
EndFunc```

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

I think this is what you want:

```While 1
MouseMove(236, 470)
Sleep(3500)

\$color1 = PixelGetColor(236, 470)
If \$color1 = 5985882 Then
\$random = Random(0, 4, 1)
Select
Case \$random = 0
\$x = 325
\$y = 470
Case \$random = 1
\$x = 361
\$y = 470
Case \$random = 2
\$x = 425
\$y = 470
Case \$random = 3
\$x = 392
\$y = 470
Case \$random = 4
\$x = 463
\$y = 470
EndSelect
MouseClick("left", \$x, \$y)
Else
\$color2 = PixelGetColor(356, 312)
If \$color2 = 16646144 Then
Check_Open_Room()
EndIf
EndIf
WEnd

; ========================
; Functions
; ========================

Func Check_Open_Room()
If PixelGetColor(557, 150) = 10079264 Then
MouseClick("left", 694, 150)
ElseIf PixelGetColor(557, 168) = 10079264 Then
MouseClick("left", 694, 168)
ElseIf PixelGetColor(557, 186) = 10079264 Then
MouseClick("left", 694, 186)
ElseIf PixelGetColor(557, 204) = 10079264 Then
MouseClick("left", 694, 204)
ElseIf PixelGetColor(557, 222) = 10079264 Then
MouseClick("left", 694, 222)
ElseIf PixelGetColor(557, 240) = 10079264 Then
MouseClick("left", 694, 240)
ElseIf PixelGetColor(557, 258) = 10079264 Then
MouseClick("left", 694, 258)
ElseIf PixelGetColor(557, 276) = 10079264 Then
MouseClick("left", 694, 276)
ElseIf PixelGetColor(557, 294) = 10079264 Then
MouseClick("left", 694, 294)
ElseIf PixelGetColor(557, 312) = 10079264 Then
MouseClick("left", 694, 312)
EndIf
EndFunc;==>Check_Open_Room```

I don't get this:

lick the button

I never knew AutoIt could lick buttons

The error basically says everything, you need to close Ifs with EndIf (BTW, if you don't have an else, you don't need to write Else, just do this: If.....EndIf)

Felix N.

Edited by Felix N.

##### Share on other sites

yah none of them work for some reason.... it seems like the would and i even modified them a little still no luck...

##### Share on other sites

Try this, and or see if the color really is what your looking for at those coords:

```Opt("PixelCoordMode", 0); replace 0 with 1 if your getting you are getting screen coords or 2 if you're getting client coords from AutoInfo Tool.
Opt("MouseCoordMode", 0); replace 0 with 1 if your getting you are getting screen coords or 2 if you're getting client coords from AutoInfo Tool.

While 1
MouseMove( 236 , 470 )
Sleep(3500)

\$Color1 = PixelGetColor( 236 , 470 )
If \$Color1 = 5985882 Then
\$RANDOM = Random(0, 4, 1)
Select
Case \$RANDOM = 0
\$x = 325
\$y = 470
Case \$RANDOM = 1
\$x = 361
\$y = 470
Case \$RANDOM = 2
\$x = 425
\$y = 470
Case \$RANDOM = 3
\$x = 392
\$y = 470
Case \$RANDOM = 4
\$x = 463
\$y = 470
EndSelect
MouseClick("left",\$x,\$y, 1, 1)
Else
\$Color2 = PixelGetColor( 356 , 312 )
If \$Color2 = 16646144 Then
Check_Open_Room()
Else
EndIf
WEnd

; ========================
; Functions
; ========================

Func Check_Open_Room()
Local \$CRoom1 = PixelGetColor( 557 , 150 )
Local \$CRoom2 = PixelGetColor( 557 , 168 )
Local \$CRoom3 = PixelGetColor( 557 , 186 )
Local \$CRoom4 = PixelGetColor( 557 , 204 )
Local \$CRoom5 = PixelGetColor( 557 , 222 )
Local \$CRoom6 = PixelGetColor( 557 , 240 )
Local \$CRoom7 = PixelGetColor( 557 , 258 )
Local \$CRoom8 = PixelGetColor( 557 , 276 )
Local \$CRoom9 = PixelGetColor( 557 , 294 )
Local \$CRoom10 = PixelGetColor( 557 , 312 )

Select
Case \$CRoom1 = 10079264
MouseClick("left", 694, 150, 1, 1)
Case \$CRoom2 = 10079264
MouseClick("left", 694, 168, 1, 1)
Case \$CRoom3 = 10079264
MouseClick("left", 694, 186, 1, 1)
Case \$CRoom4 = 10079264
MouseClick("left", 694, 204, 1, 1)
Case \$CRoom5 = 10079264
MouseClick("left", 694, 222, 1, 1)
Case \$CRoom6 = 10079264
MouseClick("left", 694, 240, 1, 1)
Case \$CRoom7 = 10079264
MouseClick("left", 694, 258, 1, 1)
Case \$CRoom8 = 10079264
MouseClick("left", 694, 276, 1, 1)
Case \$CRoom9 = 10079264
MouseClick("left", 694, 294, 1, 1)
Case \$CRoom10 = 10079264
MouseClick("left", 694, 312, 1, 1)
EndSelect
EndFunc```

Edit: BTW, that first MouseMove() after the While 1 is kind of redundant, you don't need it I'm sure.

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

o sorry didnt show whole code but i had the opt thing which i dont get what that does... but here is the full

```; ========================
; Start up
; ========================
Opt("PixelCoordMode", 0)
Opt("MouseCoordMode", 0)
Dim \$WinTitle = "http://www.mycoke.com - V-ego San - Mozilla Firefox"
WinWait(\$WinTitle)
WinMove(\$WinTitle, "", 0, 0)

; ========================
;+++++++ Not Completed +++++++
; Open V-ego San
; ========================
; Opt("SendKeyDelay", 200)
; Run("C:\Program Files\Mozilla Firefox\firefox.exe")
; Dim \$MozzTitle = "Mozilla Firefox"
; WinWait(\$MozzTitle)
; MouseMove(222, 67)
; Sleep(1000)
; MouseClick("left", 222, 67)
; Send("http://www.mycoke.com", 1)
; Send("{ENTER}")
; WinWaitActive("MyCoke - Mozilla Firefox")
; Sleep(5000)
; MouseMove(165, 532)
; Sleep(500)
; MouseClick("left", 165, 532)
; Send("aaaaaa", 1)
; Send("{ENTER}")
; Sleep(7000)
; MouseMove(222, 67)
; MouseClick("left", 222, 67)
; Send("http://www.mycoke.com/pages/myCokeGames/Sumo/Sumo.jsp", 1)
; Send("{ENTER}")
; Sleep(5000)
; MouseMove( 709, 232 )
; MouseClick("left", 709, 232 )

; ========================
; Main Code
; ========================
While 1
MouseMove( 236 , 470 )
Sleep(3500)

\$Color1 = PixelGetColor( 236 , 470 )
If \$Color1 = 5985882 Then
\$RANDOM = Random(0, 4, 1)
Select
Case \$RANDOM = 0
\$x = 325
\$y = 470
Case \$RANDOM = 1
\$x = 361
\$y = 470
Case \$RANDOM = 2
\$x = 425
\$y = 470
Case \$RANDOM = 3
\$x = 392
\$y = 470
Case \$RANDOM = 4
\$x = 463
\$y = 470
EndSelect
MouseClick("left",\$x,\$y)
Else
\$Color2 = PixelGetColor( 356 , 312 )
If \$Color2 = 16646144 Then
Check_Open_Room()
EndIf
EndIf
WEnd

; ========================
; Functions
; ========================

Func Check_Open_Room()
Local \$CRoom1 = PixelGetColor( 557 , 150 )
Local \$CRoom2 = PixelGetColor( 557 , 168 )
Local \$CRoom3 = PixelGetColor( 557 , 186 )
Local \$CRoom4 = PixelGetColor( 557 , 204 )
Local \$CRoom5 = PixelGetColor( 557 , 222 )
Local \$CRoom6 = PixelGetColor( 557 , 240 )
Local \$CRoom7 = PixelGetColor( 557 , 258 )
Local \$CRoom8 = PixelGetColor( 557 , 276 )
Local \$CRoom9 = PixelGetColor( 557 , 294 )
Local \$CRoom10 = PixelGetColor( 557 , 312 )

Select
Case \$CRoom1 = 10079264
MouseClick("left", 694, 150, 1, 1)
Case \$CRoom2 = 10079264
MouseClick("left", 694, 168, 1, 1)
Case \$CRoom3 = 10079264
MouseClick("left", 694, 186, 1, 1)
Case \$CRoom4 = 10079264
MouseClick("left", 694, 204, 1, 1)
Case \$CRoom5 = 10079264
MouseClick("left", 694, 222, 1, 1)
Case \$CRoom6 = 10079264
MouseClick("left", 694, 240, 1, 1)
Case \$CRoom7 = 10079264
MouseClick("left", 694, 258, 1, 1)
Case \$CRoom8 = 10079264
MouseClick("left", 694, 276, 1, 1)
Case \$CRoom9 = 10079264
MouseClick("left", 694, 294, 1, 1)
Case \$CRoom10 = 10079264
MouseClick("left", 694, 312, 1, 1)
EndSelect
EndFunc```

no luck

##### Share on other sites

Well, there was nothing wrong with the code, so as I said in my last post, check your pixel colors you want, here's the first seat with it solid green (I guess that's somone in the room in that seat:

Window: X: 557 Y: 150

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0x99BB22 Dec: 10074914

Notice the decimal color (I prefer to use Hex color), doesn't match your 10079264

And this is the second room with that not solid:

Window: X: 557 Y: 168

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0xCCCC99 Dec: 13421721

Again it doesn't match.

So please do as the other post said, and get the right pixel colour.

These were in RGB by the way... if your in BGR switch it out in color mode in AutoInfo Tool or you'll need to change the code.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

i got

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 557 Y: 150

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0x99CC20 Dec: 10079264

maybe my screen color is different then yours... how can i set it so its a few shades off.. or well how does that work?

Edited by lopolop

##### Share on other sites

You have your color resolution on less than 32 bit probably (or using 64 bit), is the reason we are different. (Desktop / Right Click / Properties / Settings), but your color is showing as that, so it shouldn't be different.

I signed out of it, I got lots of stuff to do at the moment, but when I get a free moment, I'll try myself... can you tell me exactly what you're trying to do with a break down.

Like each step from the While on?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

1024x768 32bit

ok from while

I moved the mouse to 236 , 470

Then Sleep... to make sure no failures u have 7 seconds to hit a move so instead of constant, every 3/5 seconds it will do this...

If \$Color1 = The Pixel at 236, 470... which shows that you have to click a move

Then Click at random one of the 5 points...

Else then

Search for another pixel(maybe the person is not in a room thats y it has failed)

If \$Color2 = 16646144 Then

Run the function(searches for green circles) checking a pixel in each circle each Y coordinate goes up by 18 and gets the same 16646144 pixrl color.

else if it doesnt find color2 then restart the loop...

not the best with directions :/ if you need more expanation(cant spell) just tell me

[EDIT]

I did some testing and i found that my pixels do work but the function isnt...

i did this....

```\$Color2 = PixelGetColor( 356 , 312 )
If \$Color2 = 16646144 Then
MsgBox(4096, "YAHOO", "Do you Yahoo?")
Check_Open_Room()
EndIf
EndIf
WEnd```

and i got the yahoo box.

[/****EDIT****\]

i feel like a idiot... well i got it working i guess my green pixels were roung?... i dont know why but i fixed it working good now thanks sooo much for every thing!!!

Edited by lopolop

## Create an account

Register a new account

×

• Wiki

• Back

• Git