summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2025-02-02 21:33:44 +0000
committerJesusalva Jesusalva <jesusalva@tmw2.org>2025-02-02 21:33:44 +0000
commit858c5a7b89d1fd7ad1e7e984302f85d7247fd0dc (patch)
tree8cd11c888c380e9af9f07520d80c0a68ed83a3da
parentd5922cb42ceacc3af9965053211575935587f892 (diff)
downloadserverdata-858c5a7b89d1fd7ad1e7e984302f85d7247fd0dc.tar.gz
serverdata-858c5a7b89d1fd7ad1e7e984302f85d7247fd0dc.tar.bz2
serverdata-858c5a7b89d1fd7ad1e7e984302f85d7247fd0dc.tar.xz
serverdata-858c5a7b89d1fd7ad1e7e984302f85d7247fd0dc.zip
Add askyesnosafe(), the safer version of askyesno for space-mashers like myself.
+ lovely reindent of askyesno() Also: 1. I shifted one `mes "";` a bit in rebirth code, that may or may not break stuff. ~~2. There must be another case of where to use askyesnosafe but I can't remember where.~~ * Applied 1 suggestions from the MR body. * Preserve old messages.. * nvm this is where it was missing * Add askyesnosafe(), the safer version of askyesno for space-mashers like myself. + lovely reindent of askyesno() **** ml/serverdata!172 Approved-by: Jesusalva Jesusalva <jesusalva@tmw2.org>
-rw-r--r--npc/017-3/chagashroom.txt2
-rw-r--r--npc/024-9/sake.txt2
-rw-r--r--npc/025-1/phoenix.txt9
-rw-r--r--npc/025-1/rum.txt2
-rw-r--r--npc/031-6/siegfried.txt4
-rw-r--r--npc/functions/main.txt23
6 files changed, 30 insertions, 12 deletions
diff --git a/npc/017-3/chagashroom.txt b/npc/017-3/chagashroom.txt
index 75c0e7b59..759062a9b 100644
--- a/npc/017-3/chagashroom.txt
+++ b/npc/017-3/chagashroom.txt
@@ -137,7 +137,7 @@ L_Main:
if (redwine_chance()/100 < 1) close;
mes l("Attempt to retrieve it now?");
next;
- if (askyesno() == ASK_YES) {
+ if (askyesnosafe() == ASK_YES) {
if (rand(1000,10000) < redwine_chance()) {
mesc l("Success!"), 3;
getitem RedPlushWine, REDWINE_AMMO*3;
diff --git a/npc/024-9/sake.txt b/npc/024-9/sake.txt
index c7ec4054e..a7a262d91 100644
--- a/npc/024-9/sake.txt
+++ b/npc/024-9/sake.txt
@@ -147,7 +147,7 @@ L_Main:
if (dwarvensake_chance()/100 < 1) close;
mes l("Attempt to retrieve it now?");
next;
- if (askyesno() == ASK_YES) {
+ if (askyesnosafe() == ASK_YES) {
if (rand(1000,10000) < dwarvensake_chance()) {
mesc l("Success!"), 3;
getitem DwarvenSake, DWARVEN_AMMO*3;
diff --git a/npc/025-1/phoenix.txt b/npc/025-1/phoenix.txt
index 2f1f77bd3..c1edc71f3 100644
--- a/npc/025-1/phoenix.txt
+++ b/npc/025-1/phoenix.txt
@@ -74,13 +74,10 @@ OnMain:
next;
setpcblock(PCBLOCK_HARD, false);
inventoryplace NPCEyes, 7;
- select
- l("Do not rebirth"),
- l("Rebirth"),
- l("Do not rebirth");
- mes "";
- if (@menu != 2)
+
+ if (askyesnosafe(l("Rebirth"), l("Do not rebirth")) != ASK_YES)
close;
+ mes "";
mesc l("ARE YOU SURE? THIS CANNOT BE UNDONE LATER!!"), 1;
if (askyesno() != ASK_YES)
close;
diff --git a/npc/025-1/rum.txt b/npc/025-1/rum.txt
index a8498758f..9c7c097ae 100644
--- a/npc/025-1/rum.txt
+++ b/npc/025-1/rum.txt
@@ -147,7 +147,7 @@ L_Main:
mes l("Trying to retrieve it now will have @@ % chance to be successful.", rumbarrel_chance()/100);
mes l("Attempt to retrieve it now?");
next;
- if (askyesno() == ASK_YES) {
+ if (askyesnosafe() == ASK_YES) {
if (rand(1000,10000) < rumbarrel_chance()) {
mesc l("Success!"), 3;
if (REBIRTH > rand2(20))
diff --git a/npc/031-6/siegfried.txt b/npc/031-6/siegfried.txt
index f0133b2cd..73c709c42 100644
--- a/npc/031-6/siegfried.txt
+++ b/npc/031-6/siegfried.txt
@@ -80,7 +80,9 @@ L_Evolution:
next;
mesc l("Evolve your Homunculus? This is irreversible!"), 1;
mesc l("Class after evolution: %s", HEC_GetCName(HEC_SimpleEvolve()));
- if (select("No:Yes:Never") != 2) { closeclientdialog; close;}
+ if (askyesnosafe("Yes", "No", "Never") != ASK_YES) {
+ closeclientdialog; close;
+ }
// Initiate the Riddle, consume the GP and Intimacy first
// Only drain 899 units to give you a "grace" period for the puzzle.
Zeny -= 5000;
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index b0170d5ea..468e5fe70 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -223,11 +223,30 @@ function script npcdebug {
return;
}
+
function script askyesno {
- return select(menuaction(l("Yes")),
- menuaction(l("No")));
+ return
+ select(
+ menuaction(l("Yes")),
+ menuaction(l("No"))
+ );
+}
+
+// for the space-mashers like myself ~_~
+function script askyesnosafe {
+ .@promptYes = getarg(0, l("Yes"));
+ .@promptNo = getarg(1, l("No"));
+ .@promptNo2 = getarg(2, .@promptNo);
+
+ select(
+ menuaction(.@promptNo),
+ menuaction(.@promptYes),
+ menuaction(.@promptNo2));
+
+ return (@menu == 2 ? ASK_YES : ASK_NO);
}
+
// Argument:
// 0 Quest variable
// 1 Current value