Skip to content

Chat Methods

GodDragoner edited this page May 17, 2018 · 8 revisions

sendMessage(String message)

Sends a message to the chat using the current selected sender.

Parameters:

message - The message to send

Example:

sendMessage("Greetings %name%");


sendMessage(String message, int secondsToWaitAfterwards)

Sends a message to the chat using the current selected sender and waits for x seconds after sending the message before continuing.

Parameters:

message - The message to send secondsToWaitAfterwards - The amount of seconds to wait after the message was send

Example:

sendMessage("Greetings %name%", 10);


sendInput(String message, String... options)

Sends a message to the chat using the current selected sender and returns an answer object and afterwards waits for a message from the sub.

Parameters:

message - The message to send

options - Optional: Add any amount of strings to the list of arguments to add all of them as options to the lazy sub interface.

Example:

answer = sendInput("Hey %name%");
while (true) {
    if (answer.matchesRegexLowerCase("hey([ ]|$)", "hello([ ]|$)", "hi([ ]|$)")) {
        break;
    } else {
        sendMessage("What did you say?");
        answer.loop();
    }
}
sendMessage("You greeted me!");

sendInput(String message, int secondsTillTimeout, String... options)

Sends a message to the chat using the current selected sender and returns an answer object and afterwards waits for a message from the sub for a max of x seconds.

Parameters:

message - The message to send

secondsTillTimeout - The duration in seconds to wait before the answer should timeout

options - Optional: Add any amount of strings to the list of arguments to add all of them as options to the lazy sub interface.

Example:

answer = sendInput("Hey %name%", 10);
while (true) {
    if (answer.matchesRegexLowerCase("hey([ ]|$)", "hello([ ]|$)", "hi([ ]|$)")) {
        sendMessage("You greeted me!");
        break;
    } else if(answer.isTimeout()) {
        sendMessage("You failed to greet me properly within 10 seconds.");
        //Punish
    } else {
        sendMessage("What did you say?");
        answer.loop();
   }
}
sendMessage("Okay, let's move on");

createInput(String... options)

Returns an answer object and afterwards waits for a message from the sub for a max of x seconds.

Parameters:

options - Optional: Add any amount of strings to the list of arguments to add all of them as options to the lazy sub interface.

Alias: waitForInput

Example:

sendVirtualAssistantMessage("Are you here to serve full or part time?", false);
answer = createInput("Part Time", "Full Time");

while (true) {
    if (answer.isLike("part time", "parttime", "part")) {
        setVar("slaveType", 0);
        answer.clearOptions();
        break;
    } else if (answer.isLike("full time", "fulltime", "full")) {
        setVar("slaveType", 1);
        answer.clearOptions();
        break;
    } else {
        sendVirtualAssistantMessage("Full time or part time slave?");
        answer.loop();
    }
}

sendVirtualAssistantMessage("%Good%");

createInput(int secondsTillTimeout, String... options)

Returns an answer object and afterwards waits for a message from the sub for a max of x seconds.

Parameters:

secondsTillTimeout - The duration in seconds to wait before the answer should timeout

options - Optional: Add any amount of strings to the list of arguments to add all of them as options to the lazy sub interface.

Alias: waitForInput


replaceVocab(String string)

Replaces all vocabularies in the given string and returns the modified string.

Parameters:

string - The string containing the vocabularies that you want to replace

Alias: replaceVocabs, replaceVocabularies

Example:

message = replaceVocab(message);
text = new javafx.scene.text.Text(message);
text.setFill(javafx.scene.paint.Color.ROYALBLUE);
text.setFont(javafx.scene.text.Font.font(null, javafx.scene.text.FontWeight.MEDIUM, 13));

sendCustomMessage(text);

setSender(int senderId)

Sets the current active message sender in the chat. Which means any sendMessage or sendInput call will be send from that person's "account".

Parameters:

senderId - The id of the sender. 1 for the normal dom, 2 for the first dom friend, 3 for the second dom friend and 4 for the third dom friend.

Alias: setDom

Example:

sendMessage("Okay %domFriend1Name% will now take over!");
setSender(2);
sendMessage("Hello %subName%");

Clone this wiki locally