View Full Version : What is wrong with this HpCheck Function?
i am trying to determine if i need to eat or not, but i keep getting
[Error] (317:28): Variable Expected at line 316
Compiling failed.
Line 316 is if not (getMMLevels('hp','orange') > 1)) then
Function HPchecker: Boolean;
var
color:String;
Begin
result:=true;
if not (getMMLevels('hp','orange') > 1)) then
Begin
Result := False
WriteLn('We Are Healthy');
end;
if (getMMLevels('hp','Orange') > 1)) then
Begin
result:=True;
WriteLn('We Need To Eat');
Eat;
end;
xtrapsp
03-13-2012, 09:19 AM
Function HPchecker: Boolean;
var
color:String;
Begin
result:=true;
if not (getMMLevels('hp','orange') > 1)) then
Begin
Result := False
WriteLn('We Are Healthy');
end;
if (getMMLevels('hp','Orange') > 1)) then
Begin
result:=True;
WriteLn('We Need To Eat');
Eat;
end;
When creating the HP you shouldn't use this 'Orange' bit, unless your referencing to a colour like in ACA
so in var
var
Colour:=String
Orange:=111111
Red:=222222
something like that, those numbers aren't right
Sirenia
03-13-2012, 09:28 AM
function CurrentHP: integer;
var
s: string;
begin
Result := GetMMLevels('health', s);
end;
procedure Eat;
var
Lobster, X, Y: integer;
begin
Lobster := DTMFromString('mlwAAAHicY2dgYBBmhGBJIJYAYj4gZoeyM4 HyVUBcBMQ5QFwKxIVAXAbECwLEgSQTVszPgBsw4sFQAAAAAATZ ');
if CurrentHP < EatAt then
begin
FindDTM(Lobster, X, Y, MSX1, MSY1, MSX2, MSY2);
Mouse(X, Y, 7, 7, false);
WaitOption('10', 1500);
Wait(1000 + random(200));
repeat
FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2);
Mouse(X, Y, 7, 7, false);
WaitOption('at', 1500);
Wait(1000 + random(200));
until CurrentHP = TotalHP
if FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2)then
begin
Mouse(X, Y, 7, 7, false);
WaitOption('ll', 1500);
Wait(500 + random(200));
end;
end;
FreeDTM(Lobster);
end;
CurrentHP made by RyGuy, Eat made by me :)
function CurrentHP: integer;
var
s: string;
begin
Result := GetMMLevels('health', s);
end;
procedure Eat;
var
Lobster, X, Y: integer;
begin
Lobster := DTMFromString('mlwAAAHicY2dgYBBmhGBJIJYAYj4gZoeyM4 HyVUBcBMQ5QFwKxIVAXAbECwLEgSQTVszPgBsw4sFQAAAAAATZ ');
if CurrentHP < EatAt then
begin
FindDTM(Lobster, X, Y, MSX1, MSY1, MSX2, MSY2);
Mouse(X, Y, 7, 7, false);
WaitOption('10', 1500);
Wait(1000 + random(200));
repeat
FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2);
Mouse(X, Y, 7, 7, false);
WaitOption('at', 1500);
Wait(1000 + random(200));
until CurrentHP = TotalHP
if FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2)then
begin
Mouse(X, Y, 7, 7, false);
WaitOption('ll', 1500);
Wait(500 + random(200));
end;
end;
FreeDTM(Lobster);
end;
CurrentHP made by RyGuy, Eat made by me :)
You got a nice infinite loop right there if you got no lobster in your inventory.
Also, before doing anything, you should make sure that the FindDTM function actualy found something.
Sirenia
03-13-2012, 09:36 AM
notice it says IF at the start... so IF it finds lobsters in bank then i WILL get lobsters in my inv... Ive been using this method for my modified astral crafter by ryguy for over a week now and it havent fucked me once
EDIT: ur maybe alittle right and this would maybe do better? procedure Eat;
var
Lobster, X, Y: integer;
begin
Lobster := DTMFromString('mlwAAAHicY2dgYBBmhGBJIJYAYj4gZoeyM4 HyVUBcBMQ5QFwKxIVAXAbECwLEgSQTVszPgBsw4sFQAAAAAATZ ');
if CurrentHP < EatAt then
begin
if FindDTM(Lobster, X, Y, MSX1, MSY1, MSX2, MSY2)then
begin
Mouse(X, Y, 7, 7, false);
WaitOption('10', 1500);
Wait(1000 + random(200));
repeat
FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2);
Mouse(X, Y, 7, 7, false);
WaitOption('at', 1500);
Wait(1000 + random(200));
until CurrentHP = TotalHP
end;
if FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2)then
begin
Mouse(X, Y, 7, 7, false);
WaitOption('ll', 1500);
Wait(500 + random(200));
end;
end;
FreeDTM(Lobster);
end;
Nope, watch it again.
You enter the first if if you are low hp, then you search for lobster and you dont check if you really found any.
Then you enter the loop, which can only be exited if you heal up. But what if you got no lobster in your inventory? Or what if your DTM is broken? You are stuck there.
Sirenia
03-13-2012, 09:42 AM
Now I think it will check for them in the bank and then enter the loop, correct me if im wrong :P
Yep thats better, but you could still get caught in an infinite loop.
Say you got 1 lobster in your bank, the script tries to withdraw 10, it then enter the loop and eat one. But you arent full HP with a single lobster. So you are still stuck.
The best thing to do would be to add a timeout variable to your loop.
Say, you try the loop 10 times, then if you are still low hp, you exit the loop and do something, like maybe logout or send a message to the user.
Now I think it will check for them in the bank and then enter the loop, correct me if im wrong :P
What is Eat at on the line that says is hp less than?
What is Eat at on the line that says is hp less than?
Since its not declared localy it must be a global constant. (Yeah that makes more sense than a variable)
EatAt is most likely an integer that store at which HP you should start to eat. Say... 597 life points.
Sirenia
03-13-2012, 09:52 AM
EatAt and TotalHP is constants,
Const
EatAt = 400;
TotalHP = 910;
For exmaple
I got resting too, this one is from Flight so I think it should be good :p
procedure Rest;
begin
if (GetMMLevels('run',S) <= RestAt) then
RestUntil(RandomRange(90, 100));
end;
With
Const
RestAt = 60;
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.