drizzt
03-21-2008, 02:02 PM
here are two Uptext Functions i made,
{Returns the uptext that is there out of the "possible" string array in the
variable Item and returns true/false whether or not one is found}
Function WhatIsUpText(var Item: String; Possible: TStringArray): Boolean;
var
h, highest, l: integer;
t: String;
begin
t := rs_getupText;
highest := High(Possible);
for h := 0 to highest do
begin
if pos(Possible[h],t) <> 0 then
begin
inc(l);
Item := Possible[h];
end;
end;
if l = 1 then
Result := True
else
begin
Result := False;
Item := '';
end;
end;
{Returns whether or not all the strings are found in the Uptext}
Function AllUpTexts(Texts: TStringArray): Boolean;
var
h, i, Many: integer;
t: String;
begin
t := rs_GetUpText;
h := high(Texts);
for i := 0 to h do
begin
if pos(Texts[h], t) <> 0 then inc(many);
end;
if Many = length(Texts) then Result := true;
end;
if they don't work for you, tell me.
{Returns the uptext that is there out of the "possible" string array in the
variable Item and returns true/false whether or not one is found}
Function WhatIsUpText(var Item: String; Possible: TStringArray): Boolean;
var
h, highest, l: integer;
t: String;
begin
t := rs_getupText;
highest := High(Possible);
for h := 0 to highest do
begin
if pos(Possible[h],t) <> 0 then
begin
inc(l);
Item := Possible[h];
end;
end;
if l = 1 then
Result := True
else
begin
Result := False;
Item := '';
end;
end;
{Returns whether or not all the strings are found in the Uptext}
Function AllUpTexts(Texts: TStringArray): Boolean;
var
h, i, Many: integer;
t: String;
begin
t := rs_GetUpText;
h := high(Texts);
for i := 0 to h do
begin
if pos(Texts[h], t) <> 0 then inc(many);
end;
if Many = length(Texts) then Result := true;
end;
if they don't work for you, tell me.