From 2d91a0bb034e2995ac48b18925038eb4cfac7c9f Mon Sep 17 00:00:00 2001 From: nihilazo Date: Thu, 18 Mar 2021 11:45:59 +0000 Subject: [PATCH] add message on 50 devices --- main.fs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/main.fs b/main.fs index 1c88441..d017957 100644 --- a/main.fs +++ b/main.fs @@ -29,6 +29,8 @@ variable devicerate create membercost 0 , 0 , \ the variable "membercount" is how many chat members you've hired. For each chat member, device gain delay decreases. variable membercount +\ count-messages-shown contains the amount of device count milestone messages that have been shown. +variable count-messages-shown \ message contains a string message which is printed on the screen. \ because forth is weird, strings can be stored in variables but it's easier to just store them someplace else and then store that address and the string's length in the variable (this is what S" " does and what "type" expects) \ as I'd like changed? etc to work on this, it needs to have three cells, arranged like this: @@ -46,8 +48,8 @@ variable membercount S" you feel like throwing some stuff into the pool." set-message \ FOR DEBUGGING PURPOSES - some sets that skip into the future -100 devices ! -10 membercost ! +\ 40 devices ! +\ 10 membercost ! \ any-change? leaves a -1 on the stack if any value has changed, 0 otherwise : any-change? ( -- flag ) membercost changed? devices changed? message changed? or or ; @@ -71,12 +73,21 @@ S" you feel like throwing some stuff into the pool." set-message \ the word tick-up ticks the counter up : tick-up tick 1 counter +! ; + +\ set-count-message sets the message to certain things based on the amount of devices in the pool. The count-messages-shown variable is used to track how many of these have already been shown. +: set-count-message + devices @ 50 > count-messages-shown @ 1 < and if + S" The pool is starting to look a little cluttered. " set-message + 1 count-messages-shown +! + then ; + \ the word game-tick runs a single tick of the game : game-tick tick-up unlock counter @ devicerate @ mod 0= if 1 devices +! + set-count-message devices changed then ; - + \ TODO saving \ the word exit-game exits the game. : exit-game page show-cursor bye ;