
--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
	
	local rand0 = process.readPtr(procHandle,"int",module,0xED8651D0);
	print("RAion : "..rand0); 
	local rand1 = process.readPtr(procHandle,"int",module,0xED8651D0,true);
	print("RAion : "..rand1); 
	local rand3 = process.readPtr(procHandle,"int",module,0xED8651D0,{true});
	print("RAion : "..rand3); 
	if(process.is32bit(procHandle))then
		print("Our Process is 32-bit");
	end
	-- can fail if the adresse is too big
	--local rand2 = process.readPtr(procHandle,"int",module,0xED8651D0,false);
	--print("RAion : "..rand2); 
	-- can fail if the adresse is too big
	--local rand4 = process.readPtr(procHandle,"int",module,0xED8651D0,{false});
	--print("RAion : "..rand4); 
	process.close(procHandle);
end

function macro.main(dt)
	return false;
end