Page 2 of 2

Re: Help Please MM2 >> RomBot2

Posted: Tue Sep 09, 2014 4:51 pm
by Administrator
Change it to return true instead of just return.

Re: Help Please MM2 >> RomBot2

Posted: Tue Sep 09, 2014 6:29 pm
by Lamkefyned
not detected error

Code: Select all

local running = true;
function macro.main(dt)
  if( not running )
    return true;

  -- other code here.
end

function macro.event(e, data1, data2, data3)
  if( e == "keypressed" ) then
    if( not running and data1 == key.VK_F5 ) then
      start();
    end

    if( running and data1 == key.VK_F6 ) then
      pause();
    end
  end
end

function start()
  print("Started. Press F6 to pause.");
end

function pause()
  print("Paused. Press F5 to continue.");
end

Code: Select all

2014-09-10 01:21:20 : MicroMacro version 1.9.18.260 (Alpha)
2014-09-10 01:21:20 : Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz @2500MHz, Windows 7
2014-09-10 01:21:20 : User privilege: Administrator
-------------------------------------------------------------------------------

2014-09-10 01:26:55 : Load file error code: 7 (Runtime error)
bot.lua:40: functions.lua:2833: 'end' expected (to close 'function' at line 340) near <eof>

Re: Help Please MM2 >> RomBot2

Posted: Tue Sep 09, 2014 7:10 pm
by Administrator
This:

Code: Select all

  if( not running )
    return true;
Needs to be changed to:

Code: Select all

  if( not running ) then
    return true;
  end

Re: Help Please MM2 >> RomBot2

Posted: Tue Sep 09, 2014 7:23 pm
by Lamkefyned
bug fixed tomorrow but are now 3 o'clock in the morning and have to sleep

Re: Help Please MM2 >> RomBot2

Posted: Wed Sep 10, 2014 10:57 pm
by lisa
you are missing an end

Code: Select all

function macro.main(dt)
  if( not running )
    return true;

  -- other code here.
end
needs to be

Code: Select all

function macro.main(dt)
  if( not running )
    return true;
  end
  -- other code here.
end

Re: Help Please MM2 >> RomBot2

Posted: Thu Sep 11, 2014 10:58 am
by Lamkefyned
I am very grateful to all. Thanks a lot

Code: Select all

function exitCallback()
	releaseKeys();
end
atExit(exitCallback);
and for this and the next the same?

Code: Select all

function errorCallback(script, line, message)
	local crashed, pid = isClientCrashed()
	if crashed then
		printf("Attached game client has crashed. Killing client (PID %d)\n", pid);
		warning(script .. ":" .. line .. ": " .. message);
		os.execute("TASKKILL /PID " .. pid .. " /F");
	else
		releaseKeys();

		printf("The game client did not crash.\n");
	end
end
atError(errorCallback);