MicroMacro 2 alpha build

Message
Author
User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#21 Post by BlubBlab » Tue Aug 05, 2014 7:27 am

I think the true might be a little bit more complicated because dynamically loading code is something you will always have to do otherwise the whole bot became to static and can't adjust for multiple purposes.

The coroutine structure maybe a little bit confusing because you have to realize that the whole bot already running inside a coroutine, and yrest basically calls coroutine.yield but more imported is that the functions from the Timer also runs in another coroutine.

So one thing is the timer(s) depends on coroutines the other is through the fact that only one coroutine can run at the time you can effectively suspend the other coroutines / put them in wait , without the coroutine framework you don't have this.

Theoretically admin could run the timer between the calls manually but one timer isn't enough, when I'm thinking about GMList()

The point is you would need also call the timed functions short so that normal things can also run. Here a picture for better understanding:
Image

I implemented a solution for this in another class without coroutines, you simple call it after the "normal" state call.
It has a time disk and you can set a maximum how much time the whole disk can consume, a parallel to yrest I added an example on the bottom of the file.
Last edited by BlubBlab on Mon Sep 08, 2014 7:38 am, edited 1 time in total.
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
Administrator
Site Admin
Posts: 5305
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 2 alpha build

#22 Post by Administrator » Tue Aug 05, 2014 11:53 am

I also wrote some classes for dealing with timed functions. You might want to take a look at it. The code is clean and simple.
Attachments
taskqueue.zip
(1.39 KiB) Downloaded 468 times

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#23 Post by BlubBlab » Tue Aug 05, 2014 6:54 pm

Yeah I also thought about making a class for the state/task before I thought It would be too much overhead but after I saw you started with it I done it too. :D
I will test tomorrow my code, too many possible error sources and I don't trust unpack() that it will behave like I think.
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#24 Post by BlubBlab » Thu Aug 07, 2014 6:52 am

Okay first a small doc & spelling error, in the doc it is called "timer" but in code you must write "time" for guys who use copy&past that can be end in frustrating bug hunting.(with out admin's example I wouldn't found it)

When I started I didn't know how much don't work because I wasn't aware that all moduls were deactivated, so I it didn't work from the beginning. I includes the class modul myself, the cli modul also but I did lay "setTextColor" to an dead end ..., because the new MM didn't have this option yet.

At the moment the first tests worked but I want to remove some workarounds first before that I need to find out what to do with the time I'm not sure add the moment I adding time I can also make it easier and subtract the time like admin did but in some rare cases I need absolute time ms, so better I find out now than later.
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
Administrator
Site Admin
Posts: 5305
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 2 alpha build

#25 Post by Administrator » Thu Aug 07, 2014 12:57 pm

Yes, it was originally named 'timer' but renamed 'time'.
When I started I didn't know how much don't work because I wasn't aware that all moduls were deactivated, so I it didn't work from the beginning
What do you mean? Nothing should be deactivated.
I includes the class modul myself, the cli modul also but I did lay "setTextColor" to an dead end ..., because the new MM didn't have this option yet.
Yes, as of right now, colors are not exposed in the normal CLI mode; only Ncurses mode.


I wrote up a tutorial on timing here: http://www.solarstrike.net/wiki/index.p ... 6_Examples

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#26 Post by BlubBlab » Thu Aug 07, 2014 1:44 pm

Administrator wrote:Yes, it was originally named 'timer' but renamed 'time'.
When I started I didn't know how much don't work because I wasn't aware that all moduls were deactivated, so I it didn't work from the beginning
What do you mean? Nothing should be deactivated.
I think when you deactivated the coroutine framework in lib.lua you deactivated the whole files. So far I could see lib.lua load the other moduls from /lib/mods with the help of config.lua, at least I can say class.lua and cli.lua weren't loaded. I tried to load them by changing config.lua didn't help.
Administrator wrote:
I includes the class modul myself, the cli modul also but I did lay "setTextColor" to an dead end ..., because the new MM didn't have this option yet.
Yes, as of right now, colors are not exposed in the normal CLI mode; only Ncurses mode.


I wrote up a tutorial on timing here: http://www.solarstrike.net/wiki/index.p ... 6_Examples
Ah okay that is tricky.
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
Administrator
Site Admin
Posts: 5305
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 2 alpha build

#27 Post by Administrator » Thu Aug 07, 2014 9:05 pm

BlubBlab wrote: I think when you deactivated the coroutine framework in lib.lua you deactivated the whole files. So far I could see lib.lua load the other moduls from /lib/mods with the help of config.lua, at least I can say class.lua and cli.lua weren't loaded. I tried to load them by changing config.lua didn't help.
Those are MicroMacro 1 files; they will not work with MM2.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#28 Post by BlubBlab » Fri Aug 08, 2014 12:09 pm

