HT BaaFly
2012-03-05 13:10:44
Hello, everyone
I've had this issue for a while and I can't seem to fix it. My script reads integers off the screen and later processes them but sometimes, it fails to read the screen properly and instead returns nothing, or "" as simba likes to put it. Is there a way to check if the variable = nothing and redoing the test until the variable = integer?
I've tried If variable = "" then blah blah blah….. but that didn't work
Here's the function if anyone's interested:
Error:
I've had this issue for a while and I can't seem to fix it. My script reads integers off the screen and later processes them but sometimes, it fails to read the screen properly and instead returns nothing, or "" as simba likes to put it. Is there a way to check if the variable = nothing and redoing the test until the variable = integer?
I've tried If variable = "" then blah blah blah….. but that didn't work
Here's the function if anyone's interested:
function GetNumerals(const s: string): string; //Credit to Echo_
var
i, j: Integer;
numArray: array of string;
begin
numArray := ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
for i := 1 to High(s) do
for j := 0 to High(numArray) do
begin
if not (s[i] = numArray[j]) then Continue;
Result := Result + s[i];
end;
end;
function GetMidPrice: integer;
begin
writeln('GetMidPrice is: ' + GetTextAtExWrap(296, 186, 440, 199, 0, 10, 1, 6400255, 5, 'UpCharsEx'));
result := StrToInt(GetNumerals(GetTextAtExWrap(296, 186, 440, 199, 0, 10, 1, 6400255, 5, 'UpCharsEx')));
end; Error:
Error: Exception: "" is an invalid integer at line blah blah blah