Skip to content

Dialogues

Greg edited this page Jan 23, 2024 · 15 revisions

Statements

Statements are the simplist dialogue type and show only text

statement("You can't use this emote yet. Visit the Stronghold of Player Safety to unlock it.")

Line of text that are too long will automatically be wrapped around onto a new line.

image

Line breaks can also be specified manually with the <br> tag or with multi-line string literals.

statement("You can't use this emote yet. Visit the Stronghold of Player Safety to<br>unlock it.")
statement("""
    You can't use this emote yet. Visit the Stronghold of Player Safety to
    unlock it.
""")

Items

Item dialogues show an inventory item next to text.

item(item = "bank_icon", zoom = 1200, text = "You have some runes in your bank. Climb the stairs in Lumbridge Castle until you see this icon on your minimap. There you will find a bank.")

image

Note

Some items exist only as icons for this dialogue.

Characters

Players

Player dialogues need a facial expression to go with the text displayed.

player<Unsure>("I'd like to trade.")

image

NPCs

To start a dialogue with an NPC player.talkWith(npc) must first be called.

This is automatically done when interacting with an npc via an NPCOption such as ItemOnNPC.

All future npc dialogues will refer back to the npc being interacted with.

npc<Talk>("Sorry I don't have any quests for you at the moment.")

image

For dialogues with multiple npcs, the npcs ids can be provided

npc<Furious>(npcId = "wally", text = "Die, foul demon!", clickToContinue = false)

image

Choices

Multi-choice options

choice {
    option("Yes I'm sure!") {
        npc<Cheerful>("There you go. It's a pleasure doing business with you!")
    }
    option("On second thoughts, no thanks.")
}

image

Choices can be given custom titles

choice("Start the Cook's Assistant quest?") {
    option("Yes.") {
    }
    option("No.") {
    }
}

Options

Anthing in an action will be executed after an option has been selected. This can include a mix of delays and character modifications as well as other dialogues.

option("Yes I'm sure!") {
   player.inventory.remove("coins", cost)
   npc<Cheerful>("There you go. It's a pleasure doing business with you!")
}

Dialogues will end if an option without an action specified is selected

option("On second thoughts, no thanks.")

Options can be given an expression to have the player repeat the dialogue selected

// ❌ Manual
option("I'd like to trade.") {
    player<Unsure>("I'd like to trade.")
}
// ✅ Automatic
option<Unsure>("I'd like to trade.") {
}

Options be filtered so they are only displayed when the condition is met.

option("Can you teleport me to the Rune Essence?", { player["rune_mysteries"] == "completed" }) {
    player.tele(2910, 4830)
}

When only one options condition is met then that option will be automatically selected

choice {
    option<Talk>("Nothing, thanks.")
}
Clone this wiki locally