SRL Archive - OSR Help

Checking for food.


begginer

2012-03-18 08:19:53

I have an idea, After no food to start teleport to Varrock.
The inv will not be empty. I thought to make a function like checking for uptext eat, if there is none then result = false;

If NoFood
Begin
// bla bla bla to teleport to varrock.

Then walk to bank and deposit all.


What I need is someone help me making a checker for food.

Thanks

begginer

2012-03-18 13:09:44

No idea. Or should try my own.

RISK

2012-03-18 13:13:54

// Checks for food in the inventory based on (a) dtm(s).
function HasFood(): Boolean;
var
X, Y, DTM: Integer; // We the set required integers for the function here
begin
if (not(LoggedIn())) then // If we are not logged in, exit the function
Exit;
FindNormalRandoms; // Searches for any randoms and attempts to solve them if they are found

GameTab(25); // Switches to the inventory tab
DTM := (DTMFromString('')); // Insert the DTM string here

// Searches for the DTM in the inventory, results 'True' if found
Result := (FindDTM(DTM, X, Y, MIX1, MIY1, MIX2, MIY2));

FreeDTM(DTM); // Frees the DTM after using it
end;

begginer

2012-03-18 13:43:01

Thanks a million. Gonna try this

Er1k

2012-03-19 02:42:18

Alternatively if you don't use a DTM system to check your food, you should use an uptext system to look for the word 'Eat'.

But instead of looping everytime, you might want to remember what your inventory has to reduce the time spent on checking. That I suppose is the beginning of a smart food inventory system or whatever.

Ibotlots8D

2012-03-26 10:29:54

You could rahter do this -
function HasFood(DTM:Integer): Boolean;
var
X, Y: Integer; // We the set required integers for the function here
begin
if (not(LoggedIn())) then // If we are not logged in, exit the function
Exit;
FindNormalRandoms; // Searches for any randoms and attempts to solve them if they are found

GameTab(25); // Switches to the inventory tab

// Searches for the DTM in the inventory, results 'True' if found
Result := (FindDTM(DTM, X, Y, MIX1, MIY1, MIX2, MIY2));

FreeDTM(DTM); // Frees the DTM after using it
end;

begginer

2012-04-09 04:36:41

Thanks to three of you. Mark solved and close this

Joe

2012-04-09 16:38:42

or
findDTM for your food say salmon (x,y….)
then

if not findDTM then
walkBank;

that should work