Here are some I wrote.. It's a mix of everything but you can see how I write the wait functions. They work just as the ones you have above.
The difference between doing:
Simba Code:
Wait(2000); //Waits 2 seconds no matter what..
isUptext('Walk here');
versus
Simba Code:
WaitUptext('Walk here', 2000); //Keeps searching for the uptext during the 2 seconds.. Timesout after 2 seconds.. If the uptext is found before 2 seconds is up, the function returns true. Thus it doesn't have to wait the entire 2 seconds every time.
is that the first one will only try once.. if the uptext isn't found then it will not do whatever.. Whereas the second one will keep looking for the uptext during a set timer.. When that timeout has been reached, if the uptext isn't found, it will return false.
Example:
WaitUptext('Walk here', 2000); will keep searching for the uptext during those 2 seconds whereas
Wait(2000);
IsUptext('Walk here'); will search only once and after 2 seconds is up.
These are included in SRL/Simba and allows you to keep trying a function during an interval.. Just like the waituptext:
These are not in SRL/Simba:
Simba Code:
Function WaitAmount(Item, Amount, TimeToWait: Integer): Integer;
var
T, Count: integer;
begin
Count:= 0; Result:= 0;
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
Count:= ItemAmount('inv', 'dtm', Item, []);
if (Count >= Amount) then
begin
Result:= Count;
Break;
end;
Wait(50);
end;
end;
Simba Code:
Function WaitFindNPCTextMulti(Texts: TStringArray; Action: Fnct_ActionOptions; TimeToWait: Integer): Boolean;
var
T: integer;
begin
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
if (FindNPCChatTextMulti(Texts, Action)) then
begin
Result:= True;
Break;
end;
Wait(50);
end;
end;
Simba Code:
Function MixingInterface: Boolean;
var
Text: String;
Bool: Boolean;
begin
Text:= GetTextAtExWrap(41, 345, 278, 362, 0, 5, 2, 16777215, 10, 'SmallChars');
Bool:= ExecRegExpr('make', Text) or ExecRegExpr('wish to make', Text) or ExecRegExpr('wish | to | make', Text);
If (Bool) then
begin
MouseBox(207, 398, 314, 460, MOUSE_MOVE);
if (WaitUptextMulti(['ake', 'All', 'ke A'], 600)) then
begin
ClickMouse2(MOUSE_LEFT);
Result:= True;
end;
end;
end;
Function WaitMixingInterface(TimeToWait: Integer): Boolean;
var
T: integer;
begin
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
if (MixingInterface) then
begin
Result:= True;
Break;
end;
Wait(50);
end;
end;
Function ItemSelected(Item: Integer): Boolean;
var
X, Y, Slot: Integer;
begin
if (WaitFindDTM(X, Y, Item, 500)) then
begin
Slot:= CoordsToItem(X, Y);
Result:= ItemActivated(Slot);
end;
end;
Function AnyItemSelected: Integer;
var
I: Integer;
begin
Result:= 0;
For I:= 1 To 28 do
begin
if (ItemActivated(I)) then
begin
Result:= I;
break;
end;
end;
end;
Function WaitItemSelected(Item, TimeToWait: Integer): Boolean;
var
T: integer;
begin
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
if (ItemSelected(Item)) then
begin
Result:= True;
Break;
end;
Wait(50);
end;
end;
Simba Code:
Function FindDTMSlot(var X, Y: Integer; DTM, Slot: Integer): Boolean;
Var
Bounds: TBox;
begin
Bounds:= InvBox(Slot);
Result:= FindDTM(DTM, X, Y, Bounds.X1, Bounds.Y1, Bounds.X2, Bounds.Y2);
end;
Simba Code:
Function WaitGameTab(Tab, TimeToWait: Integer): Boolean;
Var
T: Integer;
begin
Result := False;
T := GetSystemTime + TimeToWait;
while (GetSystemTime < T) do
begin
if (GetCurrentTab = Tab) then
begin
Result := True;
Exit;
end;
Wait(20 + Random(10));
end;
end;