MM2 specific questions

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
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

MM2 specific questions

#1 Post by lisa » Mon Oct 27, 2014 6:55 pm

ok so with MM2 the suggested usage is to not use rests and to have the script going through the micro.main() constantly, there are states that can be implemented so you don't have 100 checks in the main loop and it can keep doing the code it should be doing. What this means for me though is that if you don't use states then there will be a lot variables to help tell MM what it should be doing.

example in the archeage mount script.
local running = false;

In my harvesting script
local running = false;
local chatpause = false


So now to the actual question, when troubleshooting you generally have in lots of print this and print that, is there an easy way to print the variables (names and values)
So if the script errors it might print
error line 54, blah blah
running false
chatpause true

Or am I just dreaming?
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: MM2 specific questions

#2 Post by rock5 » Mon Oct 27, 2014 9:08 pm

In regards to states, I think I came up with an easy way to implement it for simpler functions when I did my splitter addon. Example.

Code: Select all

function example(elapsedtime)
   if wait > 0 then
      wait = wait - elapsedtime
   elseif step == 1 then
      -- Do first thing
      step = 2
      wait = 2 -- wait 2 before moving on to next step
   elseif step == 2 then
      -- Do second thing
      if condition then
         step = 1 -- repeat steps
      else
         step = 3
      end
      wait = 3
   elseif step == 3
      -- last step. clean up.
      step = nil
      wait = 0
   end
end
I find this an easy way to control the flow. What do you think? Does that make sense?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MM2 specific questions

#3 Post by BlubBlab » Tue Oct 28, 2014 12:57 am

I'm not sure what the question is. I had implemented a framework for the states of MM2 but yeah when you use fix vars instead you need to make a maze of if ...then which means you need for every new state you add, you also need to add a new var into the maze.

So for every new state you need to add a new print, or you can made everything dynamic and use an array which is pretty much what I did. By the way my framework has also an default wait/rest state which can be used.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

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

Re: MM2 specific questions

#4 Post by Administrator » Wed Oct 29, 2014 3:14 am

I think you should split each set of logic into separate classes where it makes sense (ie. states), then have those classes each have their own debug reporting function that would return a string of relevant data. Now, you could call your classe's functions in a protected environment (pcall()) and rely on the debug report callback to extract useful info when there is an error. This is simple, effective, and gives you full control over what information is going to be displayed when something bad happens.

I haven't really made any scripts worth showing off, but what I've found to be effective is just to have a few re-usable variables (ie, state, timer, whatever else) to control the flow to separate functions or classes. Pretty similar to what rock5 posted, actually.

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests