MM2 Bot-Framework a work in progress..

You may request or share scripts for MicroMacro in this forum.
Message
Author
User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

MM2 Bot-Framework a work in progress..

#1 Post by BlubBlab » Sun Jun 21, 2015 1:44 pm

I started the work in my Bot-Framework here : (*edit*) https://github.com/BlubBlab/Micromacro-2-Bot-Framework

I started with the XML-Tree parsing so that I / we can reuse some some code out of RomBot.

XML-tree parsing works like in the old except that the object is called 'parser' instead of 'xml' through name conflicts.

TODO: One bug I remember was that the syntax check is sometimes too sensitive I will take a look later and document the whole stuff




I took the most of waypointlist.lua and waypoint.lua and added a few things mostly tags.

-id

Code: Select all

<waypoint id="1" x="2508" z="4574" y="340" ">	
</waypoint>
<waypoint id="2" x="2555" z="4580" y="340" ">	
</waypoint>
Simple counting the waypoints so that you know where you are inside the waypoint file even when you copy some together, the file will be automatically rewritten when they out of order or missing. I'm not sure if I should do this it has the down side that XML comments will be erased. I'm not finished with this yet I still have to implement the rewrite function for the xml.???


- randomfollow

Code: Select all

<waypoint x="2508" z="4574" y="340" randomfollow="34,house,37">	
	</waypoint>
With "function CWaypointList:getNextWaypoint(1)" you will get when this is set in the current waypoint a random next waypoint out of the list which can include id's or tags. Because of symmetry I implemented randombefore also. The only hard point I'm think about is what to do when getNextWaypoint is called with something bigger than jump over the point(now) or follow the randomness graph ?

-map

Code: Select all

<waypoint x="2508" z="4574" y="340" map="128">	
	</waypoint>
An optional tag which gave you in addition to the xzy coordinates the map to which it referee can be a name or an id.


I did a while ago in my version I added the _plain feature to CWaypointList:getNearestWaypoint(_x, _z, _y, _start, _end, _plain)
Which allow you to seek waypoint which are only on your level of hight some times the nearest waypoint is the one above or under your on a different level. I had that too often in SoK when I was bulled back .


TODO: Document it , make a decision about id , follow random graph?, check cli(not working)

What want todo next is stripping player.lua of all rom specific stuff and make it working with MM2 and than moving all magic numbers and optional setting into a player.settings.lua. Through this will be also a framework I think I will move every addresses access to a rule list in something like address.settings.lua, so that in player.lua are only function calls in it.

The hardest part is properly making the fight routine generic.
Last edited by BlubBlab on Mon Jun 22, 2015 6:33 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
beanybabe
Posts: 646
Joined: Wed Mar 06, 2013 1:27 am

Re: MM2 Bot-Framework a work in progress..

#2 Post by beanybabe » Sun Jun 21, 2015 6:22 pm

Your lost me at trees. If your going to redo this think about something id like to see.

when making wp now we press 1 and get a wp and other buttons for gather and interact
Id like to have another button for random wp


so we would end up with a wp file like this

Code: Select all

<waypoints >
	<!-- # 3 --><waypoint x="-3779" z="-8480"> x1="-3774" z1="-8480"</waypoint>       note the x1 z1   this gives 2 choices to appear more random.
	<!-- # 4 --><waypoint x="-3654" z="-8639"></waypoint>
	<!-- # 5 --><waypoint x="-3519" z="-8670"></waypoint>
	<!-- # 6 --><waypoint x="-3399" z="-8700"></waypoint>
	<!-- # 8 --><waypoint x="-3034" z="-9034">loadPaths("1-10Pioneers/l2-3_wolf");</waypoint>
</waypoints>
I know you are trying to make it move on its own but the fastest way is just point to point in a congested area. Just adding a few randoms would go a long way to making it look more like person was playing.

press 1 for wp press shift 1 for extra wp alternate.

Another idea was a visual 2d wp editor that you could see a line drawing of your movements overlaid on a map and drag and drop editing in 2d.

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

Re: MM2 Bot-Framework a work in progress..

#3 Post by BlubBlab » Sun Jun 21, 2015 7:09 pm

