Instead of making people scroll half way down the script to input an option, you should have a constant at the top. Something like:
const
(* VALID HIDE_TYPE OPTIONS: *)
(* 'Leather', 'Hard', 'Green', 'Blue', Red, 'Black', or 'Royal' *)
HIDE_TYPE = 'Leather';
and then in your convertProfits you can do something like:
procedure convertProfits();
begin
//we convert HIDE_TYPE to lowercase incase some noobs type 'leather' instead of 'Leather'
case lowercase(HIDE_TYPE) of
'leather': LeatherProfit := LeatherProfit;
'hard': LeatherProfit := HardProfit;
'green': LeatherProfit := GreenProfit;
'blue': LeatherProfit := BlueProfit;
'red': LeatherProfit := RedProfit;
'black': LeatherProfit := BlackProfit;
'royal': LeatherProfit := RoyalProfit;
else begin
writeLn('You didn''t enter a valid HIDE_TYPE');
terminateScript();
end;
end;
end;
Or if you wanted to get rid of all of those price variables altogether you could do it in one go:
leather - (raw material + cost to make)
procedure convertProfits();
begin
case lowercase(HIDE_TYPE) of
'leather': LeatherProfit := getGEPrice('Leather') - getGEPrice('Cowhide');
'hard': LeatherProfit := getGEPrice('Hard_leather') - (getGEPrice('Cowhide') + 3);
'green': LeatherProfit := getGEPrice('Green_dragonhide') - (getGEPrice('Green_d-leather') + 20);
'blue': LeatherProfit := getGEPrice('Blue_dragonhide') - (getGEPrice('Blue_d-leather') + 20);
//etc
else begin
writeLn('You didn''t enter a valid HIDE_TYPE');
terminateScript();
end;
end;
end;
and if you didn't want it to walk back to the bank without tanning hides, you could restructure your mainLoop so it ONLY walks to the bank if it has leather in the backpack:
repeat
if isLeatherInPack() then
begin
walkToBank();
findBankMan();
bankHides();
end;
walkToEllis();
findEllis();
tanHides();
progressReport();
until (false);
but then you would need write the isLeatherInPack() function. Easiest way is probably using DTMs, but you would have to make quite a few since there is heaps of leather types. Instead of writing something like
if findDTM(redLeatherDTM, x, y etc..) or findDTM(blueLeatherDTM, etc..) or findDTM(blackLeatherDTM, etc...) etc.. then
begin
writeLn('We have leather in our pack');
result := true;
end;
What you could do is put your leather DTMs into an array, and loop through them. If it finds any of the leather DTMs, function results true, and it will know it has to run to bank.
function isLeatherInPack(): boolean;
var
i, x, y: integer;
leatherDTMs: array [0..6] of integer;
begin
leatherDTMs[0] := DTMFromString('mrAAAAHic42BgYGhkYmBoA'); //Leather (these are made-up strings)
leatherDTMs[1] := DTMFromString('mrAAAAHic42BgYGhkYmBoA'); // Hard leather
leatherDTMs[2] := DTMFromString('mrAAAAHic42BgYGhkYmBoA'); // Green
leatherDTMs[3] := DTMFromString('mrAAAAHic42BgYGhkYmBoA'); // Blue
leatherDTMs[4] := DTMFromString('mrAAAAHic42BgYGhkYmBoA'); // Red
leatherDTMs[5] := DTMFromString('mrAAAAHic42BgYGhkYmBoA'); // Black
leatherDTMs[6] := DTMFromString('mrAAAAHic42BgYGhkYmBoA'); // Royal
for i := 0 to high(leatherDTMs) do //looping from 0 to 6
if findDTM(leatherDTMs[i], x, y, tabBackpack.getBounds()) then
begin
writeLn('Found leather in backpack');
result := true;
break; //break from the loop if found
end;
freeDTMs(leatherDTMs);
end;
You could also make leatherDTMs a global variable, load the DTMs at the start of the script (and free them on terminate), so you don't have to load/free them each time you check the backpack.