/Mac Bot.mac takes long time to load

Hopeless

New member
Joined
Nov 16, 2007
Messages
715
Reaction score
0
Points
0
On my laptop, it takes about 1 min to finish loading Bot.mac

Does this happen to anyone else, or knows a better way to reduce the loading time.

It doesn't happen on my desktop, and Mac showing with no error.
 
it takes me a bit to load it, but more like 10 seconds. you can minimize some of that by removing the options you dont use so they dont waste their time loading. or you can use mq2bot =D
 
I am having troubles just getting my warrior not to crash
 
I am having troubles just getting my warrior not to crash
macros dont crash you; plugins crash you. im assuming you crash on /attack on and that is because mq2melee is fucked. you should report that on a bug thread or see that it is already there as a known issue being fixed.
 
I too am having the bot take 60 second or more to load, freezing my characters in the process until it's done doing whatever.

I went to investigate this, but the macro downloaded from the patcher is incredibly poorly formatted and basically unreadable.

I spent 3 hours fixing it up so at least it's properly indented, and that all the mismatched for loop brackets are fixed up. I didn't get time to look why it's so slow to start up, but figured this may help debug it. It'd be nice if you could add the properly indented version to the loader, too.

Here's my changelist for the attached:

  • Added TODO: statements to the code where I saw weird stuff while cleaning up
  • Changed the ini file name to include server for us multiple server folks
  • Properly indented everything, and fixed for loops with mismatched curly braces

Also, for loops don't require curly braces { } and it's inconsistent in the file where they are used and not used. I didn't clean those up as I went through unfortunately.

Just cleaning things up seems to have shortened up the load time, but that's just anecdotal evidence and I don't have an objective way to time macro start time yet. Need to figure out how to instrument macro's so I can work on the performance.

Edit:

I did some additional testing. I added some debug statements and used MQ2Log to find the time between the time I type /macro bot.mac to the time I enter the main loop. This is testing with the same exact INI file, though I'm not convinced that has much to do with anything.

My version after some more cleanup today
Clicked button at: 00:40
Main loop at: 01:22
Elapsed time: 42 seconds

Patcher version of bot.mac
Clicked button at: 46:03
Main loop at: 46:50
Elapsed Time: 47 seconds

I'm not sure the 5 second difference means anything quite yet. I'd have to run several iterations of each. Regardless, I don't like that my character freezes for 47+ seconds when starting the mac. Any clue as to what to look for would be appreciated. It's not like we have very detailed code analysis tools that I can use to quickly spot the problem =) Or if we do, tell me!

Also, uploaded the version I tested with. I'm working on getting rid of /goto's as they are generally slow, as well as simplifying logic where I can.

edit2: removed this version, see later post.
 
Last edited:
it takes me a bit to load it, but more like 10 seconds. you can minimize some of that by removing the options you dont use so they dont waste their time loading. or you can use mq2bot =D


Whats the difference between bot.mac and mq2bot?
 
it takes me a bit to load it, but more like 10 seconds. you can minimize some of that by removing the options you dont use so they dont waste their time loading. or you can use mq2bot =D


Whats the difference between bot.mac and mq2bot?

The basic difference is one is a Macro, one is a Plugin. They operate entirely differently internally. In theory, the plugin should end up being more powerful. In practice, it's still very early in development and is pretty rough around the edges.

bot.mac is older and more featureful.

MQ2Bot is pretty new and doesn't do much besides combat right now.
 
Okay, I've taken a closer look at start times with basic /echo statement and log timestamp checking.

It looks like file usage is what's getting us.

The `AliasLoad` sub alone takes around 30 second, and that will likely need to write to MacroQuest.ini for all the aliases, each load.

The `IgnoreLoad` sub takes about 5 seconds, which is reading from `Mob_Ignore_List.ini` as well as doing about 8 aliases, which were duplicates of ones in AliasLoad.

Removing the duplicate /alias commands from IgnoreLoad took the run time of that Sub to less than a second.

So, it's looking like writing to disk is that slow bit. My MQ2 install happens to be on spinning disk, which is probably why I'm noticing this more than most.

I'll see if I can find a way to not write the aliases out every run.

Edit:

Made it so aliases only load when the version of the bot is updated. Start time is now 5 seconds for me. See attached. Hope this helps some folks. Would be nice if my changes could make it back to "master" or something along those lines =)

Edit 2016-06-18:

A few bug fixes from my cleanup. Also auto-assigning xtarget1 to group assist target outside of raids.

Edit 2016-06-21:

removed bot.mac from this post in favor of a newer version below
 
Last edited:
My wizard wasn't finding his harvest spell, so I fixed it.

Change List:
Code:
 ** 2016-06-21 - 40oz
 **   - Fixed MyGemTotal calculation to look at Mnemonic Retention Rank, not some weird hardcoded value
 **   - Standardized how we look through spell effects to match 2016 FEB 12 patch notes
 **   - Fixed Harvest Spell detection, at least on wizards.  Untested on other classes, but the changes should be safe for all
 **   - Fixed Type-O COMAT => COMBAT (Thanks for the report, Fyf19)
 **
 ** 2016-06-18 - 40oz
 **   - Fixed some bugs from the loop cleanup over the week while i was testing
 **   - Made the bot automatically set up xtarget1 to group assist target when it's not in a raid
 **
 ** 2016-06-10 - 40oz
 **   - Standardized for loops to not use brackets, as per documentation
 **   - Began modifying early for loop exits to use `/next iterator` instead of `/goto`
 **   - Some logic cleanup in `Sub Main` for readability
 **   - Removed patch note functionality
 **   - Changed AliasLoad to only load aliases when there's a new bot version
 **   - Added some Debugging
 **   - Added a custom bot events include, with TBM Innoruuk "Doom" handled
 **
 ** 2016-06-09 - 40oz
 **   - Cleaned up indentation throughout whole macro
 **   - Changed MyIni to include server name
 **   - Began labeling some TODO: statements as I worked on cleanup

Haven't had a chance to test that he actually USES his harvest spell in combat yet, but he definitely finds it properly now.

Of note, mana gain spell detection will find the first spell gem that has the effect. So if for example gem1 had a low level harvest and gem2 had a high level harvest, it would still use gem1. I didn't feel like fixing this logic, because generally harvest spells share a timer, so why would you memorize a lower level one.

Edit: Also, any chances I can just integrate back with the main bot.mac? I'm afraid for when the original gets updated with a feature that our code will be too far gone to merge, especially after my copious amount of cleanup of the code. If you guys have a git repo I can put a PR in to or something, that'd be sweet. I'd like to make sure everyone is aware of my bug fixes and can get the best version available to them.

edit2: added fix from fyf19

edit3: Made new thread for these fixes since we are outside the scope of the original thread.

http://www.mmobugs.com/forums/bot-mac-botting-macro/31681-bot-mac-updates-bug-fixes.html
 
Last edited:
Thank you very much for posting this.

I noticed there is a typo on line 4264 (which exists in the original version too).

"COMAT" rather than "COMBAT"

If not fixed this seems to cause characters to get stuck when memorizing a spell if they get interrupted by a new pull arriving.
 
Thank you very much for posting this.

I noticed there is a typo on line 4264 (which exists in the original version too).

"COMAT" rather than "COMBAT"

If not fixed this seems to cause characters to get stuck when memorizing a spell if they get interrupted by a new pull arriving.

Thanks for spotting that. I've fixed and reuploaded in my previous post. Not sure if Pete still works on this now that he's working on the Plugin, so just helping where I can.