Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Sat Nov 27, 2021 2:34 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Pattern Counting?
Thanked: 0 time(s)  Unread post Posted: Thu Oct 21, 2021 9:15 am 
Active User
Active User



Joined: Sun Oct 17, 2021 9:07 pm
Posts: 32
Been thanked: 0 time(s)
Has thanked: 6 time(s)
Contribution Points: 67
As the topic suggests, is there any way to count the number of patterns on screen or using if pattern enters screen?
I looked at
Code:
                         Color.Find coordinate of next occurrence (RGB)("", "", "", "", "", "")
but it only seems to have it for a single color not pattern?
I have tried using
Code:
 begin
     Variable.Set("VisibleEnemies", "0")
     Variable.Set("CloseEnemies", "0")
     while  Macro.Is not running("ROBot", "ROBotMain")
          begin
               Window.Display html dialog("VisibleEnemies", "300", "25", "yes", "{VisibleEnemies}")
               if  Color.Pixel pattern appears on screen within (ms)("0,165,198,50,0,0,165,198,-50,22,0,165,198,50,0,0,165,198", "0", "100000")
                    begin
                         Variable.Increment (Math)("VisibleEnemies")
                    end
          end
 end

but when I run it the count just skyrockets. with 3 visible the count hits 40+. Tried searching but so far come up empty on an alternative way to do this either with existing patterns on the screen or ones that enter after the macro is looping.


Top
 Profile  
Reply with quote  
 Post subject: Re: Pattern Counting?
Thanked: 1 time(s)  Unread post Posted: Thu Oct 21, 2021 3:37 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 2218
Location: USA
Been thanked: 520 time(s)
Has thanked: 38 time(s)
Contribution Points: 17606
The best way would probably to use memory addresses to count enemies or objects, but if you're not wanting to get the memory addresses then you could try:

Break up the screen into segments in which the objects appear using "color.limit area of interest to coordinates". You can find it under the Instructions for color: viewforum.php?f=162. Just run the searches in each quadrant.
- use it if they will be separated by some distance

Other ways of doing this is using some of the options in Criteria for color: viewforum.php?f=150.
For example you search for pixel patterns near coordinates, near the mouse position, etc.
- use it if you need to "scan" line-by-line for closer objects

There's Criteria and Instructions for "pixel pattern near coordinate" both have an input for how far away to look. You can use that to set up a grid.

If you can highlight the object (perhaps mouse hover) then you could use that as an identifier and count them that way. Same if you can tab (or otherwise) select individual objects.

There is no direct instruction to count pixel patterns that I can recall; generally you choose a unique color, image, or pixel pattern to search for and use it. And as I stated above, if you wanted to count then you would probably use the memory addresses to do so.

There's some other creative ways to do it, but that should get you started in thinking how to achieve it. Or provide a screen shot and I'll take a look at it.

_________________
----------------------------------------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: Pattern Counting?
Thanked: 0 time(s)  Unread post Posted: Fri Oct 22, 2021 4:37 am 
Active User
Active User



Joined: Sun Oct 17, 2021 9:07 pm
Posts: 32
Been thanked: 0 time(s)
Has thanked: 6 time(s)
Contribution Points: 67
Thank you, Syrifina.
Im unsure how to work with memory addressables in BEM, so that's not likely to be a good option currently.
The idea of segregating each area may work, but not if multiple enemies exist in the specified area?
Already using the near coordinate to check if any are close, but it doesn't catch if any new ones enter as it just gets the first occurrence?
I'll test out using the segments and failing that I may ask you to take a look if that's an option.


Top
 Profile  
Reply with quote  
 Post subject: Re: Pattern Counting?
Thanked: 0 time(s)  Unread post Posted: Fri Oct 22, 2021 1:55 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 2218
Location: USA
Been thanked: 520 time(s)
Has thanked: 38 time(s)
Contribution Points: 17606
Quote:
failing that I may ask you to take a look if that's an option.
Sure, no problem.

I try not to script out everything for users because it can damper creativity. There's so many ways to accomplish tasks, I don't like to limit people to what I think of and how I would do something. There's always better ways to script macros and there's people a lot smarter and creative than I am. So I try to just guide or help out when I can.

With that being said, I did make a test to make sure the advise I gave would work...if you get stuck I can post it for you. But give it a shot, I'd be interested to see how you solve it! Based on some of your other posts, I bet you can come up with a solution better than what I made.

Tip:
If you're doing a lot of pixel-pattern searches and it's taking a lot of resources or really slow:
- I would use "freeze screen dump cache"
- then search using the screen dump to save resources; it will also search faster
- since you want to continue checking for new mobs that show up, you could dump the screen cache and do it again
- that will give you the value of any changes to the number of mobs

_________________
----------------------------------------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: Pattern Counting?
Thanked: 0 time(s)  Unread post Posted: Fri Oct 22, 2021 10:28 pm 
Active User
Active User



Joined: Sun Oct 17, 2021 9:07 pm
Posts: 32
Been thanked: 0 time(s)
Has thanked: 6 time(s)
Contribution Points: 67
Thanks again.
Definately attempting to get things working myself, I prefer the challenge especially when writing as big a script as I am.

Currently writing full automation - progress at the current point:

    Matches the XY of the player to the XY Coordinates of the minimap, adjusting max XY's based on which map you're on
    Can set waypoints to move from map to map using the above
    Random Walking
    Detection of enemies in Range/Attack (Set by sprite)
    Loot pickup based on sprite for pickup items
    Detect's death and returns to town
    Uses Skills/Items setup from hotbar regardless of which slot its in for healing/AOE/Escape
    Determines when stuck moving between waypoints
Much more I'm working on still and fixing bugs. It just sucks its limited on what can be done in functions restricting my standard systems in coding


Top
 Profile  
Reply with quote  
 Post subject: Re: Pattern Counting?
Thanked: 0 time(s)  Unread post Posted: Mon Nov 22, 2021 12:38 pm 
New User
New User



Joined: Thu Oct 28, 2021 5:53 am
Posts: 3
Been thanked: 0 time(s)
Has thanked: 2 time(s)
Contribution Points: 10
Jfullernz wrote:
Thanks again.
Definately attempting to get things working myself, I prefer the challenge especially when writing as big a script as I am.

Currently writing full automation - progress at the current point:

    Matches the XY of the player to the XY Coordinates of the minimap, adjusting max XY's based on which map you're on
    Can set waypoints to move from map to map using the above
    Random Walking
    Detection of enemies in Range/Attack (Set by sprite)
    Loot pickup based on sprite for pickup items
    Detect's death and returns to town
    Uses Skills/Items setup from hotbar regardless of which slot its in for healing/AOE/Escape
    Determines when stuck moving between waypoints
Much more I'm working on still and fixing bugs. It just sucks its limited on what can be done in functions restricting my standard systems in coding


I'm very very curious on how you're able to match coordinates and navigate with them. Could you elaborate a bit on this topic?
I'm working on automations for RO but honestly nowhere near this level. Very interesting progress, I'll try and copy some of them! XD


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 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