Subj : Replacing a text string to execute JS code directly To : Nightfox From : Digital Man Date : Fri Feb 07 2025 21:26:09 Re: Replacing a text string to execute JS code directly By: Nightfox to Digital Man on 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 > DM> 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, ""); Probably because of this logic in the getkey(): if ((sys_status & SS_USERON) && *text[AreYouThere] != '\0') { attr(LIGHTGRAY); carriage_return(); cleartoeol(); restoreline(); } So you'll probably want to bbs.replaceText(AreYouThere, "") in the getter, so you don't have this carriage-return, CLR-TO-EOL and restore line stuff going on. -- digital man (rob) Synchronet/BBS Terminology Definition #43: IBM437 = Code Page 437 (so-called IBM Extended ASCII) Norco, CA WX: 51.9øF, 93.0% humidity, 3 mph W wind, 0.13 inches rain/24hrs --- þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net .