autohotkey - ahk error else with no matching if, what's wrong? -


hi autohotkey script seems wrong , checked brackets , think okay, keep getting error else no matching if, there missed?

    loot1() {     imagesearch,violetx, violety, 266, 141, 579, 527, c:\image\loot.png     if errorlevel  {     mobs1()     }     else if errorlevel=0 {              mousemove(%violetx%,%violety%)             mouseclick, left             return     }     else      {         sleep, 100             return     } } 

you should use if, because there no previous if match else if.

example:

if (condition1) {     // executed if "condition1" equals true } else if (condition2) {     // executed if "condition1" false , "condition2" equals true } else {     // executed if both "condition1" , "condition3" equals false } 

edit, perhaps right answer:

loot1() {     imagesearch,violetx, violety, 266, 141, 579, 527, c:\image\loot.png     if errorlevel       {     mobs1()         }     else if errorlevel=0      {         mousemove(%violetx%,%violety%)         mouseclick, left         return     }     else      {         sleep, 100         return     } } 

there missing bracket, should indent code better visualization.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -