Page 1 of 1

Reading a memory address

Posted: Sun Sep 07, 2008 8:15 am
by Impala
how would I go about making a script that looks at an address (HP of a character) and watches that address until the value goes to a certain point. When it reaches that point, I'd like to simulate pressing 1 on the keyboard.

Also, how do I simulate pressing spacebar in given intervals?


I am going to make a script for this new game that is in beta, it has a bot built into the game.

Official site: http://co.enjoymmo.com/

To get a beta key: http://www.mmorpg.com/betas/chaosonline_beta.cfm

Re: Reading a memory address

Posted: Sun Sep 07, 2008 5:34 pm
by Administrator
Read the address into a variable using memoryReadInt or a similar function, then use a conditional statement.

Code: Select all

  local HP = memoryReadInt(proc, 0x12345678);
  local MaxHP = memoryReadInt(proc, 0x87654321);

  -- make sure we don't divide by 0
  if( MaxHP == nil or MaxHP == 0 ) then MaxHP = 100; end;

  local healPercent = 50;
  local currentPercent = HP / MaxHP;
  if( currentPercent <= healPercent ) then
    -- we are below 50% HP, heal.
    keyboardPress(key.VK_1);
  end