From f92fa785a1ab98574fce86d3e00744b7283639ed Mon Sep 17 00:00:00 2001
From: Michael Long <mlong@bizjournals.com>
Date: Sun, 22 Nov 2020 12:07:04 -0500
Subject: [PATCH] Enable the option to ask for continuation/enter door when
 displaying info/intro ans/msg file. This could be useful when displaying info
 about a door, showing rules, etc.

---
 ctrl/modopts.ini |  4 ++++
 exec/prextrn.js  | 19 ++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/ctrl/modopts.ini b/ctrl/modopts.ini
index ba1ae35db7..1d768e747f 100644
--- a/ctrl/modopts.ini
+++ b/ctrl/modopts.ini
@@ -95,6 +95,10 @@
 ;       multicolumn_fmt: \1h\1c%3u \xb3 \1n\1c%-26.26s\1h %5u
 ;       singlecolumn_fmt: \1h\1c%3u \xb3 \1n\1c%-26.26s\1h %5u
 
+; to ask for continuation after showing DOOR intro/message file, enable this
+;       prompt_on_info = true
+;       prompt_on_info_fmt: \r\n\x01n\x01cDo you wish to continue
+    
 [chat_sec]
 ; Over-ride default IRC server/port and channel (if desired) here:
 	irc_server = irc.synchro.net 6667
diff --git a/exec/prextrn.js b/exec/prextrn.js
index 46132f3277..7a2df9c23f 100644
--- a/exec/prextrn.js
+++ b/exec/prextrn.js
@@ -14,6 +14,15 @@ function exec_xtrn_pre(prog)
 			options = {};	// default values
 	}
 
+	// If displaying CODE.ans file, prompt the user to continue to enter the game or not
+	if (typeof options.prompt_on_info === "undefined") {
+		options.prompt_on_info = false;
+	}
+
+	if (typeof options.prompt_on_info_fmt === "undefined") {
+		options.prompt_on_info_fmt = "\r\n\x01n\x01cDo you wish to continue";
+	}
+
 	require("nodedefs.js", "NODE_LOGN");
 	if (bbs.node_action == NODE_LOGN) {
 		if (options.disable_pre_on_logon_event) {
@@ -33,7 +42,15 @@ function exec_xtrn_pre(prog)
 
 	if (bbs.menu_exists("xtrn/" + prog.code)) {
 		bbs.menu("xtrn/" + prog.code);
-		console.pause();
+
+		// If displaying CODE.ans file, prompt the user to continue to enter the game or not
+		if (options.prompt_on_info) {
+			if (!console.yesno(options.prompt_on_info_fmt)) {
+				exit(1);
+			}
+		} else {
+			console.pause();
+		}
 		console.line_counter=0;
 	}
 
-- 
GitLab