
--local targetWindowClass = "Aion Client";
local targetWindowName = "Aion Client";

-- Main script
function macro.init()
	win = window.find(targetWindowName);
	if( not win ) then
		error("Could not find Aion window. You must have the game running to use this script.\n", 0);
	end
	procId = process.findByWindow(win);
	if( not procId  ) then
		error("Could not find Aion ID. You must have the game running to use this script.\n", 0);
	end
	procHandle = process.open(procId);
	if( not procHandle ) then
		error("Could not find Aion process. You must have the game running to use this script.\n", 0);
	end
	local module = process.getModuleAddress(procId,"game.dll");
	if( not module ) then
		error("Could not find Aion module. You must have the game running to use this script.\n", 0);
	end
	-- This isn't the level any more some random numbers instead 
	local level = process.read(procHandle,"int", 0xE269A5 + module); 
	print("Random Number : "..level); 
end

function macro.main(dt)
	return false;
end