Reading a memory address

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
Impala
Posts: 14
Joined: Mon Aug 18, 2008 6:58 pm

Reading a memory address

#1 Post by Impala » Sun Sep 07, 2008 8:15 am

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

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Reading a memory address

#2 Post by Administrator » Sun Sep 07, 2008 5:34 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests