SRL Archive - Help

Make a food eater


begginer

2012-01-29 15:51:33

How to make a simple one. That eats, lobsters. Just eating by text not color or can be eating by color too. Any suggestion.

Shuttleu

2012-01-29 15:54:17

so what, this would be used while you are playing legit?

~shut

begginer

2012-01-29 15:58:47

I am making a killing script. I need to eat something :)

Shuttleu

2012-01-29 16:04:57

var
MMColor: string;

GetMMLevels('hp', MMColor);
if (MMColor = 'Red') then
repeat
//eat something
GetMMLevels('hp', MMColor)
until((MMColor = 'Green') or {find no food})

~shut

begginer

2012-01-29 16:09:28

Error] (90:3): Duplicate identifier 'GetMMLevels' at line 89

What's wrong

Shuttleu

2012-01-29 16:13:57

From: begginer
Error] (90:3): Duplicate identifier 'GetMMLevels' at line 89

What's wrong

procedure EatIfLow;
var
MMColor: string;
begin
GetMMLevels('hp', MMColor);
if (MMColor = 'Red') then
repeat
//eat something
GetMMLevels('hp', MMColor)
until((MMColor = 'Green') or {find no food})
end;

~shut

begginer

2012-01-29 16:24:40

thanks, but what's wrong here

begin
GetMMLevels('hp', MMColor);
if (MMColor = 'Red') then
repeat

begin
InvMouse(I, 3);
if IsUpText('Eat Lobster') then
begin
ClickMouse2(True);
Wait(RandomRange(350, 525));
Exit;
end else
Continue;
end;

This error : ** Warning in InvMouse: Inventory slot #0 is not a valid slot**

Shuttleu

2012-01-29 16:27:25

From: begginer
thanks, but what's wrong here

begin
GetMMLevels('hp', MMColor);
if (MMColor = 'Red') then
repeat

begin
InvMouse(I, 3);
if IsUpText('Eat Lobster') then
begin
ClickMouse2(True);
Wait(RandomRange(350, 525));
Exit;
end else
Continue;
end;

This error : ** Warning in InvMouse: Inventory slot #0 is not a valid slot**

post the whole function

how do you search for the lobster

~shut

begginer

2012-01-29 16:34:43


procedure EatIfLow;
var
MMColor: string;
I: Integer;


begin
GetMMLevels('hp', MMColor);
if (MMColor = 'Red') then
repeat

begin
InvMouse(I, 3);
if IsUpText('Eat Lobster') then
begin
ClickMouse2(True);
Wait(RandomRange(350, 525));
Exit;
end else
Continue;
end;



GetMMLevels('hp', MMColor)
until((MMColor = 'Green'))
end;

Shuttleu

2012-01-29 16:40:59

From: begginer

procedure EatIfLow;
var
MMColor: string;
I: Integer;


begin
GetMMLevels('hp', MMColor);
if (MMColor = 'Red') then
repeat

begin
InvMouse(I, 3);
if IsUpText('Eat Lobster') then
begin
ClickMouse2(True);
Wait(RandomRange(350, 525));
Exit;
end else
Continue;
end;



GetMMLevels('hp', MMColor)
until((MMColor = 'Green'))
end;

you never search the inventory for the lobster

something like this
procedure EatIfLow;
var
MMColor: string;
I: Integer;
begin
GetMMLevels('hp', MMColor);
if (MMColor = 'Red') then
repeat
if FindDTM({dtm}, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
InvMouse(CoordsToItem(x, y), 3);
if WaitUpText('Eat Lobster', 1000) then
begin
ClickMouse2(True);
Wait(RandomRange(350, 525));
end;
end else
Break;
GetMMLevels('hp', MMColor)
until((MMColor = 'Green'))
end;

~shut

kitchenrange

2012-01-30 01:15:38

What he was trying to do was without the dtms and he forgot to

for i := 1 to 28 do

He should definitely go dtm route though.

begginer

2012-01-30 17:36:27


procedure EatIfLow;
var
MMColor: string;
x, y, Lobster: Integer;
begin
Lobster := DTMFromString('mggAAAHicY2NgYMhhYmAoAuIyIM4G4iQgjgXi2YwMDBOBeBIQrwDiZYwQsU2RUgxLgyQYNkRIMmyNlgKawMTQ4ybCgAsw4sAQAADyqwur');
end;
begin
GetMMLevels('hp', MMColor);
if (MMColor = 'Red') then
repeat
if FindDTM(Lobster, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
InvMouse(CoordsToItem(x, y), 3);
if WaitUpText('Eat Lobster', 1000) then
begin
ClickMouse2(True);
Wait(RandomRange(350, 525));
end;
end else
Break;
GetMMLevels('hp', MMColor)
until((MMColor = 'Green'))
end;



This is error [Error] (93:21): Unknown identifier 'MMColor' at line 92
Compiling failed.

kitchenrange

2012-01-30 18:01:37

take out the "end;" right below your "DTMFromString" and put it at the very end on the last line by itself.

it looks like you end the procedure there and then start on something else…

Also, you should look into turning that into a function that returns a boolean. THis way you can say something like:

if not(EatIfLow) then Logout

see where I'm going?

begginer

2012-01-31 03:04:08

The following DTMs were not freed: [2]
Does that mean, I didn't get DTM properly ?

NickMystre

2012-01-31 03:06:37

Simba is letting you know that it free'd the DTM's for you. Your script either does not have the instruction 'FreeDTM' or it crashed.

begginer

2012-01-31 03:09:15

If you look at the script (It's on my last post) you can see what's the problem.

NickMystre

2012-01-31 03:21:15

Are you talking about this …

This is error [Error] (93:21): Unknown identifier 'MMColor' at line 92
Compiling failed.

begginer

2012-01-31 03:27:49

procedure EatIfLow;
var
MMColor: string;
x, y, Lobster: Integer;
begin
Lobster := DTMFromString('mggAAAHicY2NgYMhhYmAoAuIyIM4G4iQgjgXi2YwMDBOBeBIQrwDiZYwQsU2RUgxLgyQYNkRIMmyNlgKawMTQ4ybCgAsw4sAQAADyqwur');

begin
GetMMLevels('hp', MMColor);
if (MMColor = 'Red') then
repeat
if FindDTM(Lobster, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
InvMouse(CoordsToItem(x, y), 3);
if WaitUpText('Eat Lobster', 1000) then
begin
ClickMouse2(True);
Wait(RandomRange(350, 525));
end;
end else
Break;
GetMMLevels('hp', MMColor)
until((MMColor = 'Green'))
end;
end;
This is the script. I get this error The following DTMs were not freed: [2]

NickMystre

2012-01-31 03:35:24

My guess is that while you have declared 'MMColor' no value is ever assigned to it. That is why your script terminates itself - and then Simba then tells you that it freed DTMs still left in memory.

Also - you do realise that this is just a procedure you have posted and not the whole program. (Sorry if you knew this already!)

How does that sound ? :)

EDIT: Just a thought - is MMColor perhaps a global variable ?

Nataurs

2012-01-31 04:20:25

From: begginer
procedure EatIfLow;
var
MMColor: string;
x, y, Lobster: Integer;
begin
Lobster := DTMFromString('mggAAAHicY2NgYMhhYmAoAuIyIM4G4iQgjgXi2YwMDBOBeBIQrwDiZYwQsU2RUgxLgyQYNkRIMmyNlgKawMTQ4ybCgAsw4sAQAADyqwur');

begin
GetMMLevels('hp', MMColor);
if (MMColor = 'Red') then
repeat
if FindDTM(Lobster, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
InvMouse(CoordsToItem(x, y), 3);
if WaitUpText('Eat Lobster', 1000) then
begin
ClickMouse2(True);
Wait(RandomRange(350, 525));
end;
end else
Break;
GetMMLevels('hp', MMColor)
until((MMColor = 'Green'))
end;
end;
This is the script. I get this error The following DTMs were not freed: [2]


Add 'FreeDTM(Lobster);' before the last end

DemiseScythe

2012-01-31 05:45:06

Interesting set of functions =)

Wish I wasn't so hard headed lol, kind of built my own but this looks like it will work just fine. Gl.

Tickyy

2012-01-31 05:56:16

Function LowHPLetsEat(What: String): Boolean;
var
I, x, y: Integer;
begin
Result := (HPPercent < 50) and (LoggedIn); // 50 is hp percentage, change that if you wish it any lower or higher
If(not(Result)) then
Exit;

if Result then
If InvEmpty then // If no more food failsafe, you need another failsafe in case there's no food named lobster for ex.
begin
Logout;
TerminateScript;
end
else
for i := 1 to 28 do
begin
InvMouse(I, 3);
Wait(RandomRange(250, 300));
if WaitUpText(What, RandomRange(250, 400)) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Exit;
end else
Continue;
end;
end;

DemiseScythe

2012-01-31 06:00:02

What if the script loots something Ticky?

Tickyy

2012-01-31 10:07:43

From: DemiseScythe
What if the script loots something Ticky?


It just hovers it, looking for the uptext, if uptext found… it clicks. That's it.

begginer

2012-02-06 17:00:01

Function LowHPLetsEat: Boolean;
var
I, x, y: Integer;
begin
Result := (HPPercent < 50) and (LoggedIn); // 50 is hp percentage, change that if you wish it any lower or higher
If(not(Result)) then
Exit;

if Result then
If InvEmpty then // If no more food failsafe, you need another failsafe in case there's no food named lobster for ex.
begin
Logout;
TerminateScript;
end
else
for i := 1 to 28 do
begin
InvMouse(I, 3);
Wait(RandomRange(250, 300));
if WaitUpText('Lobster', RandomRange(250, 400)) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Exit;
end else
Continue;
end;
end;


Will this work for lobster?

darkmoon500

2012-02-06 18:08:30

Is it working ? I need the same thing but only for sharks, need to add it on my Bandit script