Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {$DEFINE RSCE}
- {$I MSSL.scar}
- function ReplaceMulti(text: string; findStrArr: TStrArray; replaceStr: string): string;
- var
- h, i: Integer;
- begin
- Result := text;
- h := High(findStrArr);
- if (h >= 0) then
- for i := 0 to h do
- Result := Replace(Result, findStrArr[i], replaceStr);
- end;
- function ReplaceMultiTSA(TSA, findStrArr: TStrArray; replaceStr: string): TStrArray;
- var
- h, h2, i, i2: Integer;
- begin
- Result := TSA;
- h := High(findStrArr);
- h2 := High(Result);
- if ((h >= 0) and (h2 >= 0)) then
- for i := 0 to h do
- for i2 := 0 to h2 do
- Result[i2] := Replace(Result[i2], findStrArr[i], replaceStr);
- end;
- function IsUpText(str: string): Boolean;
- begin
- Result := (ReplaceMulti(RSCE_UpText([RSCE_UPTEXT_ALL]), ['I', 'l'], ' ') = ReplaceMulti(str, ['I', 'l'], ' '));
- end;
- type
- TTCMethod = (tc_AnyMatch, tc_AllMatch, tc_NonMatch);
- function TextContains(t: string; TSA: TStrArray; cs: Boolean; m: TTCMethod): Boolean;
- var
- h, i: Integer;
- begin
- h := High(TSA);
- if ((t = '') or (h < 0)) then
- Exit;
- case m of
- tc_AnyMatch:
- for i := 0 to h do
- begin
- if cs then
- Result := (Pos(TSA[i], t) > 0)
- else
- Result := (Pos(Lowercase(TSA[i]), Lowercase(t)) > 0);
- if Result then
- Exit;
- end;
- tc_AllMatch:
- begin
- for i := 0 to h do
- case cs of
- True:
- if not (Pos(TSA[i], t) > 0) then
- Exit;
- False:
- if not (Pos(Lowercase(TSA[i]), Lowercase(t)) > 0) then
- Exit;
- end;
- Result := True;
- end;
- tc_NonMatch:
- begin
- for i := 0 to h do
- case cs of
- True:
- if (Pos(TSA[i], t) > 0) then
- Exit;
- False:
- if (Pos(Lowercase(TSA[i]), Lowercase(t)) > 0) then
- Exit;
- end;
- Result := True;
- end;
- end;
- end;
- var
- uptext: string;
- objs: TStrArray;
- begin
- MSSL_Setup;
- RSCE_Client.Activate;
- Wait(2500);
- uptext := ReplaceMulti(RSCE_UpText([RSCE_UPTEXT_NPC]), ['I', 'l'], '*');
- WriteLn('UPTEXT: ' + uptext);
- objs := ReplaceMultiTSA(['Banker', 'Master Fisher', 'Man', 'Goblin'], ['I', 'l'], '*');
- if TextContains(uptext, objs, True, tc_AnyMatch) then
- WriteLn('WOOHOOO');
- MSSL_Unsetup;
- end.
Advertisement
Add Comment
Please, Sign In to add comment