From: Yago
You create a global tstring array set its length to 8 or how ever many messages thenchatbcan hold and the you update it based on new messages. If all 8 lines are full of flase positives then it returns false, otherwise you could be able to check by comparing the chat box with the array
I'll try to explain better. Let's look at an example.
There are 2 rocks on the main screen, coalA and coalB; coalA doesn't have any ore in it, while coalB does. Since the ore's colours are so similar to the rock itself, it still finds the empty rock (coalA) as a "minable" rock. So it clicks rockA, and the "There is no ore" message appears. Okay sweet, the message appeared and the script has found it, now what? Continue on with the next rock? You could, but the same thing would happen because the message is still in the chat box, thus creating an endless cycle until a different message appears.
Here's what I think
may work:
- Edit MSI_MineRock (Mining.simba) to check the LAST line of chat text.
- If "There is no ore" message is found, then wait a couple seconds for the "You swing your pickaxe" message.
- If the latter text doesn't appear after 1-2 seconds, exit the function.
- Something like this:
function MSI_MineRock(which: TIntegerArray; var forceFail: Boolean): boolean;
var
rockObjs: TMSObjectArray;
rock: TMSObject;
begin
if (not loggedIn) then
exit;
rockObjs := MSI_GetObjects(which);
if (MSI_FindObjects(rockObjs, moLeft, rock)) then
begin
result := true;
if (findText('no ore available')) then
if (not waitFindText('swing pickaxe')) then
exit;
MSI_WaitWhileMining(rock);
end else
result := MSI_FindRandoms(false);
end;
Keep in mind that findText and waitFindText probably aren't the right functions to be using, they're just for the sake of the example.Usually keeping things simple is the best way. ;)