Conversation Box

The Converstaion Box file holds any functions that manipulate and/or gather information from a conversation between the player and NPC’s or the player and “the game” (i.e. destroying an item).

The source for this file can be found here.

Consts, Types, Vars

The following constants, types and variables are used throughout the collectBox methods.

type TRSConversationtBox

type
  TRSConversationBox = type TRSInterface;

A type that stores the conversation box interface properties.

var conversationBox

The variable used to call conversation box functions, procedures and attributes.

var
  conversationBox: TRSConversationBox;

A variable through which scripters can access the TRSConversationBox type methods.

TRSCovnersationBox methods

The following methods should be called through the conversationBox variable.

Example:

if conversationBox.isOpen() then
  writeln('Conversation box screen is open!');

isOpen

function TRSConversationBox.isOpen(waitTime: integer = 0): boolean;

Returns true if the conversationBox interface is open. The optional waitTime parameter (default = 0) is the maximum time (in milliseconds) it will keep looking.

Note

  • by Olly
  • Last Updated: 21 September 2013 by Olly

Example:

if conversationBox.isOpen(3000) then
  writeLn('The conversation box is open');

getChatBounds

function TRSConversationBox.getChatBounds(): TBox;

Returns a TBox around where the black NPC chat is located

Note

  • by Olly
  • Last Updated: December 22, 2013 by Olly

Example:

var
  b: TBox;
begin
  b := conversationBox.getChatBounds();

end;

getSpeaker

function TRSConversationBox.getSpeaker(): string;

Returns a string of the current speaker (i.e. the title of the conversation box).

Note

  • by DemiseSythe
  • Last Updated: 17 August 2013 by Coh3n

Example:

if (conversationBox.getSpeaker() = 'Bob') then
  writeln('We are talking Bob. Bob is cool.');

areTalking

function TRSConversationBox.areTalking(): boolean;

Returns true if someone is talking (i.e. the conversation box has a title).

Note

  • by Wizzup?
  • Last Updated: 17 August 2013 by Coh3n

Example:

if conversationBox.areTalking() then
  writeln('We are talking');

getChat

function TRSConversationBox.getChat(): string;

Returns a string of the current dialogue in the conversation box.

Note

  • by Olly
  • Last Updated: December 22, 2013 by Olly

Example:

writeLn(conversationBox.getChat());

findChat

function TRSConversationBox.findChat(txt: TStringArray): boolean;

Returns true any of the strings in txt are found somewhere in the chat dialog.

Note

  • by Olly
  • Last Updated: 11 September 2013 by Olly

Example:

if conversationBox.findChat(['Well-Done']) then
  writeln('We have finished!');

getOptions

function TRSConversationBox.getOptions(out optionBoxes: TBoxArray): TStringArray;

Returns the selectable options from NPC chat as a TStringArray. The optionBoxes parameter is also passed by reference, and contains the bounds for each of the option buttons.

Note

  • by Ashaman88
  • Last Updated: 9 July 2015 by HKbotz

Example:

var
  tsa: TStringArray;
  tba: TBoxArray;
begin
  tsa := conversationBox.getOptions(tba);

end;

findOption

function TRSConversationBox.findOption(txt: TStringArray): boolean;

Returns true if a string in txt is found in one of the selectable options from NPC chat.

Note

  • by Ashaman88
  • Last Updated: December 22, 2013 by Ashaman88

Example:

if conversationBox.findOption(['One']) then
   writeln('Found option for One!');

selectOption

function TRSConversationBox.selectOption(txt: TStringArray; useKeyboard: boolean = true): boolean;

Returns true if a string in txt is found and selected. If useKeyboard is set to true (default = true) is will press the corresponding number on the keyboard, else it will click the option with the mouse.

Note

  • by Ashaman88
  • Last Updated: 9 July 2015 by HKbotz

Example:

if (conversationBox.selectOption(['One'])) then
   writeln('Selected option One!');

selectOption (overload)

function TRSConversationBox.selectOption(number: integer; useKeyboard: boolean = true): boolean; overload;

Returns true if the option number number is avaliable and selected. This overload will ignore all text, and will just click the option if it is avaliable. If useKeyboard is set to true (default = true) is will press the corresponding number on the keyboard, else it will click the option with the mouse.

Note

  • by Olly
  • Last Updated: 9 July 2015 by HKbotz

Example:

if (conversationBox.selectOption(2)) then
  writeln('Selected option two');

continue

function TRSConversationBox.continue(spaceBar, doWait: boolean; advance: boolean = true): boolean;

Returns true if it successfully interacts with the “click to continue” button at the bottom of the conversation dialog.

  • spaceBar : Use the spacebar (false = use the mouse)

  • ** doWait** : Wait until a new page of text appears

  • advance : Interact with the button (default = true) . If false, the

    function will return true if the button is visible.

Note

  • by Coh3n
  • Last Updated: 15 November 2014 by Ashaman88

Example:

var
  timer: TCountDown;
begin
  timer.setTime(5000);

  repeat
    conversationBox.continue(true, true);
  until(not conversationBox.isOpen() or timer.isFinished());

end;