MicroMacro update; testers needed

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro update; testers needed

#21 Post by Administrator » Thu Dec 27, 2012 7:05 pm

First, try changing safeYield() in lib/lib.lua:145:

Code: Select all

-- Runs a coroutine in a protected state, if available
function safeYield()
	-- make sure we're not trying to yield in the main thread
	-- do nothing.
	local co, main = coroutine.running();
	if( co == nil or main ) then
		return;
	end

	--if( cocoAvailable ) then
		local status, err = pcall(coroutine.yield);

		if( status ~= true ) then
			setTextColor(cli.yellow);
			error(err, 3);
		end
	--[[else
		coroutine.yield();
	end]]
end
That now causes a proper error message including script and line numbers. Makes it easier to track down. It also ignores the yield when ran from the (back-end) main thread.

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

Re: MicroMacro update; testers needed

#22 Post by rock5 » Thu Dec 27, 2012 11:05 pm

That seems to have fixed it.
  • 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

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: MicroMacro update; testers needed

#23 Post by Jandrana » Thu Jan 03, 2013 5:50 am

rock5 wrote:os.clock() has increments of about 1ms. It returns values in seconds and fractions of a second. If you need even more accuracy you can use getTime(). getTime() returns a table, though, so you have to use another function deltaTime() to return the difference between 2 getTimes(). So you would use it like this

Code: Select all

starttime = getTime()

....

elapsedtime = deltaTime(getTime(),starttime)
I believe this returns values in ms and fractions of ms.
A bit late, but thank you rock for that info.


Some question regarding the new MM:
I was wondering if it would be possible to get a stack trace, if an error happens?

Is there some kind of reflection support available in LUA? Esp, can you get the name of a function during runtime, maybe the context/module where a function has been defined?

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

Re: MicroMacro update; testers needed

#24 Post by Administrator » Thu Jan 03, 2013 12:05 pm

Jandrana wrote: Some question regarding the new MM:
I was wondering if it would be possible to get a stack trace, if an error happens?
A stack trace has always been available in log.txt. You can also use the debug.traceback() function if you need.
Is there some kind of reflection support available in LUA? Esp, can you get the name of a function during runtime, maybe the context/module where a function has been defined?
What do you mean by reflection support?

You can get the function's name at runtime:

Code: Select all

local function myFunc()
 print(debug.getinfo(coroutine.running(), "n").name);
end
Telling where a function has been defined probably won't work so well. Lua is too dynamic for that.

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

Re: MicroMacro update; testers needed

#25 Post by BlubBlab » Thu Jan 03, 2013 3:29 pm

This ask is may a littel bit to soon but will be ever there an 64 -bit version of MM?
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: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: MicroMacro update; testers needed

#26 Post by Administrator » Thu Jan 03, 2013 4:21 pm

If all of the dependencies allow for it, then perhaps there will be.

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: MicroMacro update; testers needed

#27 Post by Jandrana » Fri Jan 04, 2013 5:45 am

Administrator wrote:
Jandrana wrote: Some question regarding the new MM:
I was wondering if it would be possible to get a stack trace, if an error happens?
A stack trace has always been available in log.txt. You can also use the debug.traceback() function if you need.

You can get the function's name at runtime:

Code: Select all

local function myFunc()
 print(debug.getinfo(coroutine.running(), "n").name);
end
Telling where a function has been defined probably won't work so well. Lua is too dynamic for that.
Thank you for your that information. That looks cool. Seems I still need to learn more about the built in abilities of LUA.
Administrator wrote:
Is there some kind of reflection support available in LUA? Esp, can you get the name of a function during runtime, maybe the context/module where a function has been defined?
What do you mean by reflection support?
Reflection means the ability of a programming language to provide functions / methods to "talk" about itself (the objects that make up the language itself)

Examples:
- ask an object about it's class
- ask a function about it's name
- ask anonymous functions about their context of definition
- ask the system to return all objects of a certain class
....

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

Re: MicroMacro update; testers needed

#28 Post by Administrator » Fri Jan 04, 2013 2:06 pm

