Question about plugin development

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
eccwall
Noob
Noob
Posts: 2
Joined: 03 Jan 2010, 03:01
Noob?: Yes

Question about plugin development

#1 Post by eccwall »

dear all,

I have one main question about openkore. I have been using it since it firsts versions and now I want to develop a small plugin (to begin!).

I'm a bit confused between the Macro plugin, and the "others" plugins. I already read the manuals and wiki, but still can't understand what I should use. I have seen that "macros.txt" have their own syntax (or a minimal perl syntax? not too sure about), but is not as strong and complete as pure Perl.

I have also seen some plugins that use entire Perl syntax (.pl files), but I don't know what are the available libraries that I can use, or the API that I can use from openkore (is there any reference? or I have to be checking the different sources files to get the different functions openkore provides?, for example for the plugin lifecycle)

What i want to do is a (i guess)simple plugin to autobuy from player stores (check if items are availables then buy if price<=X).
At first I thought on use the "vl" console command, and then parse completely the output using regular expressions (i love regexps!), but i then realize that is an "ugly" wait to achieve that. I guess that openkore have the needed functions to check the vender list without having to use the "vl" console command, and the regexps.

I hope you can answer my first question and also give me some links for the openkore reference (if it exists!) so I can start coding the plugin soon. Well, if no reference or documentation about exists, I will have to check the source.

Thanks in advance.

kali
OpenKore Monk
OpenKore Monk
Posts: 457
Joined: 04 Apr 2008, 10:10

Re: Question about plugin development

#2 Post by kali »

I'm a bit confused between the Macro plugin, and the "others" plugins. I already read the manuals and wiki, but still can't understand what I should use. I have seen that "macros.txt" have their own syntax (or a minimal perl syntax? not too sure about), but is not as strong and complete as pure Perl.
The macro plugin is an OpenKore plugin that enables a domain-specific language (DSL) for OpenKore. See wikipedia about DSLs in general. The macro plugin only enables the DSL, you still have to write the macro that the plugin will run.
I have also seen some plugins that use entire Perl syntax (.pl files), but I don't know what are the available libraries that I can use, or the API that I can use from openkore (is there any reference? or I have to be checking the different sources files to get the different functions openkore provides?, for example for the plugin lifecycle)
Those other plugins, like the macro plugin, is written in Perl and hooks up to OpenKore itself. You can use any library you want, the real problem is when you're distributing your plugin, you have to make sure your recipients are able to access the same libraries that you use. We've lost the old documentation about plugins, but try grepping the whole OpenKore source files for Plugin:: and you'll find the places you can hook into.
What i want to do is a (i guess)simple plugin to autobuy from player stores (check if items are availables then buy if price<=X).
At first I thought on use the "vl" console command, and then parse completely the output using regular expressions (i love regexps!), but i then realize that is an "ugly" wait to achieve that. I guess that openkore have the needed functions to check the vender list without having to use the "vl" console command, and the regexps.
I believe I already have written a plugin similar to what you have mentioned. I'm currently in a restaurant so I can't really browse the svn repo for you, but try your luck there. Post back here if you can't find it and I'll see if I can rouse myself from laziness and find it :) Do look at the other plugins, I'm sure you'll learn many different techniques there.
I hope you can answer my first question and also give me some links for the openkore reference (if it exists!) so I can start coding the plugin soon. Well, if no reference or documentation about exists, I will have to check the source.

Thanks in advance.
Trust in the source, Luke :)
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.

kali
OpenKore Monk
OpenKore Monk
Posts: 457
Joined: 04 Apr 2008, 10:10

Re: Question about plugin development

#3 Post by kali »

http://openkore.svn.sourceforge.net/vie ... iew=markup

Here you go.

If you're improving on this plugin (or learning from it) as compensation I request that you contribute back whatever you have learned or built on so that future developers can learn from you too :)
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.

eccwall
Noob
Noob
Posts: 2
Joined: 03 Jan 2010, 03:01
Noob?: Yes

Re: Question about plugin development

#4 Post by eccwall »

Big thanks for the reply!
I checked the link, is very clear so I think i'll improve some things and use this to learn some stuff.
If you say there's no documentation about Plugins or has been lost (asides from macro), I can write it while developing what I want.

Will start to work in this today or tomorrow, after my new linux installation ends (:
(i can't code without Vim! and i dont like cygwin)

thanks again!

Locked