Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Mon Oct 22, 2018 3:56 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Trying to create a macro for Tokyo Ghoul re:birth
Thanked: 0 time(s)  Unread post Posted: Sat Sep 29, 2018 11:00 am 
New User
New User



Joined: Fri Sep 28, 2018 11:59 am
Posts: 3
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 10
Hey there, I found out about blue eye macro two days ago and I'm trying to put together a very simple bot for a mobile game called Tokyo Ghoul re:birth, which I play on an emulator (Nox). It only requires a few clicks from the mouse, and to illustrate what it has to do, here's a video of one of my runs: https://streamable.com/o3f1i

I can set up an inefficient macro by simply recording all the actions and then replaying that, however i have to account for extra delays in terms of loading screen or how long the run lasts so they often get stuck at some point for me. Therefore, I thought that color recognition would be a simple solution for this.
I've only done the very basic tutorial with the notepad file and other than that I've tried to look at the documentation and search around a little, so my apologies if my code does not resemble anything close to working. This is what I've attempted to write so far.

As a picture:
Image

And in pure text:
Code:
begin
     // Set the window to the game window
     Color.Limit area of interest to window("Tokyo ghoul", "No")
     begin loop("")
          // Check if the ''confirm'' button color is on the screen
          if  Color.Can be located on screen (RGB)("153", "34", "85", "0")
               // Click the confirm button
               Mouse.Click at color (RGB) ("153", "34", "85", "0", "left")
               // Check if the "Begin Battle" button color is on screen
               if  Color.Can be located on screen (RGB)("255", "68", "102", "0")
                    // Click the "Begin Battle" button
                    Mouse.Click at color (RGB)("255", "68", "102", "0", "left")
                    // Check if the "Auto" button color is on screen
                    if  Color.Can be located on screen (RGB)("68", "68", "68", "0")
                         // Click "Auto" button, however i think this wouldn't work because there are multiple different areas with the same color on the screen
                         // I think i would have to use either coordinates or pixel recognition to make sure it clicks the right button
                         Mouse.Click at color (RGB)("68", "68", "68", "0", "left")
                         // Check if the quest cleared screen has appeared
                         if  Color.Can be located on screen (RGB)("165", "0", "157", "10")
                              // Click (anywhere for that matter) on the screen
                              Mouse.Click at color (RGB)("165", "0", "157", "10", "left")
                              // Check if the loading screen has ended
                              if  Color.Can be located on screen (RGB)("1", "41", "43", "10")
                                   // Click multiple times to speed up the progress bar
                                   Mouse.Click at color (RGB)("1", "41", "43", "10", "left")
                                   Mouse.Click at color (RGB)("1", "41", "43", "10", "left")
                                   Mouse.Click at color (RGB)("1", "41", "43", "10", "left")
                                   // Click on the "next" button
                                   Mouse.Click at color (RGB)("255", "68", "102", "0", "left")
                                   // Click multiple times to speed up the rewards obtained
                                   Mouse.Click at color (RGB)("6", "4", "8", "10", "left")
                                   Mouse.Click at color (RGB)("6", "4", "8", "10", "left")
                                   Mouse.Click at color (RGB)("6", "4", "8", "10", "left")
                                   // Click the "next" button again
                                   Mouse.Click at color (RGB)("255", "68", "102", "0", "left")
     end
 end

I'm getting a compiler error on the line where I try to click on the first color. I also wanted to add some pauses between a few actions, but I'm not able to use either the Macro.Pause or Humanly.Pause, would anyone happen to know what I did wrong?


Top
 Profile  
Reply with quote  
 Post subject: Re: Trying to create a macro for Tokyo Ghoul re:birth
Thanked: 1 time(s)  Unread post Posted: Sun Sep 30, 2018 2:38 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1829
Location: USA
Been thanked: 392 time(s)
Has thanked: 32 time(s)
Contribution Points: 16347
When you write an "if" statement, you need to follow it with something within a "begin" and "end"; like this:
Code:
 begin
     Color.Limit area of interest to window("Tokyo ghoul", "No")
     begin loop()
          if  Color.Can be located on screen (RGB)("153", "34", "85", "0")
               begin
                    Mouse.Click at color (RGB) ("153", "34", "85", "0", "left")
                    Macro.Pause("100")
               end
          // keep going like that with the rest of your script; next "if" statement
     end
 end


So, if you try the above code it will compile fine. It tells BEM what part to do if the "if" statement is true. If it's false, it will skip everything contained in the next "begin/end". In this example, if the color could not be located, it would skip clicking the mouse at 153.34.85 and move on to reading your next "if" statement to see if the next one is true.

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
 Post subject: Re: Trying to create a macro for Tokyo Ghoul re:birth
