That way you have that repeat loop set up, once the script recognizes that it's out of prayer points and starts drinking potions, it'll never stop.
Condsider something like this:
Simba Code:
procedure drinkPot();
begin
if (not (chatBox.findTextOnLines(['ou have run out of prayer points'], [1..5]))) then
exit(); //Exit the routine if we don't need to drink.
tabBackPack.mouseSlot(1, MOUSE_MOVE); // Move mouse to slot 1
//if isMouseOverText(['erfect juju prayer potion']) then // If text matches then start the next 'begin..end block'
if isMouseOverText(['rayer potion']) then // If text matches then start the next 'begin..end block'
begin
fastClick(MOUSE_RIGHT); // Left click
writeLn('We drank a potion!');
chooseOption.select(['rink']); // Choose the option
end else
writeLn('There wasn''t potion'); // If the mouseOverText didn't match, this will print instead
end;
Then, you may simply call drinkPot() somewhere in your mainloop where it will be called as the script repeats naturally. So, your mainloop might look like this:
Simba Code:
begin
{login/setup stuff blah blah}
repeat
drinkPot(); //it's okay to call this here without any conditionals
//because if it's not needed, it will just exit
getStone();
cleanseStone();
{main game interaction stuff here, etc etc}
until (players.getActive() <= 0);
end.
E: what evilcitrus said is also good advice, I don't believe the chatbox is the best way to determine prayer points
E2: Mother of god, this is post ID 1333337.