From: Jason Self Date: Sun, 8 Sep 2019 22:42:11 +0000 (-0700) Subject: Scoring doesn't need global variables X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=fd3ce2682e9aa004a8e092b05cce4ae93d8ea083;p=the-server-room.git Scoring doesn't need global variables --- diff --git a/the-server-room.inf b/the-server-room.inf index b79609a..2af50d3 100644 --- a/the-server-room.inf +++ b/the-server-room.inf @@ -42,9 +42,6 @@ Serial "190908"; Constant MAX_SCORE = 6; Include "parser"; Include "verblib"; -Global openedbackpack = 1; -Global openedtray = 1; -Global takencd = 1; Global beeping = 1; !========================================================================= ! The Game Objects @@ -117,9 +114,9 @@ Object backpack "backpack" table article "your", before [; Open: - if (openedbackpack == 1) { + if (backpack hasnt visited) { score = score + 2; - openedbackpack = 2; + give backpack visited; } ], has clothing container openable; @@ -132,10 +129,9 @@ Object disc "Trisquel CD" backpack name 'disk' 'disc' 'Trisquel' 'cd', after [; Take: - if (takencd == 1) { + if (disc hasnt visited) { score = score + 2; - takencd = 2; - print_ret "You pick up the Trisquel CD.^"; + give disc visited; } ], has ; @@ -217,9 +213,9 @@ Object tray "tray" server_room if (noun ~= disc) print_ret (The) noun, " is too big to fit."; Open: - if (openedtray == 1) { + if (tray hasnt visited) { score = score + 2; - openedtray = 2; + give tray visited; } ], after [;