Jandrana wrote: Reflection means the ability of a programming language to provide functions / methods to "talk" about itself (the objects that make up the language itself)

Examples:
- ask an object about it's class
- ask a function about it's name
- ask anonymous functions about their context of definition
- ask the system to return all objects of a certain class
....
There actually are no objects in Lua, but with tables you can emulate classes. One of the functions pushed into the class metatable is is_a(). That will let you tell what kind of class it is.

Code: Select all

if( classB:is_a(classA) ) then
  -- class B is either the same as class A or inherits from it.
end
In order to return all objects of a certain class, I would recommend making an object manager class to handle that. Shouldn't be too hard to do.

User avatar
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: MicroMacro update; testers needed

#29 Post by grande » Fri Jan 25, 2013 5:57 am

MM stops and gives this error at the end of rock5's AT waypoint:

Code: Select all

Did not find any crashed game clients.
5:51am - [string "..."]:577: attempt to call field 'mod' (a nil value)
Edit: It's not just happening at the end of the AT file. Seems to be random? Recent error:

Code: Select all

Did not find any crashed game clients.
6:15am - [string "..."]:72: attempt to call field 'mod' (a nil value)
This appears to have been right around transition from one WP to another but did not see the usual "loading path" message

Edit yet again.. this is getting to be crashtastic. I guess nothing works with userfunctions and stuff that used to work before...

crashes when trying to use a snoop port function that worked fine before...

Code: Select all

6:46am - ...scripts/rom/userfunctions/userfunction_worldtraveler.lua:156: attemp
t to call field 'gfind' (a nil value)

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

Re: MicroMacro update; testers needed

#30 Post by rock5 » Fri Jan 25, 2013 7:21 am

string.gfind and math.mod are not supported in lua 5.2 which is why Administrator has been waiting for me to commit the new version of the bot that includes changes that make it 5.2 compatible.

I just posted an updated version of AT that includes support for 5.2. It needs testing so please check it out.
http://www.solarstrike.net/phpBB3/viewt ... 919#p46919

Other userfunctions that use those removed functions will need to be updated. It's easy to update. In most cases string.gfind can be replaced with string.gmatch and math.mod can be replaces with math.fmod. They should be similar functions.
  • 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
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: MicroMacro update; testers needed

#31 Post by grande » Fri Jan 25, 2013 12:06 pm

Ahhh soooo, thanks Rock5

User avatar
Rintintin
Posts: 55
Joined: Tue Jan 01, 2013 7:45 am
Location: Germany

Re: MicroMacro update; testers needed

#32 Post by Rintintin » Sat Feb 09, 2013 5:46 am

I missed a skill in the Skills-DB for the Classcombo Rogue/Mage. So I added the following line in my local file:

Code: Select all

	<skill name="ROGUE_ENCHANTED_THROW" id="491178" casttime="1" type="buff" buffname="501279" target="self" />
But this is not animpact of the update, though. I guess it never has been in the skills.xml

regards..

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

Re: MicroMacro update; testers needed

#33 Post by beanybabe » Wed Mar 06, 2013 1:33 am

The code on this page will not run with the beta but will run on older version. I dont know how to get it to list what the error is or to trace.

http://www.solarstrike.net/phpBB3/viewt ... =27&t=3144




0:16am - C:/micromacro/scripts/rom/classes/waypointlist.lua:83: Failed to compil
e and run Lua code for waypointlist onLoad event.


AL lib: FreeContext: (003D3E08) Deleting 1 Source(s)
Please enter the script name to run.
Type in 'exit' (without quotes) to exit.

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

Re: MicroMacro update; testers needed

#34 Post by rock5 » Wed Mar 06, 2013 2:04 am

Try these to show the error. Put them both in the waypoints folder and start disenchanting.xml as usual.
Attachments
Disenchanting.lua
(1.42 KiB) Downloaded 139 times
Disenchanting.xml
(120 Bytes) Downloaded 133 times
  • 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

Locked

Who is online

Users browsing this forum: Ahrefs [Bot] and 47 guests