SRL Archive - OSR Help

Whilte not ... do multiple statements?


J J

2012-02-28 15:43:12

I want to make a simple loop that looks for either "Fail" in the chatbox or for "open" in the chatbox. Both will appear on line 8.

The following code does not work, it only works if the chatbox has "fail" on rule 8 and it is stuck if it actually opens something and gets "open" in the chatbox.

How can I fix this?

begin;
while not (FindChatBoxText('fail', 8, clBlack)) or (FindChatBoxText('open', 8, clBlack)) do
Wait(50);
end;

EDIT: I've found a way to avoid this now
begin;
repeat
Wait(100+random(100));
until FindChatBoxText('fail', 8, clBlack) or FindChatBoxText('open', 8, clBlack);
end;
This works. If anyone has any tips though, let me know.

footballjds

2012-02-28 16:03:56

the first one the logic is off…

You should have, "while not(this) and not(this)"

J J

2012-02-28 17:01:53

From: footballjds
the first one the logic is off…

You should have, "while not(this) and not(this)"

But if you do that it will be waiting until it has found BOTH? I just need to find one. "and" makes me think that the script will be waiting until finding both, or does While Not always searches for one?

footballjds

2012-02-29 09:34:56

From: RuneScapeJJ
But if you do that it will be waiting until it has found BOTH? I just need to find one. "and" makes me think that the script will be waiting until finding both, or does While Not always searches for one?


take what you "think" out of the equation and use logic…


If i told you to run and to keep running while you DON'T see a fairy AND you DON'T see the Easter bunny. Would you stop running when you saw just one? Yes.

for example, the following two have the same "logic" although they're different loops:

while not(Thirsty) and not(Hungry) do
StarveYourself;


repeat
StarveYourself;
until Thirsty or Hungry;


Daniel

2012-03-07 05:30:38

From: RuneScapeJJ
But if you do that it will be waiting until it has found BOTH? I just need to find one. "and" makes me think that the script will be waiting until finding both, or does While Not always searches for one?


OR = Can be one or the other, or both.
XOR = Can be one or the other, not both.
AND = Must be both.

NOT = The opposite to the operation applied above.

:)