From 4277c9c0f0d2a75e5fe010c1fdb265db1de3e183 Mon Sep 17 00:00:00 2001 From: Musi57 <254671545+Musi57@users.noreply.github.com> Date: Sat, 17 Jan 2026 11:38:44 +0100 Subject: [PATCH 1/3] add Octopath Traveler 0 --- PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js | 98 ++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js diff --git a/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js b/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js new file mode 100644 index 0000000..b79d1e3 --- /dev/null +++ b/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js @@ -0,0 +1,98 @@ +// ==UserScript== +// @name OCTOPATH TRAVELER 0 +// @version 0.1 +// @author Mansive / Musi +// @description Steam +// * KEY +// +// https://store.steampowered.com/app/3014320/OCTOPATH_TRAVELER_0/ +// ==/UserScript== +const UE = require("./libUnrealEngine.js"); +const { getObjectFullName } = UE; + +const handlerLine = trans.send((s) => s, "250+"); + +// store last sent text for each context to avoid duplicates +const lastSent = {}; +// store character name +let lastCharacterName = ""; + +UE.setHook("/Script/Kingship.KSTextBlock:SetText", { + onEnter(args) { + const thiz = args[0]; + this.thiz = thiz; + // 304; 0x130 + // this.text = thiz.add(0x1A0).readPointer(); + // console.log("onEnter", this.text); + }, + onLeave(retVal) { + const thiz = this.thiz; // args[0] + // console.warn(hexdump(thiz, { header: true, ansi: true, length: 0x150 })); + const ptext = thiz.add(0x1A0); + + // no idea what this is for + // const text = ptext.readPointer(); + // if (text.equals(this.text) === true) { + // console.warn("HIT"); + // return; + // } + + // find the offset for `ptext` + // for (let i = 0; i < 60; i++) { + // const offset = 0x8 * i; + // console.warn("offset: ", offset); + // try { + // // console.warn("adding offset..."); + // const testptext = thiz.add(offset); + // // console.warn("reading string..."); + // console.warn(offset, JSON.stringify(testptext.readFTextString())); + // } catch (err) { + // console.error(err); + // } + // } + + const ctx = getObjectFullName(thiz); + let s = ptext.readFTextString(); + + // enable this log to discover all the calls to SetText + // console.warn("ctx:" + JSON.stringify(ctx)); + // console.warn("ctxStr:" + JSON.stringify(s) + "\n"); + + // capture name + if (ctx === "/Engine/Transient.GameEngine.KSGameInstance.BalloonManagerBP_C.WidgetTree.Balloon_03.WidgetTree.NameTextBlock") { + lastCharacterName = s; + } + + // paste in only the calls you want to get text from + if ( + ctx === "/Engine/Transient.GameEngine.KSGameInstance.BalloonManagerBP_C.WidgetTree.Balloon_03.WidgetTree.TalkText_Balloon.WidgetTree.Balloon" || // capture dialogue + ctx === "/Engine/Transient.GameEngine.KSGameInstance.NarrationWidget_C.WidgetTree.NarrationMessageWidget.WidgetTree.KSTextBlock" // capture fullscreen text + ) { + if (s !== "") { + // only send if text is different from the last sent text + if (!lastSent[ctx] || s.length > lastSent[ctx].length || !s.startsWith(lastSent[ctx].substring(0, s.length))) { + lastSent[ctx] = s; + + // clear name if this is a narration block to avoid carryover + if (ctx.includes("NarrationWidget")) { + lastCharacterName = ""; + } + + // combine name and text with a newline + const output = lastCharacterName ? `${lastCharacterName}\n\n${s}` : s; + handlerLine(output); + + // clear the name after sending so it doesnt stick to the next line + if (ctx.includes("TalkText_Balloon")) { + lastCharacterName = ""; + } + } + } + } + // uncomment to show all text not handled by our if-statements (to create filters) + else { + // console.warn("ctx:" + JSON.stringify(ctx)); + // console.warn("ctxStr:" + JSON.stringify(s) + "\n"); + } + }, +}); From 5beb69494924bca219bfcac7d292c05d2cce8873 Mon Sep 17 00:00:00 2001 From: Musi57 <254671545+Musi57@users.noreply.github.com> Date: Sat, 17 Jan 2026 21:06:22 +0100 Subject: [PATCH 2/3] add developer information --- PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js | 1 + 1 file changed, 1 insertion(+) diff --git a/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js b/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js index b79d1e3..7c798c9 100644 --- a/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js +++ b/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js @@ -1,5 +1,6 @@ // ==UserScript== // @name OCTOPATH TRAVELER 0 +// @developer Square Enix / DOKIDOKI GROOVE WORKS // @version 0.1 // @author Mansive / Musi // @description Steam From e1c1380614cc38beb2f0c891ec0c93710626ea01 Mon Sep 17 00:00:00 2001 From: Musi57 <254671545+Musi57@users.noreply.github.com> Date: Sat, 17 Jan 2026 23:38:20 +0100 Subject: [PATCH 3/3] fix format and update version to be the version of the game --- PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js b/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js index 7c798c9..4e1e7e6 100644 --- a/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js +++ b/PC_Steam_Unreal_OCTOPATH_TRAVELER_0.js @@ -1,10 +1,10 @@ // ==UserScript== // @name OCTOPATH TRAVELER 0 -// @developer Square Enix / DOKIDOKI GROOVE WORKS -// @version 0.1 +// @version 1.0.3.0 // @author Mansive / Musi // @description Steam -// * KEY +// * Square Enix +// * DOKIDOKI GROOVE WORKS // // https://store.steampowered.com/app/3014320/OCTOPATH_TRAVELER_0/ // ==/UserScript==