Subj : Replacing a text string to execute JS code directly
To : Digital Man
From : Nightfox
Date : Fri Feb 07 2025 04:52 pm
Re: Replacing a text string to execute JS code directly
By: Digital Man to Nightfox on Wed Jan 29 2025 02:43 pm
DM> Object.defineProperty(js.global, "prop", {
DM> get : function () {
DM> return "hello, world";
DM> }
DM> });
DM> bbs.replace_text("Pause", "@JS:" + "prop@"); // @-code split for posting
I'm following this pattern to replace AreYouThere, and it seems like after the get function executes and returns, it seems like something wonky is going on with screen refreshing. With DDMsgReader, it seems there is a bit of scrolling on the screen and/or something wonky is going on with cursor movement via cursor.gotoxy(). Within the get function though, I've used cursor.gotoxy() and output a message, that worked as expected.
I tried updating my get function to just return ""; and did a test with DDMsgReader. Before the the timeout warning, I had the user account looking at the message reading screen in DDMsgReader:
http://www.digitaldistortionbbs.com:81/synchronet_stuff/reading1.png
I waited for the configured amount of time, and after the get() was called for AreYouThere (returning ""), I pressed the down arrow, which should scroll the message down one line, and the screen was then as follows:
http://www.digitaldistortionbbs.com:81/synchronet_stuff/reading_AfterAYT_AD.png
If the getter is returning an empty string, I'm not sure what's causing the display to become messy. This does not happen if I replace AreYouThere with a simple empty string as follows:
bbs.replace_text(AreYouThere, "");
Nightfox
---
� Synchronet � Digital Distortion: digitaldistortionbbs.com