We have settings.profile.options.WAYPOINT_DEVIATION with which you can randomize the waypoints,
I think what you mean is what I did with randomfollow="wp3,wp6".

You can choose tags or ids(WP number) as reference the next wp used will one out of this list randomly;

I had in my version of rombot also some kind of sphere implemented where you can setup how far you only need to go near the coordinates of the WP. The original idea for that was from robotic where you have a Überschleifkugel which allow you to change course with out doing it in one spot.
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: MM2 Bot-Framework a work in progress..

#4 Post by BlubBlab » Sun Jun 21, 2015 8:46 pm

Okay I got:

I follow the random waypoints when somebody input something bigger or less than 1 now so he will get the ones behind them or the otherway the ones before.

Rename some old tags : nostop, nothread, zone now.

The auto-reindex of the waypoints can be turned on/off in the waypointlist.settings.lua now.

TODO: Documentation, CWaypointList:save(filename, root) finishing(20%)
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: MM2 Bot-Framework a work in progress..

#5 Post by rock5 » Mon Jun 22, 2015 1:55 am

It all sounds awesome. I envy your enthusiasm.
  • 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: MM2 Bot-Framework a work in progress..

#6 Post by BlubBlab » Mon Jun 22, 2015 10:30 am

The idea behind is that you can use it to make a first bot very rapidly based on the code I can get from Rombot but the same time expandable, so that you only need the memory addresses , the rules to read them and maybe some minor settings to use the bot for a new/different MMORPG to make a basic bot who can run waypoints and kill mobs.

*upsi* I see I had a spelling mistake in the name of the repro I will fix this 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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: MM2 Bot-Framework a work in progress..

#7 Post by rock5 » Mon Jun 22, 2015 10:35 am

I know. I suspect that it wont be that easy, though. I wouldn't be surprised if in the end you still have to write A LOT of game specific code to make it work.
  • 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: MM2 Bot-Framework a work in progress..

#8 Post by BlubBlab » Mon Jun 22, 2015 6:33 pm

rock5 wrote:I know. I suspect that it wont be that easy, though. I wouldn't be surprised if in the end you still have to write A LOT of game specific code to make it work.
I'm not sure the first thing which will hit will be moveTo because there are 3 types of MMO:
wow-type like:" Wow, Rom , Archeage" , action-type like: "GW2 ,DP, Neverwinter "and 'click and hit' types like: "Diablo 1-3, DSO, PoE".
each of them needs a very different moveTo(even more fight())


NPC actions, are all tied to the MMO and can't be generalized, loot has mostly a one button solution.

I want to implement a switch for those 3 types in the settings. In the worst case you can overwrite functions inside the classes the same way you can extend them.


So I have the save function working , now the XML validator screaming he don't like squishy code between the tags ><

After that I will document it and move to player.lua...

PS: I relaunched the rep under new name
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: MM2 Bot-Framework a work in progress..

#9 Post by BlubBlab » Wed Jun 24, 2015 2:45 pm

It is a bit much code but here you can see how I think I will 'solve' it:

This is the content of objects.settings.lua

Code: Select all

objects = {};
objects.settings = {};
-- values for object types
objects.settings["PT_NONE"] = -1;
objects.settings["PT_PLAYER"] = 1;
objects.settings["PT_MONSTER"] = 2;
objects.settings["PT_NPC"] = 4;
objects.settings["PT_NODE"] = 4;

objects.funcs ={};

-- eval funcs for object:update()

objects.funcs["objecte_eval_id_and_type"] = function( id ,type )
	
	if( 1 > id or id > 999999 or type == objects.settings["PT_NONE"] )then
		return true;
	else
		return false;
	end
end

objects.funcs["objecte_eval_nameptr"] = function( nameptr )

	if(namePtr == nil or namePtr == 0)then
		return true;
	else
		return false;
	end
end

objects.funcs["objecte_eval_name"] = function( name )

	if(name == nil )then
		return true;
	else
		return false;
	end
end
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: MM2 Bot-Framework a work in progress..

#10 Post by BlubBlab » Wed Jun 24, 2015 4:59 pm

