Mining script

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
Louro
Posts: 10
Joined: Fri May 18, 2012 11:55 am

Mining script

#1 Post by Louro » Mon May 21, 2012 2:51 pm

I would like to code a script for mining but my coding knowledge is really really basic.
I have an idea for this and would like to know it this could work.

Well, the idea is to scan the screen but the bars zone. So lets say this zone starts in pixel (1,200) and ends in pixel (1000,600).

Code: Select all

Target = blue -- this in rgb values with a little offset

for i = 0,100 do
      for j = 0,40 do
          r,g,b = getPixel(win, 1+10*i, 200+10*j);  -- this should scan every 10 pixels from zone start (not needed to scan every pixel)
          if r,g,b = target then
          movemouse to (1+10*i, 200+10*j)
          click
          yrest (7000)  -- mining time
          pickup
       end
end
Do you think this structure could work? Anything I'm missing there?

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Mining script

#2 Post by Administrator » Tue May 22, 2012 7:39 pm

Why aren't you just using pixelSearch?

Louro
Posts: 10
Joined: Fri May 18, 2012 11:55 am

Re: Mining script

#3 Post by Louro » Wed May 23, 2012 2:25 am

wow, thanks for the hint.
As you can see I'm a total newbie here. Wish me luck :)

Louro
Posts: 10
Joined: Fri May 18, 2012 11:55 am

Re: Mining script

#4 Post by Louro » Fri May 25, 2012 2:44 pm

I'm coding it but I have already notice a problem.

I need to add to the mining time the time my char needs to reach the ore.
When mining starts a green bar appears so I need to start the mining time count once the mining starts.

How to do that?

Code: Select all

function am_I_mining()
  r,g,b = getPixel(hdc, x, y);
  
  -- check for the green bar
  if( r,g,b = green with little offset ) then
    return true;
  else
    return false;
  end
end
I think this code should work but, where do I insert this function?
Maybe this way?

Code: Select all

If am_I_mining() = true then
mining time 
pickup
----

Have a similar problem with my fighting routine, it works well but some skills are "lost" cause they are being cast while my char is still moving towards the target. So to check if battle has started or not I think a similar code like above should work, just checking the first target's life pixel.

So, intead starting the fighting function once I have a target it should start after the first hit.

Code: Select all

function battle()
  r,g,b = getPixel(hdc, x, y);
  
  -- check for the first pixel of the enemy life bar
  if( r,g,b = gray with little offset ) then
    fight();
  else
    ... else what?????;
  end
end
Will this keep a track of that first pixel or will it be checked only once?
Should I ad a bucle:

Code: Select all

for i = 0,10 do
battle()
yrest(500)
This should check battle status every half second?
Do I need something like this?
If yes, there is a better way to do this? That last code looks really crappy to me.

---

Thanks for your time. I'm enjoying a lot the scripting thingy :)

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Mining script

#5 Post by Administrator » Sat May 26, 2012 12:27 pm

Just use yrest() to wait for a few seconds while it mines.

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests