Page 1 of 1

Attempt to perform an Arithmetic on Global

Posted: Tue Nov 16, 2010 7:26 am
by chaoticxistence
Hi, Im begining scripting with MicroMacro and i have a mistake that i can't solve.
This is the extraction of the code.

Code: Select all

HPPercent = 75;
HPCurrent = memoryReadInt( MyProcess, HPCurrentAddress);
HPMax = memoryReadInt( MyProcess, HPMaxAddress);
printf("Found HP Current [%d] \n", HPCurrent);
printf("Found HP Max [%d] \n", HPMax);
if( HPPercent > ((HpCurrent*100)/HPMax) ) then
    keyboardPress(key.VK_8);
  end
The error i got its attempt to perform an Arithmetic on Global HPCurrent a nil value. I see the Hp Current and HP max results correctly.
Anyone can tell me a clue?
Thanks in advance.

Re: Attempt to perform an Arithmetic on Global

Posted: Tue Nov 16, 2010 9:21 pm
by Administrator
On which line does the error come from?

If it's this:

Code: Select all

if( HPPercent > ((HpCurrent*100)/HPMax) ) then
then your problem is that HpCurrent is not the same as HPCurrent.

Re: Attempt to perform an Arithmetic on Global

Posted: Tue Nov 16, 2010 11:21 pm
by chaoticxistence
Sorry about i forgot the line that have the error. Yes, you are right about this line. Never thought that the var can be diferent because i only used one var with this name. I checked the var and wasn,t empty.
Maybe i must to investigate about it and learn more about the variables. Maybe i,m not so clear with my english.
Thanks for your fastest answer.

-- Edit:
Problem solved. Only was that you say, the var didn't be the same. But this made me learn another ways to code it and i think i improved it. Thanks.