Okay I'm done for today next on the list is Pawn.lua and I'm thinking about using instead of a list a queue with a filter for the objects so you can do this:

EDIT:

Code: Select all

local objectQueue = CObjectQueue();
objectQueue :update()
while(objectQueue:peek( PT_MONSTER))do
    local obj =  objectQueue:poll (PT_MONSTER);
    local pawn = CPawn.new(obj.Address);
    	-- do something
    end
end
--Note update will (re)fill the queue, it is guaranteed that those object are not nil and also updated before.

Besides syntactical sugar it has the advantage that queues are thread-safe (so far I remember), which is better when you are communicating between 2 processes.

Pawn.lua will be a challenge mainly because of the unfix numbers of energies/classes per character you have in different MMORPGS.
Note: Y is also optional


What I found out by way is with the CWaypoints:save(filename) function you can resume waypoints/XML records very easily :D


TODO(ATM): Pawn.lua, Objectqueue.lua and than Player.lua were I do not all functions copy.
EDIT: Objectqueue.class.lua is done this looks nice
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

Celesteria
Posts: 36
Joined: Mon Jun 01, 2015 7:44 am

Re: MM2 Bot-Framework a work in progress..

#11 Post by Celesteria » Thu Jun 25, 2015 12:46 am

BlubBlab wrote:We have settings.profile.options.WAYPOINT_DEVIATION with which you can randomize the waypoints,
It would be nice, if WAYPOINT_DEVIATION can be set via an optional tag (f.e. deviation="123") at the waypoint to overwrite the current value ONLY for this waypoint. It should work similar to the type-tag in the "old" bot. So the way can be created much better and with less code inside the waypoints itself if you f.e. have to run over a small bridge or something like that.

Your idea to automatically rewrite the file on runtime to include the id-tag I dont really prefere. A separate beautify-routine inside the bot would be fine, but not automatically and not at runtime. I am often using dynamic created waypoints and waypoint files (f.e. to handle "smoth" corners or to go back to current location after going to a POV). I am sure this gives a lot of problems if the rewrite is an automatic function.

keep up your work. I am awaiting the new bot and would like to help as much as I can ;)

greetings
Celesteria
I am a botter, but no cheater. So none of my scripts ever use any of the hacks like swimhack, speedhack, wallhack...
I hope you can understand my english. Its not my native language and it has been a long time since I used it the last time :)

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

Re: MM2 Bot-Framework a work in progress..

#12 Post by BlubBlab » Thu Jun 25, 2015 1:29 am

Celesteria wrote:
BlubBlab wrote:We have settings.profile.options.WAYPOINT_DEVIATION with which you can randomize the waypoints,
It would be nice, if WAYPOINT_DEVIATION can be set via an optional tag (f.e. deviation="123") at the waypoint to overwrite the current value ONLY for this waypoint. It should work similar to the type-tag in the "old" bot. So the way can be created much better and with less code inside the waypoints itself if you f.e. have to run over a small bridge or something like that.

Your idea to automatically rewrite the file on runtime to include the id-tag I dont really prefere. A separate beautify-routine inside the bot would be fine, but not automatically and not at runtime. I am often using dynamic created waypoints and waypoint files (f.e. to handle "smoth" corners or to go back to current location after going to a POV). I am sure this gives a lot of problems if the rewrite is an automatic function.

keep up your work. I am awaiting the new bot and would like to help as much as I can ;)

greetings
Celesteria
The tags won't be added in the runtime they will be added when you load the XML file in the empty waypointlist on top of that the behaviour is detachable by either who use the framework or by the one which use the bot in the end. Hm I can added this tag put it is really the last tag I will add or I will end with 1.022.245.214.248 tags :D

Okay I done this hm TODO: the rest of classes:pawn, player,party,skills; top directory: functions.settings.lua and all other missing files; check what is missing on function from MM1; built a switch for loading the 32 or 64-bit version of the LuaXML.dll, testing the files,documentation, and than built an mini-rombot
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: MM2 Bot-Framework a work in progress..

#13 Post by BlubBlab » Fri Jun 26, 2015 3:32 pm

