Guide : Macro
Posted: 07 Apr 2008, 10:41
WhiteGoblin wrote:
I started learning about macros a month or two ago and it's added a whole new level of fun to the game for me. To be honest I've got the flu right now and am about ready to go back to bed but I've been thinking of writing a primer for macro use for the forums here for a while now. Your post only makes me want to do it more. ^_^
For now little bits of information that are probably pretty helpful but don't require a multiple page write up are things like; a macro allows you script almost any event while an automacro will trigger a macro when certain conditions are met. When this happens it triggers the macro which is what makes the bot do the custom event. The majority of the time people will write an automacro for a situation the bot doesn't handle well on it's own or for a custom event thats not in the bot.
I know that sounds very basic and probably didn't need to be covered here but I get questions everyday over in openkore IRC about this and the majority of people have those two things confused. You can use the manual to find conditions and actions you can use in the macro plugin, but some of the most helpful information you're going to find is from browsing the share your macro forum over at the openkore forums and look for examples of what you're trying to do there. Once you find somebody that has a spin on anything close to what you want you can start looking up what they've done in the manual to learn and follow their macro step by step until completion. This is the majority of how I learned.
You're probably going to keep the macro manual and the macros forum up while you're writing your first macros. Also I see tons and tons of people posting macros or asking for help with macros before they've even tested them. The majority of the stuff I've posted here and there on the net about macros under went hours and hours of testing. The last one I posted about the swap dance from hell took over a week of testing to get to a solid state where I felt it was in good enough working condition to share with others. The problem with using macros is often not things you've scripted but outside variables that can screw with your main intention. If you're going to write anything thats more then a small tweak or optimization then you're going to want to watch it operate a bunch of times around other players, aggro monsters, and random events I can't even start to post here.
Once you start working on one nice sized macro you're going to learn faster then reading anything on the net will progress you. This is truely one of those situations where it's faster to just jump in and get dirty. Links I've used alot while learning macros and highly suggest checking out:
1.) Macro Plugin Homepage & Manual
2.) Macro Plugin Forum
3.) An Eval In Macros
4.) Share Your Macros Forum
5.) Openkore Forum Search (find old macros to learn from)
6.) Regular Expressions - Wikipedia
7.) Regular-Expressions.info (badass website for learning regexp)
The next and probably biggest thing I can say to you is don't over complicate your macros. I get alot of shit on the openkore IRC, in IMs, and even in PMs about how simple my macros are and how a real programmer would write better/more advanced macros and honestly I just don't get the point. This isn't a fight for an extension of your sexual organ sizes this is just expanding your bots abilities. I'm a huge huge believer in the KISS theory when it comes to macros; Keep It Simple Stupid. If it works, it works, and there's no reason to feel bad because you didn't make a plugin or write some advanced piece of scripting that makes other macro writers cry when they look at it.
I've posted five macros publicly for everybody to use, modify, and enjoy at thier own will both here and over at the openkore forums. You can see them here:
[2.0.2] Tele/Wing to follow target out of a battle (very very basic)
[2.0.2] B.Wing to follow target on autostorage or death V2.0 (very very basic)
[2.0.2] Switch Between Priest/Soul Linker For Buffs (basic)
[2.0.2] Creating & Using Team Friendly Warp Portals (medium setup time)
[2.0.2] Location Based 2xS.Linker/Alch/Priest Swap For Buffs (some what advanced)
Now you can look at those for examples and you can see what you can do with macros as a whole. I posted those macros with guides intact so that others could learn and understand my macros instead of just posting the actual macro and leaving it for others to figure out on there own. (most people I have to say don't do this, so good luck with others) Even that advanced macro for the five character swap has got me dissed left and right from people who've attempted to write something like it in a much more advanced manner and failed horridly. I cannot express enough how this is not a competition!! Start off slow, take an idea you have (one idea), and start with it. Follow a logical thought process from the start of what you're wanting to do to the end of it. Only work on one automacro at a time, don't get overwhelmed by the entire process. For bigger macros what I do when I start out is open up a text file and just write down my thought process, step by step. After I get it wrote down I'll make little notes about ideas I have on how to do each part, then if I think of any I'll write down problems with this, or possible problems when players/monsters get involved.
After you have your concepts and needs down on paper you can start flying through developing your macro. You can go to step 1 and look in the manual conditions or options you have to get this job done. The same problem could be solved in many many different ways through the use of macros so two people might come up with completely different options. This is not a problem, this is good! Once you've got your macro into an infant state you can load it up and start testing it. TEST IT ALOT!! If you want something to run 24/7 week after week then you're going to need to think about every oddball situation it might encounter along the way, like; monsters attacking in the middle of it, running out of supplies, getting disconnected, players screwing around with your bot, etc etc etc.
If you can, stay away from things like "run-once" or "locks" if this is your first couple of macros. Lets say you're interrupted in the middle of a macro and the previous parts of your macro are locked, what happens then? Your bot won't be able to resume where it's at in the middle without some support macros to release these locks. A good example of this would be lets say your macro has five steps, you get killed in step 3, you head back to town to respawn. THIS IS THE PERFECT PLACE TO ADD A SUPPORT MACRO. You could add something in like "on map change to town, release all macros". But instead of worrying about that, for now, try using timeouts instead. This way after the timeout comes up it can be triggered again and again without needing to release anything.
If you're having trouble waiting for a specific event that you're testing then remember you can trigger macros in your console by typing "macro macronamehere". If you're using locks and can't figure out why your macro is busting then use the "macro reset" command in your console to find out if it's just not released yet or if you have a lock/release issue somewhere in your macro. I don't know how many times my macros ran fine for 12+ hours then I'd go to bed and after reading logs the next morning found that they broke off something really stupid I never thought about five mins after I left the computer.
I highly suggest getting into macros, they can truely show off the power of openkore and make your bot unique. They can help get away with playing on non-bot friendly servers, and they can make your bot a power house if used correctly. Thats all I'm going to write for now, I think I'm going to go throw up now. Peace out!
'Goblin
begin with here http://wiki.openkore.com/index.php/Macro_plugin
THX to fco2783 & Goblin
greetz
r3f
I started learning about macros a month or two ago and it's added a whole new level of fun to the game for me. To be honest I've got the flu right now and am about ready to go back to bed but I've been thinking of writing a primer for macro use for the forums here for a while now. Your post only makes me want to do it more. ^_^
For now little bits of information that are probably pretty helpful but don't require a multiple page write up are things like; a macro allows you script almost any event while an automacro will trigger a macro when certain conditions are met. When this happens it triggers the macro which is what makes the bot do the custom event. The majority of the time people will write an automacro for a situation the bot doesn't handle well on it's own or for a custom event thats not in the bot.
I know that sounds very basic and probably didn't need to be covered here but I get questions everyday over in openkore IRC about this and the majority of people have those two things confused. You can use the manual to find conditions and actions you can use in the macro plugin, but some of the most helpful information you're going to find is from browsing the share your macro forum over at the openkore forums and look for examples of what you're trying to do there. Once you find somebody that has a spin on anything close to what you want you can start looking up what they've done in the manual to learn and follow their macro step by step until completion. This is the majority of how I learned.
You're probably going to keep the macro manual and the macros forum up while you're writing your first macros. Also I see tons and tons of people posting macros or asking for help with macros before they've even tested them. The majority of the stuff I've posted here and there on the net about macros under went hours and hours of testing. The last one I posted about the swap dance from hell took over a week of testing to get to a solid state where I felt it was in good enough working condition to share with others. The problem with using macros is often not things you've scripted but outside variables that can screw with your main intention. If you're going to write anything thats more then a small tweak or optimization then you're going to want to watch it operate a bunch of times around other players, aggro monsters, and random events I can't even start to post here.
Once you start working on one nice sized macro you're going to learn faster then reading anything on the net will progress you. This is truely one of those situations where it's faster to just jump in and get dirty. Links I've used alot while learning macros and highly suggest checking out:
1.) Macro Plugin Homepage & Manual
2.) Macro Plugin Forum
3.) An Eval In Macros
4.) Share Your Macros Forum
5.) Openkore Forum Search (find old macros to learn from)
6.) Regular Expressions - Wikipedia
7.) Regular-Expressions.info (badass website for learning regexp)
The next and probably biggest thing I can say to you is don't over complicate your macros. I get alot of shit on the openkore IRC, in IMs, and even in PMs about how simple my macros are and how a real programmer would write better/more advanced macros and honestly I just don't get the point. This isn't a fight for an extension of your sexual organ sizes this is just expanding your bots abilities. I'm a huge huge believer in the KISS theory when it comes to macros; Keep It Simple Stupid. If it works, it works, and there's no reason to feel bad because you didn't make a plugin or write some advanced piece of scripting that makes other macro writers cry when they look at it.
I've posted five macros publicly for everybody to use, modify, and enjoy at thier own will both here and over at the openkore forums. You can see them here:
[2.0.2] Tele/Wing to follow target out of a battle (very very basic)
[2.0.2] B.Wing to follow target on autostorage or death V2.0 (very very basic)
[2.0.2] Switch Between Priest/Soul Linker For Buffs (basic)
[2.0.2] Creating & Using Team Friendly Warp Portals (medium setup time)
[2.0.2] Location Based 2xS.Linker/Alch/Priest Swap For Buffs (some what advanced)
Now you can look at those for examples and you can see what you can do with macros as a whole. I posted those macros with guides intact so that others could learn and understand my macros instead of just posting the actual macro and leaving it for others to figure out on there own. (most people I have to say don't do this, so good luck with others) Even that advanced macro for the five character swap has got me dissed left and right from people who've attempted to write something like it in a much more advanced manner and failed horridly. I cannot express enough how this is not a competition!! Start off slow, take an idea you have (one idea), and start with it. Follow a logical thought process from the start of what you're wanting to do to the end of it. Only work on one automacro at a time, don't get overwhelmed by the entire process. For bigger macros what I do when I start out is open up a text file and just write down my thought process, step by step. After I get it wrote down I'll make little notes about ideas I have on how to do each part, then if I think of any I'll write down problems with this, or possible problems when players/monsters get involved.
After you have your concepts and needs down on paper you can start flying through developing your macro. You can go to step 1 and look in the manual conditions or options you have to get this job done. The same problem could be solved in many many different ways through the use of macros so two people might come up with completely different options. This is not a problem, this is good! Once you've got your macro into an infant state you can load it up and start testing it. TEST IT ALOT!! If you want something to run 24/7 week after week then you're going to need to think about every oddball situation it might encounter along the way, like; monsters attacking in the middle of it, running out of supplies, getting disconnected, players screwing around with your bot, etc etc etc.
If you can, stay away from things like "run-once" or "locks" if this is your first couple of macros. Lets say you're interrupted in the middle of a macro and the previous parts of your macro are locked, what happens then? Your bot won't be able to resume where it's at in the middle without some support macros to release these locks. A good example of this would be lets say your macro has five steps, you get killed in step 3, you head back to town to respawn. THIS IS THE PERFECT PLACE TO ADD A SUPPORT MACRO. You could add something in like "on map change to town, release all macros". But instead of worrying about that, for now, try using timeouts instead. This way after the timeout comes up it can be triggered again and again without needing to release anything.
If you're having trouble waiting for a specific event that you're testing then remember you can trigger macros in your console by typing "macro macronamehere". If you're using locks and can't figure out why your macro is busting then use the "macro reset" command in your console to find out if it's just not released yet or if you have a lock/release issue somewhere in your macro. I don't know how many times my macros ran fine for 12+ hours then I'd go to bed and after reading logs the next morning found that they broke off something really stupid I never thought about five mins after I left the computer.
I highly suggest getting into macros, they can truely show off the power of openkore and make your bot unique. They can help get away with playing on non-bot friendly servers, and they can make your bot a power house if used correctly. Thats all I'm going to write for now, I think I'm going to go throw up now. Peace out!
'Goblin
begin with here http://wiki.openkore.com/index.php/Macro_plugin
THX to fco2783 & Goblin
greetz
r3f