From 7972d28fd9c08f73b14e45fb6a2e9ef3833b3ad9 Mon Sep 17 00:00:00 2001 From: Jason Self Date: Mon, 30 May 2022 17:28:19 -0700 Subject: [PATCH] Implement scoring --- src/snowed-in.inf | 67 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 8 deletions(-) diff --git a/src/snowed-in.inf b/src/snowed-in.inf index 6c262e2..3bdf710 100644 --- a/src/snowed-in.inf +++ b/src/snowed-in.inf @@ -17,7 +17,7 @@ Global body_temperature = 20; Global cabin_has_electricity = 1; Global forest_location = 1; Global snowmobile_location = 0; -Constant NO_SCORE; +Constant MAX_SCORE = 7; Constant DEATH_MENTION_UNDO; Constant Story "Snowed In"; Constant Headline @@ -38,7 +38,7 @@ Constant Headline Include "parser"; Include "verblib"; Release 1; -Serial "220530"; +Serial "220531"; Object mainroom "Main Room" with description @@ -169,6 +169,7 @@ Object television "flat-screen TV" mainroom print_ret (The) self, " is firmly mounted to the wall."; SwitchOn: if (television hasnt visited) { + score = score + 1; print "Despite the significant damage, the television comes to life in one last valiant attempt to be @@ -266,6 +267,10 @@ Object office "Office" "You can't fit through the window while wearing the snow shoes."; } + if (eastofcabin hasnt visited) { + score = score + 1; + give office visited; + } ], w_to mainroom, e_to window, @@ -312,6 +317,7 @@ Object computer "computer" desk print_ret (The) self, " is too heavy for that."; SwitchOn: if (computer hasnt visited) { + score = score + 1; print "The computer makes some concerning noises while lights on the front also illuminate. The last @@ -464,6 +470,11 @@ Object snowsuit "snowsuit" suitcase "The snowsuit is blue, decorated with white and purple designs. On the chest are the letters ~CE~ in purple.", before [; + Examine: + if (snowsuit hasnt visited) { + score = score + 1; + give snowsuit visited; + } Wear: if (snowshoes in player && snowshoes has worn) { print_ret "The snowsuit can't fit over the snowshoes."; @@ -644,6 +655,13 @@ Object backpack "backpack" backpacklocation toward the bottom of the backpack. On the side are the letters ~CE~ in purple. The backpack is covered in blood, as if the owner met with an untimely demise.", + before [; + Examine: + if (backpack hasnt visited) { + score = score + 1; + give backpack visited; + } + ], has clothing container openable; Object flashlight "flashlight" backpack @@ -653,6 +671,10 @@ Object flashlight "flashlight" backpack inches long.", before [; SwitchOn: + if (flashlight hasnt visited) { + score = score + 1; + give flashlight visited; + } give flashlight light; SwitchOff: give lantern ~light; @@ -841,6 +863,7 @@ Object forest "Forest" give lantern ~light; lantern_fuel_left = 0; StopDaemon(lantern); + score = score - 1; ]; [ check_for_cabin_lighting; @@ -917,7 +940,16 @@ Object northofcabin "North Of Cabin" n_to westofcabin, s_to roof, w_to westofcabin, - cant_go "It's too steep to go in that direction safely."; + cant_go "It's too steep to go in that direction safely.", + before [; + Go: + if (noun == s_obj) { + if (roof hasnt visited) { + score = score + 1; + give roof visited; + } + } + ]; Object westofcabin "West Of Cabin" with description @@ -990,9 +1022,8 @@ Object snowmobile "snowmobile" thedark { deadflag = 2; print_ret - "You hear a snowmobile approaching in the - distance. The person says they saw your light and - came to rescue you."; + "A snowmobile approaches. The person says they + saw your light and came to rescue you."; } return true; ], @@ -1070,10 +1101,30 @@ Object grue "grue" thedark grue!"; ]; +[ PrintRank; + print ", earning you the rank of "; + if (score == 0) + "Novice."; + if (score == 1) + "Trained."; + if (score == 2) + "Skilled."; + if (score == 3) + "Talented."; + if (score == 4) + "Capable."; + if (score == 5) + "Adept."; + if (score == 6) + "Proficient."; + if (score >= 7) + print "Versed."; +]; + [ URL; print "^If you need help try some of the commands from: - ^http://pr-if.org/doc/play-if-card/^"; + ^https://pr-if.org/doc/play-if-card/^"; ]; [ XyzzySub; @@ -1119,4 +1170,4 @@ Extend 'climb' * 'through' / 'out' / 'via' noun -> Go; Extend 'go' - * 'through' / 'out' / 'via' noun -> Go; \ No newline at end of file + * 'through' / 'out' / 'via' noun -> Go; -- 2.31.1