From abde741d2821029efae61772dabae27d903166fc Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 25 Apr 2020 17:41:37 -0400 Subject: add a changesex pseudo-atcommand --- npc/commands/gender.txt | 35 +++++++++++++++++++++++++++++++++++ npc/functions/gender.txt | 13 +++++++++++++ npc/scripts.conf | 2 ++ 3 files changed, 50 insertions(+) create mode 100644 npc/commands/gender.txt create mode 100644 npc/functions/gender.txt (limited to 'npc') diff --git a/npc/commands/gender.txt b/npc/commands/gender.txt new file mode 100644 index 00000000..b852beb0 --- /dev/null +++ b/npc/commands/gender.txt @@ -0,0 +1,35 @@ +// @gender atcommand +// changes or returns the gender + +- script @gender 32767,{ + end; + +OnCall: + if (.@atcmd_parameters$[0] == "") { + dispbottom("Your current gender is " + genderToString()); + end; + } + + .@desired = stringToGender(.@atcmd_parameters$[0]); + + if (.@desired == Gender) { + dispbottom("Your gender is already " + genderToString()); + } else { + Gender = .@desired; + dispbottom("Gender changed to " + genderToString()); + } + end; + +OnInit: + bindatcmd("gender", "@gender::OnCall", 99, 99, false); + add_group_command("gender", 40, true, false); + add_group_command("gender", 50, true, true); + add_group_command("gender", 60, true, true); + add_group_command("gender", 80, true, true); + + bindatcmd("changesex", "@gender::OnCall", 99, 99, false); + add_group_command("changesex", 40, true, false); + add_group_command("changesex", 50, true, true); + add_group_command("changesex", 60, true, true); + add_group_command("changesex", 80, true, true); +} diff --git a/npc/functions/gender.txt b/npc/functions/gender.txt new file mode 100644 index 00000000..7685ffa9 --- /dev/null +++ b/npc/functions/gender.txt @@ -0,0 +1,13 @@ +function script stringToGender { + .@short$ = strtolower(charat(getarg(0, ""), 0)); + + return .@short$ == "f" ? GENDER_FEMALE : + .@short$ == "m" ? GENDER_MALE : GENDER_NONBINARY; +} + +function script genderToString { + .@gender = getarg(0, Gender); + + return .@gender == GENDER_FEMALE ? l("female") : + .@gender == GENDER_MALE ? l("male") : l("non-binary"); +} diff --git a/npc/scripts.conf b/npc/scripts.conf index f003912e..330f6c62 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -12,6 +12,7 @@ "npc/functions/RNGesus.txt", "npc/functions/math.txt", "npc/functions/warp.txt", +"npc/functions/gender.txt", // Misc functions "npc/functions/main.txt", @@ -127,6 +128,7 @@ "npc/commands/super-menu.txt", "npc/commands/resync.txt", "npc/commands/python.txt", +"npc/commands/gender.txt", // config script "npc/config/hairstyle_config.txt", -- cgit v1.2.3-70-g09d2