Thanked: 0 time(s)  Unread post Posted: Mon Oct 01, 2018 11:47 am 
New User
New User



Joined: Fri Sep 28, 2018 11:59 am
Posts: 3
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 10
Thanks! I can't believe I missed such a fundamental step. I'll try to continue with it then ^^


Top
 Profile  
Reply with quote  
 Post subject: Re: Trying to create a macro for Tokyo Ghoul re:birth
Thanked: 0 time(s)  Unread post Posted: Fri Oct 05, 2018 10:57 am 
New User
New User



Joined: Fri Sep 28, 2018 11:59 am
Posts: 3
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 10
I've been able to make good progress and now have a functioning macro. I decided to change my approach from color recognition towards image recognition, in order to make sure it only clicks when and where it needs to. However, i've run into a small issue. It seems that i often have to retake the screenshots of the specified areas of the screen. Even though the areas and buttons don't change, for some reason the program fails to recognize the pictures. Once i renew the screenshots it functions properly again, as long as i leave the emulator open it won't require new screenshots.

At first i assumed that i may have accidentally readjusted my window size and therefore altered the in-game areas of the screen, however now i'm not quite sure what causes this as i've been careful not to adjust my window size. Lowering the percentage of pixels that have to match in order for a picture to be recognized worked in a few cases, but it wasn't consistent. Is there any to prevent this from happening?

My code changed a bit so here's the updated code:
Image

And in code:
Code:
 begin
     begin loop()
          // Check if the ''confirm'' button is on the screen
          if  Image.Can be located on screen("E:\Quick Access\Documents\BlueEye\ConfirmButton.png", "100")
               begin
                    Mouse.Click at image("E:\Quick Access\Documents\BlueEye\ConfirmButton.png", "100", "left")
               end
          // Check if the "Begin Battle" button is on screen
          if  Image.Can be located on screen("E:\Quick Access\Documents\BlueEye\BeginBattleButton.png", "100")
               begin
                    Mouse.Click at image("E:\Quick Access\Documents\BlueEye\BeginBattleButton.png", "100", "left")
               end
          // Check if the "Auto" button is on screen
          if  Image.Can be located on screen("E:\Quick Access\Documents\BlueEye\AutoButton.png", "100")
               begin
                    Mouse.Click at image("E:\Quick Access\Documents\BlueEye\AutoButton.png", "100", "left")
               end
          // Check if the quest cleared screen has appeared
          if  Image.Can be located on screen("E:\Quick Access\Documents\BlueEye\QuestCleared.png", "100")
               begin
                    Mouse.Click at image("E:\Quick Access\Documents\BlueEye\QuestCleared.png", "100", "left")
               end
          // Check whether you leveled up
          if  Image.Can be located on screen("E:\Quick Access\Documents\BlueEye\UserRankIncrease.png", "100")
               begin
                    Mouse.Click at image("E:\Quick Access\Documents\BlueEye\CloseRankUp.png", "100", "left")
               end
          // Check if the rewards have loaded
          if  Image.Can be located on screen("E:\Quick Access\Documents\BlueEye\FirstNext.png", "100")
               begin
                    // Click on the "next" button
                    Mouse.Click at image("E:\Quick Access\Documents\BlueEye\FirstNext.png", "100", "left")
               end
          if  Image.Can be located on screen("E:\Quick Access\Documents\BlueEye\SecondNext.png", "100")
               begin
                    // Click the "next" button again
                    Mouse.Click at image("E:\Quick Access\Documents\BlueEye\SecondNext.png", "100", "left")
               end
     end
 end
 


Top
 Profile  
Reply with quote  
 Post subject: Re: Trying to create a macro for Tokyo Ghoul re:birth
Thanked: 0 time(s)  Unread post Posted: Fri Oct 05, 2018 4:11 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1829
Location: USA
Been thanked: 392 time(s)
Has thanked: 32 time(s)
Contribution Points: 16347
The one drawback to using images is if there's text in the images; if it's small letters/text, then BEM could have a hard time identifying it correctly (without text it's great). Some options are:
- use a portion of the image (the "save region" button in investigator) without text
- use pixel patterns around text
- use unique identifiers like the width/height of buttons to determine which ones they are instead of text
- use RGB if they are differently colored, etc

There's a video on how to set up your windows so they will always be the same size and same location here: viewtopic.php?f=111&t=22190
- browse through the window instructions under the BEM documentation pages for more
- additionally you can use relative coordinates instead so that moving the window doesn't affect the macro

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group