Yeah I know but like I said some stuff ended in my code through copy&paste.

Okay by the way your example was wrong :D
This will work:

Code: Select all

function macro.init()
  startTime = time.getNow()
end
 
function macro.main(dt)
  if( time.diff(time.getNow(),startTime) > 3 ) then
    print("3 seconds have elapsed.");
    startTime = time.getNow(); -- Now reset it
  end
end
So I'm nearly done the remove of the cli.lua I will decide when MM2 can color or not.
I need input&testing^^

EDIT: I added a api for it & some small changes.
Attachments
taskframework.zip
(21.48 KiB) Downloaded 435 times
Last edited by BlubBlab on Sat Aug 09, 2014 2:11 pm, edited 1 time in total.
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
Administrator
Site Admin
Posts: 5305
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 2 alpha build

#29 Post by Administrator » Fri Aug 08, 2014 12:13 pm

What part is wrong? If time.diff() only gets one parameter, it assumes time.getNow() as the first comparison point. Did it give you an error or behave unexpectedly?

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#30 Post by BlubBlab » Fri Aug 08, 2014 12:38 pm

Yeah with one parameter I got an error. The other things was the name was wrong...again.
Last edited by BlubBlab on Sat Aug 09, 2014 2:16 pm, edited 1 time in total.
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
Administrator
Site Admin
Posts: 5305
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 2 alpha build

#31 Post by Administrator » Fri Aug 08, 2014 2:18 pm

I'm assuming that is just because the change was made after I created that binary. Ignore it for now.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#32 Post by BlubBlab » Sat Aug 09, 2014 2:24 pm

Yeah anyway for the moment I'm finished with my work for now.
In the zip file from me in the post above is an example( main.lua ) that work with the framework. I also added a documentation today.

So I can only wait now until someone screams bug bug.(maybe I should post in in another section?)
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: MicroMacro 2 alpha build

#33 Post by beanybabe » Tue Aug 19, 2014 10:38 am

here is an idea for you to think about adding support for sub waypoints so a char can make changes randomly in how it moves around things. this is little move random but this allows for diverts in the path.

/ - - - - - -\
- - - - - tree - - - -
\ - - - - - -/

this should be easy to include it just might be like (x,y,z) (x,y,x)~(x,y,z) (x,y,z) to keep it from being confusing it may need be limited to 1 or 2 per path and a divert may not have a divert on it.

this could make waypoints in public view move in more natural way as players tend to change up there movements.

Ps I read some of the other posts on multi char and had no idea the complications in coding this.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#34 Post by BlubBlab » Tue Aug 19, 2014 11:25 pm

Since admin didn't say anything .... I thought a little (previously)bit about waypoints myself for that part I would better suggest a tag(s)

Better a list in the tag( number or tag name)

Code: Select all

<waypoint x="3745" z="21211" y="179" randomfollow="1,5,park,12">	</waypoint>
and if the waypoint should be excluded in the normal (not (randomfollow or direct picked)) run:

Code: Select all

<waypoint autofollow="false" x="3745" z="21211" y="179" >	</waypoint>
To do that more simpler the waypoints need automatically ID's when created and consistory checked&fixed when loaded. To be hornets I screw a lot in the past when I copied waypoint files into each other after that finding the correct waypoint were things go wrong included a lot of unnecessary search because I lost track of the number(ID) of the waypoint.

