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.