SRL Archive - Reflection Development

R_IsUpTextMulti wait timer


Harry

2011-10-16 08:22:24

function R_IsUpTextMulti(UpText: TStringArray): Boolean;
var
I, T: integer;
UT: String;
begin
Result := False;
MarkTime(T);
while(UT = '')do
begin
UT := R_GetUpText;
if(TimeFromMark(T) > 1000)then
Exit;
Wait(5+Random(10));
end;
for I := 0 to High(UpText) do
begin
Result := Pos(Trim(Lowercase(UpText[I])), UT) > 0;
if Result then Exit;
end;
end;

Here's a better version. All I did was reduce the wait timer. The old one waits muuuuch too long.

Flight

2011-10-16 09:21:29

Oh yes from "Wait(50+Random(50));" to "Wait(5+Random(10));". I noticed how much small changes like that add up when they're in a loop like this. I used to do something like "While R_Moving do Wait(50);" and compared that to "Wait(1);", very big change. I guess it stacks every loop? In any case, it's a good change.

Harry

2011-10-16 10:05:40

From: Flight
Oh yes from "Wait(50+Random(50));" to "Wait(5+Random(10));". I noticed how much small changes like that add up when they're in a loop like this. I used to do something like "While R_Moving do Wait(50);" and compared that to "Wait(1);", very big change. I guess it stacks every loop? In any case, it's a good change.

Yeah, I noticed those too. I guess they were added to reduce CPU use or something? It just makes the script pretty slow which isn't fun. Pretty annoying to have it check for uptext of something when I'm moving and THEN it clicks like .4 seconds after, which by then the mouse is far off from the item it was searching.