2

So I'm trying to make a macro to catch Pokemon from maps in this game but there if you encounter a Turf War it will show this image:

http://i.imgur.com/W6Tjd8l.jpg

As you can see the click button says "Lets Battle!" and it redirects you to a battle link.

However, I want to make an if statement that if I encounter this battle link I would refresh the page instead and let me go here.

Does anybody know how to code if statements for this?

So here's how I want it to work:

if (it encounters the Turf Battle)
   will click another link
else
   keep clicking the map to catch using the click x and y

EDIT: I tried this syntax:

if (TAG POS=1 TYPE=H2 ATTR=TXT:You<SP>Don't<SP>Belong<SP>Here!)
{ 
    REFRESH
}

but it won't work. Any help maybe? Giving me this error:

SyntaxError: unknown command: IF, line: 1 (Error code: -910)
Makyen
  • 31,849
  • 12
  • 86
  • 121
  • There is no IF statement in imacros - you need to create javascript or similar script to use If statement. – Bestmacros Sep 17 '13 at 05:32
  • http://stackoverflow.com/questions/14909553/loop-in-imacros-using-javascript <<<< and here you have an example of how to make if statement using JS scripting. – edinvnode Sep 18 '13 at 18:32
  • @Bestmacros How do you create a Javascript or similar script to do that? Do you just create another macro? –  Sep 19 '13 at 00:15
  • @IceD So basically what I have to do is code the original map catching macro right? But which macro do I run to start this whole macroing loop? The one with the IF statement or the one with the original script? Sorry if I'm a little new to this. –  Sep 19 '13 at 00:16
  • 1
    you need to rebuild your original macro in javascript format. – Bestmacros Sep 19 '13 at 06:34
  • And search some more on stackoverflow for iMacros javascript solutions. There are tons of answered questions. Check bestmacros profile and my profile. There are examples there in answers which you can use. – edinvnode Sep 19 '13 at 11:51
  • @Bestmacros How do I rebuild that? Do you have any advice on it? –  Sep 20 '13 at 16:08
  • Ok so I tried this syntax but it won't work (Check edited post) –  Sep 20 '13 at 20:32
  • 2
    Delete your dupes please. – puretppc Nov 24 '13 at 21:39

1 Answers1

0

You can try by *.js file (not *.iim file) :

  1. open notepad
  2. copy my code
  3. edit YOUR-URL to your url
  4. save this to your-file.js ( path= imacro path )
  5. open firefox & run your-file.js

good luck

CODE:

       iimPlay("Code:URL GOTO=YOUR-URL")
   var macro;                        
    macro+="SET !REPLAYSPEED FAST\n";
    macro+="TAG POS=1 TYPE=H2 ATTR=TXT:* EXTRACT=TXT\n";
    iimPlay(macro_var);
    var result=iimGetLastExtract();
    if(result=="You<SP>Don't<SP>Belong<SP>Here!")
    {
    iimDisplay("success");
    REFRESH
    }
Ghasem
  • 14,455
  • 21
  • 138
  • 171
Cao Bách
  • 1
  • 1