From bf738b6288ce1f7c274f3b300c21e9c61b8d1cf4 Mon Sep 17 00:00:00 2001 From: GregHib Date: Fri, 10 Apr 2026 18:03:53 +0100 Subject: [PATCH 1/3] Add placeholder support to string entry --- data/client/client.scripts.toml | 3 +++ .../content/entity/player/dialogue/type/StringEntry.kt | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/data/client/client.scripts.toml b/data/client/client.scripts.toml index a65b142d6c..79d3567d2c 100644 --- a/data/client/client.scripts.toml +++ b/data/client/client.scripts.toml @@ -67,6 +67,9 @@ id = 109 [string_entry] id = 110 +[set_entry_string] +id = 1564 + [dialogue_item_zoom] id = 3449 diff --git a/game/src/main/kotlin/content/entity/player/dialogue/type/StringEntry.kt b/game/src/main/kotlin/content/entity/player/dialogue/type/StringEntry.kt index c4a9ed56be..a37e50cb87 100644 --- a/game/src/main/kotlin/content/entity/player/dialogue/type/StringEntry.kt +++ b/game/src/main/kotlin/content/entity/player/dialogue/type/StringEntry.kt @@ -4,7 +4,10 @@ import world.gregs.voidps.engine.client.sendScript import world.gregs.voidps.engine.entity.character.player.Player import world.gregs.voidps.engine.suspend.StringSuspension -suspend fun Player.stringEntry(text: String): String { +suspend fun Player.stringEntry(text: String, placeholder: String? = null): String { sendScript("string_entry", text) + if (placeholder != null) { + sendScript("set_entry_string", placeholder) + } return StringSuspension.get(this) } From 02303bb12eb85553149d609e2a90b11cf3313cfc Mon Sep 17 00:00:00 2001 From: GregHib Date: Fri, 10 Apr 2026 18:08:28 +0100 Subject: [PATCH 2/3] Add notes tab --- .../player/modal/tab/notes/notes.ifaces.toml | 25 ++- .../player/modal/tab/notes/notes.scripts.toml | 8 + .../player/modal/tab/notes/notes.strings.toml | 120 ++++++++++++++ .../player/modal/tab/notes/notes.varbits.toml | 149 ++++++++++++++++++ .../player/modal/tab/notes/notes.varps.toml | 8 + .../content/entity/player/modal/tab/Notes.kt | 113 +++++++++++++ 6 files changed, 422 insertions(+), 1 deletion(-) create mode 100644 data/entity/player/modal/tab/notes/notes.scripts.toml create mode 100644 data/entity/player/modal/tab/notes/notes.strings.toml create mode 100644 data/entity/player/modal/tab/notes/notes.varbits.toml create mode 100644 data/entity/player/modal/tab/notes/notes.varps.toml diff --git a/data/entity/player/modal/tab/notes/notes.ifaces.toml b/data/entity/player/modal/tab/notes/notes.ifaces.toml index 1111813d1e..45fd61d78b 100644 --- a/data/entity/player/modal/tab/notes/notes.ifaces.toml +++ b/data/entity/player/modal/tab/notes/notes.ifaces.toml @@ -2,10 +2,33 @@ id = 34 type = "notes_tab" +[.add] +id = 3 + [.delete] id = 8 [.notes] id = 9 -options = { Option1 = 0, Option2 = 1, Option3 = 2, Option4 = 3, Option5 = 18, Option6 = 20 } +options = { Select = 0, Edit = 1, Colour = 2, Delete = 3, Option5 = 18, Option6 = 20 } + +[.colours] +id = 16 + +[.white] +id = 35 + +[.green] +id = 37 + +[.amber] +id = 39 + +[.red] +id = 41 + +[.close] +id = 43 +[.overlay] +id = 44 \ No newline at end of file diff --git a/data/entity/player/modal/tab/notes/notes.scripts.toml b/data/entity/player/modal/tab/notes/notes.scripts.toml new file mode 100644 index 0000000000..9d8acf7825 --- /dev/null +++ b/data/entity/player/modal/tab/notes/notes.scripts.toml @@ -0,0 +1,8 @@ +[clear_notes] +id = 2442 + +[close_note_colours] +id = 2456 + +[show_notes] +id = 2444 diff --git a/data/entity/player/modal/tab/notes/notes.strings.toml b/data/entity/player/modal/tab/notes/notes.strings.toml new file mode 100644 index 0000000000..5a31aaf67e --- /dev/null +++ b/data/entity/player/modal/tab/notes/notes.strings.toml @@ -0,0 +1,120 @@ +# Script 2452 +[note_0] +id = 149 +persist = true + +[note_1] +id = 150 +persist = true + +[note_2] +id = 151 +persist = true + +[note_3] +id = 152 +persist = true + +[note_4] +id = 153 +persist = true + +[note_5] +id = 154 +persist = true + +[note_6] +id = 155 +persist = true + +[note_7] +id = 156 +persist = true + +[note_8] +id = 157 +persist = true + +[note_9] +id = 158 +persist = true + +[note_10] +id = 159 +persist = true + +[note_11] +id = 160 +persist = true + +[note_12] +id = 161 +persist = true + +[note_13] +id = 162 +persist = true + +[note_14] +id = 163 +persist = true + +[note_15] +id = 164 +persist = true + +[note_16] +id = 165 +persist = true + +[note_17] +id = 166 +persist = true + +[note_18] +id = 167 +persist = true + +[note_19] +id = 168 +persist = true + +[note_20] +id = 169 +persist = true + +[note_21] +id = 170 +persist = true + +[note_22] +id = 171 +persist = true + +[note_23] +id = 172 +persist = true + +[note_24] +id = 173 +persist = true + +[note_25] +id = 174 +persist = true + +[note_26] +id = 175 +persist = true + +[note_27] +id = 176 +persist = true + +[note_28] +id = 177 +persist = true + +[note_29] +id = 178 +persist = true diff --git a/data/entity/player/modal/tab/notes/notes.varbits.toml b/data/entity/player/modal/tab/notes/notes.varbits.toml new file mode 100644 index 0000000000..ed6b941a1b --- /dev/null +++ b/data/entity/player/modal/tab/notes/notes.varbits.toml @@ -0,0 +1,149 @@ +[note_colour_0] +id = 6316 +format = "int" +persist = true + +[note_colour_1] +id = 6317 +format = "int" +persist = true + +[note_colour_2] +id = 6318 +format = "int" +persist = true + +[note_colour_3] +id = 6319 +format = "int" +persist = true + +[note_colour_4] +id = 6320 +format = "int" +persist = true + +[note_colour_5] +id = 6321 +format = "int" +persist = true + +[note_colour_6] +id = 6322 +format = "int" +persist = true + +[note_colour_7] +id = 6323 +format = "int" +persist = true + +[note_colour_8] +id = 6324 +format = "int" +persist = true + +[note_colour_9] +id = 6325 +format = "int" +persist = true + +[note_colour_10] +id = 6326 +format = "int" +persist = true + +[note_colour_11] +id = 6327 +format = "int" +persist = true + +[note_colour_12] +id = 6328 +format = "int" +persist = true + +[note_colour_13] +id = 6329 +format = "int" +persist = true + +[note_colour_14] +id = 6330 +format = "int" +persist = true + +[note_colour_15] +id = 6331 +format = "int" +persist = true + +[note_colour_16] +id = 6332 +format = "int" +persist = true + +[note_colour_17] +id = 6333 +format = "int" +persist = true + +[note_colour_18] +id = 6334 +format = "int" +persist = true + +[note_colour_19] +id = 6335 +format = "int" +persist = true + +[note_colour_20] +id = 6336 +format = "int" +persist = true + +[note_colour_21] +id = 6337 +format = "int" +persist = true + +[note_colour_22] +id = 6338 +format = "int" +persist = true + +[note_colour_23] +id = 6339 +format = "int" +persist = true + +[note_colour_24] +id = 6340 +format = "int" +persist = true + +[note_colour_25] +id = 6341 +format = "int" +persist = true + +[note_colour_26] +id = 6342 +format = "int" +persist = true + +[note_colour_27] +id = 6343 +format = "int" +persist = true + +[note_colour_28] +id = 6344 +format = "int" +persist = true + +[note_colour_29] +id = 6345 +format = "int" +persist = true diff --git a/data/entity/player/modal/tab/notes/notes.varps.toml b/data/entity/player/modal/tab/notes/notes.varps.toml new file mode 100644 index 0000000000..755bc40ed0 --- /dev/null +++ b/data/entity/player/modal/tab/notes/notes.varps.toml @@ -0,0 +1,8 @@ +[notes_active] +id = 1437 +format = "boolean" + +[selected_note] +id = 1439 +default = -1 +format = "int" diff --git a/game/src/main/kotlin/content/entity/player/modal/tab/Notes.kt b/game/src/main/kotlin/content/entity/player/modal/tab/Notes.kt index ee30d01c8f..94a9e73851 100644 --- a/game/src/main/kotlin/content/entity/player/modal/tab/Notes.kt +++ b/game/src/main/kotlin/content/entity/player/modal/tab/Notes.kt @@ -1,12 +1,125 @@ package content.entity.player.modal.tab +import content.entity.player.dialogue.type.stringEntry import world.gregs.voidps.engine.Script +import world.gregs.voidps.engine.client.message +import world.gregs.voidps.engine.client.sendScript +import world.gregs.voidps.engine.entity.character.player.Player class Notes : Script { init { interfaceOpened("notes") { id -> interfaceOptions.unlockAll(id, "notes", 0..30) + interfaces.sendVisibility("notes", "add", !contains("note_29")) + set("notes_active", true) + set("selected_note", -1) + sendScript("clear_notes") + sendScript("show_notes") + for (i in 0 until 30) { + if (contains("note_$i")) { + sendVariable("note_$i") + sendVariable("note_colour_$i") + } + } } + + interfaceOption("Add note", "notes:add") { + val note = stringEntry("Add note:").take(80) + for (i in 0 until 30) { + if (contains("note_$i")) { + continue + } + set("note_$i", note) + set("selected_note", i) + break + } + if (contains("note_29")) { + interfaces.sendVisibility("notes", "add", false) + } + } + + interfaceOption("Select", "notes:notes") { + set("selected_note", it.itemSlot) + } + + interfaceOption("Edit", "notes:notes") { + val note = stringEntry("Edit note:", get("note_${it.itemSlot}")).take(80) + set("note_${it.itemSlot}", note) + set("selected_note", it.itemSlot) + } + + interfaceOption("Colour", "notes:notes") { + set("selected_note", it.itemSlot) + interfaces.sendVisibility("notes", "colours", true) + } + + interfaceOption("Delete", "notes:notes") { + val slot = it.itemSlot + delete(slot) + } + + interfaceOption("Delete", "notes:delete") { + val selected = get("selected_note", -1) + if (selected == -1) { + // https://youtu.be/zQwLVkwLgaI?t=12 + message("Please select a note to delete first.") + return@interfaceOption + } + delete(selected) + } + + interfaceOption("Delete all", "notes:delete") { + for (i in 0 until 30) { + clear("note_$i") + clear("note_colour_$i") + } + set("selected_note", -1) + sendScript("clear_notes") + interfaces.sendVisibility("notes", "add", true) + } + + interfaceOption("White", "notes:white") { + val slot: Int = get("selected_note") ?: return@interfaceOption + set("note_colour_$slot", 0) + sendScript("close_note_colours") + } + + interfaceOption("Green", "notes:green") { + val slot: Int = get("selected_note") ?: return@interfaceOption + set("note_colour_$slot", 1) + sendScript("close_note_colours") + } + + interfaceOption("Amber", "notes:amber") { + val slot: Int = get("selected_note") ?: return@interfaceOption + set("note_colour_$slot", 2) + sendScript("close_note_colours") + } + + interfaceOption("Red", "notes:red") { + val slot: Int = get("selected_note") ?: return@interfaceOption + set("note_colour_$slot", 3) + sendScript("close_note_colours") + } + } + + private fun Player.delete(slot: Int) { + clear("note_$slot") + clear("note_colour_$slot") + for (i in slot + 1 .. 30) { + val next = get("note_$i") + if (next == null) { + clear("note_${i - 1}") + clear("note_colour_${i - 1}") + if (i - 1 == slot) { + dec("selected_note") + } + break + } + set("note_${i - 1}", next) + set("note_colour_${i - 1}", get("note_colour_$i", 0)) + } + interfaces.sendVisibility("notes", "add", true) } } From 5e1192511dd62a88d0fa53e652dd94f4852a5705 Mon Sep 17 00:00:00 2001 From: GregHib Date: Fri, 10 Apr 2026 18:11:07 +0100 Subject: [PATCH 3/3] Formatting --- game/src/main/kotlin/content/entity/player/modal/tab/Notes.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/src/main/kotlin/content/entity/player/modal/tab/Notes.kt b/game/src/main/kotlin/content/entity/player/modal/tab/Notes.kt index 94a9e73851..bf1fd2ac0c 100644 --- a/game/src/main/kotlin/content/entity/player/modal/tab/Notes.kt +++ b/game/src/main/kotlin/content/entity/player/modal/tab/Notes.kt @@ -107,7 +107,7 @@ class Notes : Script { private fun Player.delete(slot: Int) { clear("note_$slot") clear("note_colour_$slot") - for (i in slot + 1 .. 30) { + for (i in slot + 1..30) { val next = get("note_$i") if (next == null) { clear("note_${i - 1}")