I'm not sure how I go with this. In pawn:update()
I got a huge list of updates I would like them to be turned on/off depending if they are needed.
Originally I thought I could call them by name in for loop but doesn't work inside a class.

Besides let people overwrite the functions any idea?
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: MM2 Bot-Framework a work in progress..

#14 Post by BlubBlab » Sat Jun 27, 2015 6:24 pm

I'm not all finished but I'm to 95% through pawn.class.lua.
I only need to add one more eval func and the switch list for the updates to turn some update out of game when you want it.

The most brain power went into this:

Code: Select all

function CPawn:updateMP()
if not self:hasAddress() then
		self.ActivEnergys = pawns.funcs["init_zero_activ_energy"](self.ActivEnergys);
		return
	end
	local max_energys_peer_char = pawns.settings["max_number_energys_activ"];
	
	
	for i = 1,  max_energys_peer_char *2 , 2 do 
		self.ActivEnergys[i] = addresses.func["energys_"..i..""](self.Address);
		self.ActivEnergys[i+1] = addresses.func["energysMax_"..i..""](self.Address);
	end
	

	
	- -- Prevent division by zero for entities that have no mana
	for i = 1,  max_energys_peer_char *2 do 
		if self.ActivEnergys[i] == 0 then
			self.ActivEnergys[i] = 1;
		end
	end
	if self.Classes[1] == pawns.settings["class_types"]["CLASS_NONE"] then
		self:updateClass()
	end

	local energyStorage = {};
	
	for i = 1,  max_energys_peer_char do 
		energyStorage[i] = classEnergyMap[self.Classes[i]];
	end
	
	;
	
	-- this a bit of geometric maths I hope it works
	--make the lower half
	for i = 1,  max_energys_peer_char/2 do 
		-- make the upper half
		for j = max_energys_peer_char/2,  max_energys_peer_char do 
			if i ~= j then
				if(energyStorage[i] == energyStorage[j]then
					energyStorage[j] = "none";
				end
			end
		end
	end
	-- this will result in mana, Maxmana,rage, Maxrage
	for i = 1,  max_energys_peer_char * 2 do 
		if(i%2 == 0)then
			self.Energys["Max"..energyStorage[i-1]] = self.ActivEnergys[i];
		else
			self.Energys[energyStorage[i]] = self.ActivEnergys[i];
		end
	end
	
	
end
EDIT:
Under the line it is about 80 lines which are game specific logic , 160 lines only game infos, and with the addresses about 30-40 more lines.
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: MM2 Bot-Framework a work in progress..

#15 Post by BlubBlab » Thu Jul 02, 2015 10:23 pm

I debugged on a basic level all classes except pawn.class.lua. I ready to start with player.lua.
I tests also a new mode for the save function with which I can automatically apply the nostop tag in a semantic right order which resulted in finding a small bug which I hope I have fixed in 'save'. I will test and commit later I will also add a getClass function to pawn because they end up now in a table.( all energies also)

Which brings me about thinking how the access of most in rombot is a lot hackish.. I'm not sure what the others think but I'm not happy about it. You often don't come on the right stuff without knowing the internals of the bot at least that was my impression when I worked on the score-userfunction and sought the whole item, inventory, equipment classes about infos and move item functionality.
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: MM2 Bot-Framework a work in progress..

#16 Post by rock5 » Thu Jul 02, 2015 11:19 pm

I'm the one who changed item class to the multiple files like it is now. The class now uses inheritance. item.lua is now a super class or parent class to all the other item classes. The item class is not supposed to be used directly anymore (unless you have the item address). I put as much shared functionality into the item class as I could and only put stuff specific to the different types of items in their respective classes.

I guess it's a bit 'hackish' because it should have ended up with most of the methods in each type of item modified for that particular item but instead I put methods such as moveTo and pickup in the base item class and have it deal with the different types of containers. I did this just because it was easier to manage those functions in one place and to avoid duplication of code.

It's also unusual that the base item class takes an address as it's argument and the container item classes take slot numbers. This couldn't be helped as slot numbers are specific to containers and is the easiest way to access items. Whereas the base item class needs a generic value such as the address which all items have regardless of where the item is. This has the benefit that you can use the item class to get info on any item anywhere as long as you have the address.
  • 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: MM2 Bot-Framework a work in progress..

#17 Post by BlubBlab » Fri Jul 03, 2015 3:59 am

I know what you are meaning but when you look it from the games side then items are a child from equipment, inventory, bank , gildbank , mailbox.
Child is the right term I think it a value which those container contain. If you want to swap it around than item must access all of those objects.

The problem was more that I suspected the equipment slots in the inventory because I didn't know that the class existed and item:moveTo was an enigma(I thought that is take numbers like for the bags to move items to the equip) until I read the code the 3 time but that was more an question about where what is and some design decision. it was only counter intuitive nothing more.

The 'problem' is when I re-designed the pawn class I was forced to change certain containers to make it more flexible. Like you said you access the container directly in most cases in rombot. I know that the 'easy' way but when you learn software design you know that exactly why you shouldn't do that :D . (Yeah with out it it is a hackish style)

Every bit of code which use those must be rewritten in the other case it is only a question of rewiring internally in the get/set methods.

To be fair there are guys out there which would protest even by using getters and setters. I hope I don't mix what what is but there are another concept called value objects.
(http://culttt.com/2014/04/30/difference ... e-objects/)
I'm not sure perhaps you know all of this but here an example:

Code: Select all

waypointlist = waypointlist:add(waypoint)
Doesn't look dramatically but first all possible getter and setters are local which access values you have only objects with which you work.
What really happened here is the waypoint aren't added to the waypointlist on the right side but it created a new waypointlist which include the waypoint in addition to its own. What also would change all stuff which use addresses would take an address object which are only once created. The main advantage is all of this is 100% thread safe because you using inmutable objects

I personally won't write like this it is too 'academically' for this kind of application and it has also its down sides like big overhead and there would be too much to change and I like my values.
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: MM2 Bot-Framework a work in progress..

#18 Post by rock5 » Fri Jul 03, 2015 12:17 pm

When I say 'child' I'm refering to the OO programming term. A child inherits all attributes of the parent plus it has some of it's own attributes. So inventoryItem and bankItem are children of item because they inherit items attributes and methods. Child/parent doesn't apply to the containers such as inventory and bank classes because they are containers of items. Items don't inherit from containers and containers don't inherit from items.


I think with the bot we are mainly dealing with entity objects and, as you pointed out, overhead is an important factor. So I don't think I would start changing things unnecessarily.
  • 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: MM2 Bot-Framework a work in progress..

#19 Post by BlubBlab » Sat Jul 04, 2015 6:37 am

I understood that nothing easier I think we can talk about OO design days I properly wouldn't had used inheriting because those thinks have not much in common besides one is the container for the other. I would have gone for aggregation instead.

I don't want that you change anything but I wanted to point that I must change it in my framework to spare me some work in the future(black box principe) and it would had been a clever move if you had done it the same before. ^^ It is the way I have learned it :ugeek:
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: MM2 Bot-Framework a work in progress..

#20 Post by BlubBlab » Fri Jul 10, 2015 7:33 am

Okay I made some progress I currently at the player.class.lua but that isn't the point ATM.

About OO design besides that pawn isn't a child for object I wondered about some function which are generally screaming for OO implementation yeah most of them are setters and getters but what came to my mind beside getName or getAddress or such stuff:

Code: Select all

 local dis = pawn:getDistance(player:getPos())
It is much more elegant and easier too use than extracting X,Y,Z from both and putting it into a function. I will do the same for angles

The other think is about that pullback or pulldown problem when we are faster than the server allow because we cheating or the server a just bad.

First I thought the best tactic would be going reverse from where I was(to avoid the crossing problem) in the waypoint list and make a limit when we are near enough. Than I came aware that won't work because the point could be far away, next thought checking if I'm on the vector between 2 waypoint but I could be a bit off too , so we go a bit more advanced and calculate the distance from the vector to the current point but only when the point isn't with his measurement point outside inside the definitions mass of the 2 connecting waypoints. (vectors are infinity)

The last part is a bit hard I will see how I can reverse calculate the point on the vector which is the nearest to the other point
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

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests