Text

The Text include contains all sorts of functions used for finding, analysing and using text in RS. It also contains a few useful input routines

srl_Explode

function srl_Explode(str, del: string): TStringArray;

Explodes a string into TStringArray, seperated by del.

Note

by mixster

Example:

srl_Implode

function srl_Implode(Pieces: TStringArray; Glue: string): string;

Combines Pieces in a single string seperated by Seperator

Note

by ZephyrsFury & mixster

Example:

InStrArrEx

function InStrArrEx(S: string; StrArr: TStringArray; var Where: Integer): Boolean;

Returns true if the string S was found in the StrArr, and if so stores the index into Where.

Note

by n3ss3s

Example:

StrInArr

function StrInArr(str: string; arrS: TStringArray): Boolean;

Returns True if str is found in the Array. Case sensitive.

Note

by Narcle & Nava2

Example:

ArrInStr

function ArrInStr(arrS: TStringArray; str: string): Boolean;

Returns True if the Array is found in the str. Case sensitive.

Note

by Narcle & Nava2

Example:

TypeByte

procedure TypeByte(k: Byte);

Types one character k.

Note

by Mutant Squirrle

Example:

TypeSendEx

procedure TypeSendEx(Text : string; PressEnter : Boolean);

Types text in a human-like way.

Note

by SKy Scripter

Example:

TypeSend

procedure TypeSend(Text : string);

Types Text in a human-like way and presses enter. Wrapper function for TypeSendEx for compatibility purposes.

Note

by N1ke!

Example:

AddMistakes

function AddMistakes(Orig: string; Chance: Integer): string;

Adds human mistakes to Orig such as mistypes, missing letters, wrong cases. Probability that a character is typed wrong is 1 / Chance. ie. Higher ‘Chance’ = less mistakes (I know thats stupid but oh well...). Probability is the chance that an individual character is typed incorrectly. That is if you have more characters in a string you will get more mistakes overall. 20 - 30 is usually good but it varies depending on your string so experiment!

Note

by Zephyrsfury

Example

GetUpText

function GetUpText : string;

Returns the text in the upperleft corner (often referred to as UpText).

Note

by Simba Development Team.

Example:

IsUpTextEx

function IsUpTextEx(Text: String): Boolean;

Checking uptext using wildcards

Note

by Frement

Example:

IsUpTextRe

function IsUpTextRe(RegEx: String): Boolean;

Checking uptext using regex

Note

by Frement

Example:

IsUpText

function IsUpText(UpText : string) : Boolean;

Returns True if there is currently Uptext on the screen

Note

by Simba Development Team.

Example:

IsUpTextMultiCustom

function IsUpTextMultiCustom(Text: TStringArray): Boolean;

Checks for the occurance of any of the strings in the array.

Note

by Starblaster100 & Nielsie95 & Freddy1990

Example:

IsUpTextMultiCustom(['Att', 'ttac', 'ack', 'monst', 'ster'])

GetLevelAtPos

function GetLevelAtPos(x, y : integer) : integer;

Returns the level of the characater found at (x, y), uses uptext. Returns -1 if none are found.

Note

by marpis and Nava2

Example:

FindTextEx

function FindTextEx(var cx, cy: Integer; txt,font: TStringArray; xs, ys, xe, ye: Integer): Boolean;

Searches for text or texts in specified box with specified font or fonts returns true on first find of one of the texts with one of the fonts in the specified box, returns x, y values aswell.

Note

by Stupid3ooo, modified by LordJashin

Example:

var
  x, y, w, h: Integer;
  fonts, txts: TStringArray;
begin
  fonts := ['MyOwnFontSet', 'SmallCharacters'];
  txts := ['Simba', 'HakunaMatata'];

  SetDesktopAsClient;
  GetClientDimensions(w, h);

  if FindTextEx(x, y, txts, fonts, 0, 0, w - 1, h - 1) then
    MoveMouse(x, y);
end.

FindText

function FindText(var cx, cy: Integer; txt,font: string; xs, ys, xe, ye: Integer): Boolean;

Searches for text in specified box with specified font.

Note

by Coh3n

Example:

ClickText

function ClickText(text, chars: string; x1, y1, x2, y2: integer; button: variant): boolean;

Clicks text if found in the specified box.

Note

by Coh3n Last Updated: Mar. 5th, 2012 by Coh3n

Example

LoadTextTPA

Function LoadTextTPA(Text : String; Chars : Integer;var height : integer) : TPointArray;

Loads a TPA of the text.. It also returns the real height of the Text. Used in FindTextTPAinTPA.

Note

by Raymond

Example

FindTextTpaEx

function FindTextTpaEx(Color,Tol,xs,ys,xe,ye : integer;var x,y : integer; Txt : string; Chars : Integer; Action  : (ClickLeft,ClickRight,Move,Nothing)) : Boolean;

Uses TPA’s to find text..Returns the found pos in x and y (if not found both are 0) In action you can put what you want to do after its found.. Nothing - Just return wether its found Move - Just move the mouse to it Clickleft - Movemouse & Clickmouse left Clickright - MoveMouse & Clickmouse right

Note

by Raymond

Example:

FindTextTPA

function FindTextTpa(Color,Tol,xs,ys,xe,ye : integer; Txt : string; Chars : Integer; Action  : (ClickLeft,ClickRight,Move,Nothing)) : Boolean;

Just like FindTextTpaEx, but without the x and y pos returning.

Note

by Raymond

Example:

FindTextTPAMulti

function FindTextTPAMulti(Color, tol, xs, ys, xe, ye: integer; Texts: TStringArray; Chars: string;/integer; Action: fnct_ActionOptions): Boolean;

Just like FindTextTPA, only that it takes an array of strings as text to search for.

Note

by Cigue and EvilChicken!

Example:

FindNPCChatTextMulti

function FindNPCChatTextMulti(txt: TStringArray; action: fnct_ActionOptions): boolean;

Finds a text said by a NPC in chat. If found it’ll perform action, where action can be: Nothing - Just return wether its found Move - Just move the mouse to it Clickleft - Movemouse & Clickmouse left Clickright - MoveMouse & Clickmouse right

Note

by Kernel Klink, Nielsie95 & Narcle Last Modified: January 31st, 2012 by Coh3n

Example:

FindNPCChatText

function FindNPCChatText(txt: string; Action: fnct_ActionOptions): Boolean;

Finds a text said by a NPC in chat. If found it’ll perform action, where action can be: Nothing - Just return wether its found Move - Just move the mouse to it Clickleft - Movemouse & Clickmouse left Clickright - MoveMouse & Clickmouse right

Note

by Coh3n

Example:

SortATPAFromFirstPointY

procedure SortATPAFromFirstPointY(var a: T2DPointArray; const From: TPoint);

Sorts the Y coords of the ATPA.

Note

by Wizzup? & Narcle

Example:

SortATPAFromFirstPointX

procedure SortATPAFromFirstPointX(var a: T2DPointArray; const From: TPoint);

Sorts the X coords of the ATPA.

Note

by Wizzup? & Narcle

Example:

GetChooseOptions

function GetChooseOptions(TextType: string): Array of TOptions;

Gets the texe from the options menu.

Note

by Wizzup? & Narcle

Example:

ChooseOptionMultiEx

function ChooseOptionMultiEx(Texts: TStringArray; TextType: String; Action: fnct_ActionOptions): Boolean;

Finds Popup menu, then clicks on it. Will look for the first string first and so on. It will search for the Text Type you input valid arguments are ‘action’, ‘player’: The white text ‘npc’: The yellow text ‘object’: The cyan text ‘all’: Searches for all colors of text. Will default to ‘all’.

Note

by Wizzup? & Nava2 & N1ke! Last Modified: 22/12/12 by riwu

Example:

ChooseOptionMulti

function ChooseOptionMulti(Txt: TStringArray): Boolean;

Finds Popup menu, then clicks on it. Will look for the first string first and so on.

Note

by Wizzup? & N1ke!

Example:

ChooseOptionEx

function ChooseOptionEx(Txt, TextType: string): Boolean;

Finds an option in a popup menu, then clicks on it. Searches for TextType. See ChooseOptionMultiEx for valid options. Default is ‘all’.

Note

by Wizzup?

Example:

ChooseOption

function ChooseOption(txt: String): Boolean;

Finds an option in a popup menu, then clicks on it.

Note

by Wizzup?

Example:

OptionsExist

function OptionsExist(txt: TStringArray; Move: boolean): boolean;

Returns true if an Option in txt is found in the RS Option Menu, will move or do nothing according to the boolean Move.

Note

by Rasta Magician

Example

CloseWindow

function CloseWindow: Boolean;

Closes any open windows. (In RS not your pc roflmaololz, j/k)

Note

by NaumanAkhlaQ, Narcle, and Nava2 Updated: 12 December 2011 by Coh3n

Example:

if (BankScreen) then
  CloseWindow();