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?
MM2 specific questions
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.
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.
MM2 specific questions
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
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: MM2 specific questions
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.
I find this an easy way to control the flow. What do you think? Does that make sense?
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
- 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
Re: MM2 specific questions
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.
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
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
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
- Administrator
- Site Admin
- Posts: 5312
- Joined: Sat Jan 05, 2008 4:21 pm
Re: MM2 specific questions
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.
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.
Who is online
Users browsing this forum: No registered users and 3 guests