-------cut here-------------- // // This is a very simple piece of code that allows the player to choose // whether or not they want to be notified when they're score changes. It // is should be bug-free, being a simple hack. Just include this in your // game and *POOF*, instant notify. Oh yeah, if you DO find a bug in it // through some miracle, let me know. // Gerry Kevin Wilson (whizzard@uclink.berkeley.edu) // // notify.t - This is a fairly small, very straightforward piece of code. // What is does exactly is this: Whenever the player's score changes, // it prints out a message saying how much it changed by, either up or // down. It has a special case for 1 and -1 as well. It will not let // call incscore with a 0 value, which is usually a mistake. All such // notifications are in bold type, which is easily removed. Lastly, a // one-time message lets the player know how to turn the notifications // on and off. There are no spaces between the messages and the // brackets. modify global: object // Set this to nil for a default of off for messages. notifie = true; // Do NOT change this to notify. That would conflict // with the notify() command and you will get errors. warned = nil; // Kind of wasteful, but I couldn't think of a better // way to tell whether the first notify had popped up // yet or not. ; replace incscore: function( amount ) { global.score := global.score + amount; if (global.notifie <> nil) { if (amount = 0) { "Incscore() called with value of 0.\n "; return(nil); } if (amount > 0) // This covers positive values for amount. switch(amount) { case 1: "\b\([Your score just went up by <> point.\)"; break; default: "\b\([Your score just went up by <> points.\)"; } if (amount < 0) // This covers negative values for amount. switch(amount) { case -1: "\b\([Your score just went down by <> point.\)"; break; default: "\b\([Your score just went down by <> points.\)"; } if (global.warned) { // Closing bracket for all calls but the first. "\(]\)\b"; } else { // This message is only recieved in the first notify "\( You can turn these notifications at any time by typing 'notify'.]\)\b"; global.warned := true; } } // The old standby call to scoreStatus. scoreStatus( global.score, global.turnsofar ); } notifyVerb: sysverb verb = 'notify' sdesc = "notify" action( actor ) = { if(global.notifie) { "Notify is now OFF. "; global.notifie := nil; } else { "Notify is now ON. "; global.notifie := true; } } ; ----------------------------