Page 2 of 2

Re: MicroMacro update; testers needed

Posted: Thu Dec 27, 2012 7:05 pm
by Administrator
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.

Re: MicroMacro update; testers needed

Posted: Thu Dec 27, 2012 11:05 pm
by rock5
That seems to have fixed it.

Re: MicroMacro update; testers needed

Posted: Thu Jan 03, 2013 5:50 am
by Jandrana
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?

Re: MicroMacro update; testers needed

Posted: Thu Jan 03, 2013 12:05 pm
by Administrator
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.

Re: MicroMacro update; testers needed

Posted: Thu Jan 03, 2013 3:29 pm
by BlubBlab
This ask is may a littel bit to soon but will be ever there an 64 -bit version of MM?

Re: MicroMacro update; testers needed

Posted: Thu Jan 03, 2013 4:21 pm
by Administrator
If all of the dependencies allow for it, then perhaps there will be.

Re: MicroMacro update; testers needed

Posted: Fri Jan 04, 2013 5:45 am
by Jandrana
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
....

Re: MicroMacro update; testers needed

Posted: Fri Jan 04, 2013 2:06 pm
by Administrator
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.

Re: MicroMacro update; testers needed

Posted: Fri Jan 25, 2013 5:57 am
by grande
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)

Re: MicroMacro update; testers needed

Posted: Fri Jan 25, 2013 7:21 am
by rock5
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.

Re: MicroMacro update; testers needed

Posted: Fri Jan 25, 2013 12:06 pm
by grande
Ahhh soooo, thanks Rock5

Re: MicroMacro update; testers needed

Posted: Sat Feb 09, 2013 5:46 am
by Rintintin
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..

Re: MicroMacro update; testers needed

Posted: Wed Mar 06, 2013 1:33 am
by beanybabe
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.

Re: MicroMacro update; testers needed

Posted: Wed Mar 06, 2013 2:04 am
by rock5
Try these to show the error. Put them both in the waypoints folder and start disenchanting.xml as usual.