So far I know MM2 has no XML module until now, I could make some with LuaXML(http://viremo.eludi.net/LuaXML/ or https://matthewwild.co.uk/projects/luaexpat/ ) like I did for tasks I think admin should say something about what he planned.

EDIT: I played with it a little LuaXML is nicely simple and you can map lua tables direct to XML and reverse only feature what is missing is a syntax check. I would need to program it myself :( . LuaExpat is was MM1 use the libs are based on it and it is very complicate, the makefiles are a not suited for MinGW I would need to adjust them from hand and you need to download Expat(C) for it, reversing a table to be saved as XML seems not an easy task with it. AH and I forgot the windows project is on stand of VC 6 (10 years ago?)

Syntax check seems not to be this much of complicate every < must follow a > and every " must be closed with another " until > (or < ?)
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#35 Post by BlubBlab » Wed Aug 20, 2014 5:34 am

Something else I thought a little bit about the design and work splitting:

I did already implemented the task part(I would recommend suggestion on it, a zip file a few post earlier)
When I'm doing the XML part I will automatically also do the skill and waypoint part because of the XML.

XML and tasks are more of an module part of a higher layer like in MM1 because I started fully documented it and avoid dead code in the modules like in MM1(found a lot of it) . I would make a framework of it.(or better said the new XML lib module)

When I'm finished with it and if I have still fun on it I would start making a meta-framework which is more like a skeleton for future bots.
Here a picture of what I think:
Image
What do you think?
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
Administrator
Site Admin
Posts: 5305
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro 2 alpha build

#36 Post by Administrator » Wed Aug 20, 2014 12:50 pm

At this time, I have no plan to include XML parsing. All of that could be done in Lua instead. Not only will it be easier in Lua, it also means less code, and it will be more robust.

One thing that was a huge pain in RoM Bot was that every time we wanted to add a new option to the XML, we also had to add a bunch of code to validate and support it. If the profiles and waypoints were all in Lua, that much would be automatic.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#37 Post by BlubBlab » Wed Aug 20, 2014 7:05 pm

okay I tested a little I loaded an waypoint file as a table and than saved by using a lua save library.

Lua looks like this:

Code: Select all

return {
-- Table: {1}
{
   {2},
   {3},
   {4},
   {5},
   [0]="waypoints",
},
-- Table: {2}
{
   [0]="waypoint",
   ["x"]="4972",
   ["y"]="103",
   ["z"]="-1915",
},
-- Table: {3}
{
   [0]="waypoint",
   ["x"]="4972",
   ["y"]="104",
   ["z"]="-1915",
},
-- Table: {4}
{
   [0]="waypoint",
   ["x"]="4972",
   ["y"]="105",
   ["z"]="-1915",
},
-- Table: {5}
{
   [0]="waypoint",
   ["x"]="4972",
   ["y"]="106",
   ["z"]="-1915",
},
}
I can only say I have even less the clue where I bin without the comments, and you also need update the look up table(table 1{%d}) when you add extra waypoints from hand. Simple configuration and function can be done in lua(like the wikipedia config file in php) but large data structures need something else, also Rock5 can't update rombot for MM2 with out XML support because we cold not use the old waypoint files. (yeah we could make a converter but hell we also need XML support for this..bit in its own tail)
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: MicroMacro 2 alpha build

#38 Post by rock5 » Thu Aug 21, 2014 4:49 am

Yeah table.save does a good job of saving tables but is hard to read. We could probably just do something like

Code: Select all

return {
    type = "TRAVEL",
    onload = [[
        variable1 = "something"
        variable2 = number
        function relog()
            -- blah blah
        end
    ]],

    waypoints = {
        [1] = {X=123, Z=234, Y=10, tag="start", action = "if RoMScript("Daily_count()") == 10 then relog() end"},
        [2] = {X=125, Z= 250, Y=10},
        etc.
    },
}
I don't know if this is easy enough though. It's so easy for an inexperienced user to miss a comma or bracket in lua. Maybe there is some other way we could make this easier and clearer.
  • 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

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: MicroMacro 2 alpha build

#39 Post by BlubBlab » Thu Aug 21, 2014 6:16 am

Yeah MM1 use a different lua table.save(..) than I used but which ever you choose every time you add or remove a waypoint you can update your index, do that with a waypoint file with 30 or more waypoints a few times and you run nuts.(Do something like for KS).

EDIT:
What I used was not more than this:

Code: Select all

xml = require("LuaXml")
local xfile = xml.load("p1.xml"); 
table.save(xfile,"new.lua");
also
xml.save(xfile,"new.xml")
exists for saving XML.

EDIT 2:

Let me go through the options again
1.) Using table.save()/ table.load() implementation(s)
+ simple to use
- hard to follow
- really hard to update from hand
- not compatible with the old rombot XML files.

2.) LuaXML
+ simple to use
+ easy to follow
+ easy to update from hand
- No XML validation, need a own implementation or try using (https://github.com/d-led/xerceslua)
- if we/I use xerceslua need we need also LuaBridge( I need for Lua5.2 update LuaBridge inside xerceslua ) and have 2 additional dlls
- if we/I use xerceslua we need may also a dtd XML schema
(I honestly think using xerceslua is not a so good idea better do some own implementation in lua)

3.) LuaExpat
+ easy to follow
+ easy to update from hand
+ has XML validation
- api is complicate
- structure handling is hard to follow in xml.lua
- no simple way to save table as XML or load is as table
- make files/project folder need some update
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: MicroMacro 2 alpha build

#40 Post by rock5 » Thu Aug 21, 2014 8:42 am

BlubBlab wrote:every time you add or remove a waypoint you can update your index, do that with a waypoint file with 30 or more waypoints a few times and you run nuts.
Well if you leave out the index numbers it's easy, eg.

Code: Select all

waypoints ={
        {X=123, Z=234, Y=10, tag="start", action = "if RoMScript("Daily_count()") == 10 then relog() end"},
        {X=125, Z= 250, Y=10},
I'm pretty sure the table will still be created in index order and adding and removing waypoints is easy, just insert or delete lines.
  • 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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests