TGC Codebase Backup



Diplomacy Clock by textile guy djbjrca

24th Jan 2005 9:41
Summary

This program times games of the board game Diplomacy.



Description

You probably will never need this timer, but it has some elements that might be useful in other programs, especially for beginners trying to learn the language.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    remstart
Diplomacy Clock
PLAESE DO NOT ALTER
Copyright 2004 by Ben Lovy and Jacob Addelson
remend
sync on
hide mouse
intro:
load bitmap "diplomacyclockbmp.bmp"
wait 2143
cls
load bitmap "dipclockback.bmp"
rem this is the first thing printed on the screen
ink rgb(240,196,15),1
print "Diplomacy Clock"
print "This clock is made for either home or tournament use.  It is not official."
print "If you paid money for your software, you were ripped off.  It is freeware."
print "Copyright 2004 by Ben Lovy and Jacob Addelson"
print "By the way, everything is case-sensitive"
print "Please note that the fall phase includes adjustemnts and builds."
input "Do you wish to start the diplomacy software? (y)es or (n)o> ";start$
if start$="y"
cls
year=1901
load bitmap "dipclockback.bmp"
recheck:
dim InputWords$(2)
dim params(2)
read num_params
for i = 1 to num_params
   read InputWords$(i)
next i

for i = 1 to num_params
   read params(i)
next i

for i = 1 to num_params
  print i;". ";InputWords$(i);" - ";params(i)
next i

data 2
data "Spring","Fall"
data 17,23
cls
load bitmap "dipclockback.bmp"
for i = 1 to num_params
  print i;". ";InputWords$(i);" - ";params(i)
next i
change:
cls
load bitmap "dipclockback.bmp"
springmin = params(1)
fallmin = params(2)
params(1) = springmin
params(2) = fallmin
print "Spring - ";params(1);"."
print "Fall - ";params(2);"."
input "Do you want to change any of the parameters for ";year;"?  y or n> ";change$
if change$ = "y" then gosub changeparameter
if change$ = "n"
gosub springtimer
else
print "Unrecognized answer.  Try again."
gosub change
endif
newchange:
cls
load bitmap "dipclockback.bmp"
print "Spring - ";springmin;"."
print "Fall - ";fallmin;"."
params(1) = springmin
params(2) = fallmin
input "Do you want to change any of the parameters for ";year;"?  y or n> ";change$
if change$ = "y" then gosub changeparameter
if change$ = "n"
gosub springtimer
else
print "Unrecognized answer.  Try again."
gosub newchange
endif
changeparameter:
cls
load bitmap "dipclockback.bmp"
input "Which do you want to change: (s)pring or (f)all?> ";changesf$
if changesf$ = "s" then gosub changespring
if changesf$ = "f"
gosub changefall
else
gosub changeparameter
endif
changespring:
cls
load bitmap "dipclockback.bmp"
input "Enter the whole number (in minutes) that you would like to change spring to> ";springmin
params(1) = springmin
input "If ";params(1);" is the length that you want, enter y.  If not, enter n> ";verifsp$
if verifsp$ = "y"
   gosub change
else
   gosub changespring
endif
changefall:
cls
load bitmap "dipclockback.bmp"
input "Enter the whole number (in minutes) that you would like to change fall to> ";fallmin
params(2) = fallmin
input "If ";params(2);" is the length that you want, enter y.  If not, enter n> ";veriffa$
if veriffa$ = "y"
   gosub change
else
   gosub changefall
endif
   springtimer:

test:
cls
secs=59
params(1) = params(1) - 1
do

   print " ";params(1);":";secs;" left in Spring ";year;""

   wait 1000

   cls
   secs=secs - 1
   if secs=-1
      secs=59
      params(1)=params(1)-1
   endif
   if params(1)=-1
      exit
   endif
   if controlkey()=1
      cls
      print "Timer Paused.  Press any key to contine"
      suspend for key
      cls
   endif
loop
load sound "tone.wav",1
play sound 1
loop sound 1
cls
print "Press any key to continue"
suspend for key
   stop sound 1
   cls
print "Spring has ended.  Do you wish to start fall?  Press any key to start Fall"
suspend for key
gosub timefall
endif

timefall:
cls
cecs=59
params(2) = params(2) - 1
do

   print " ";params(2);":";cecs;" left in Fall ";year;""

   wait 1000

   cls
   cecs=cecs - 1
   if cecs=-1
      cecs=59
      params(2)=params(2)-1
   endif
   if params(2)=-1
      exit
   endif
 if controlkey()=1
      cls
      print "Timer Paused.  Press any key to contine"
      suspend for key
      cls
   endif
loop
play sound 1
loop sound 1
print "Press any key to go on to the next year."
year=year+1
suspend for key
stop sound 1
gosub newchange
if start$="n"
   print "Come again!"
   sleep 1002
   end
endif