;*****************************************************************************

3
;***************************************************************************** ;* * ;* Bank Time in User comment Record * ;* * ;* Written in PCBoard Programming Language * ;* * ;***************************************************************************** ; ; Cmd line: bank save time nnn bank s t nnn ; bank restore time nnn bank r t nnn ; bank display bank d ; :DEFINE_VARIABLES STRING cmdline,cmdtoken(5),usertoken(5),error,clrs(4) INTEGER maxtbank,count,chgtime :SET_PARAMETERS maxtbank = 90 ; max bank time - could be from a file chgtime = 0 ; but would be slower clrs(1) = "@X79" ; Command instruction color clrs(2) = "@X7B" ; Time text color clrs(3) = "@X7C" ; Error text color clrs(4) = "@X7E" ; General text color :START cmdline = TOKENSTR() ; store commandline TOKENIZE cmdline count = 1 ; Used while loops rather than GETTOKEN cmdtoken(count) ; for loobs as the while created 20 bytes WHILE (cmdtoken(count) != "") DO ; less code count = count + 1 ; GETTOKEN cmdtoken(count) ; ENDWHILE ; GETUSER IF (LEFT(U_NOTES(4),4)<>"BANK") THEN ; is bank setup in NOTES if not usertoken(1) = "BANK" ; do it usertoken(2) = "TIME" ; usertoken(3) = 0 ELSE TOKENIZE U_NOTES(4) ; Get bank info from NOTES count = 1 ; GETTOKEN usertoken(count) ; WHILE (usertoken(count) != "") DO ; count = count + 1 ; GETTOKEN usertoken(count) ; ENDWHILE ; ENDIF IF (LEFT(cmdtoken(1),1) = "D") THEN ; Look for "D"isplay PRINTLN "@POS:10@",clrs(1),usertoken(1)," ",usertoken(2),":

Upload: jelani-simmons

Post on 30-Dec-2015

17 views

Category:

Documents


0 download

DESCRIPTION

;*****************************************************************************. ;* *. ;* Bank Time in User comment Record *. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: ;*****************************************************************************

;*****************************************************************************;* *;* Bank Time in User comment Record *;* *;* Written in PCBoard Programming Language *;* *;*****************************************************************************;; Cmd line: bank save time nnn bank s t nnn; bank restore time nnn bank r t nnn; bank display bank d;:DEFINE_VARIABLES STRING cmdline,cmdtoken(5),usertoken(5),error,clrs(4) INTEGER maxtbank,count,chgtime:SET_PARAMETERS maxtbank = 90 ; max bank time - could be from a file chgtime = 0 ; but would be slower clrs(1) = "@X79" ; Command instruction color clrs(2) = "@X7B" ; Time text color clrs(3) = "@X7C" ; Error text color clrs(4) = "@X7E" ; General text color

:START cmdline = TOKENSTR() ; store commandline TOKENIZE cmdline count = 1 ; Used while loops rather than GETTOKEN cmdtoken(count) ; for loobs as the while created 20 bytes WHILE (cmdtoken(count) != "") DO ; less code count = count + 1 ; GETTOKEN cmdtoken(count) ; ENDWHILE ; GETUSER IF (LEFT(U_NOTES(4),4)<>"BANK") THEN ; is bank setup in NOTES if not usertoken(1) = "BANK" ; do it usertoken(2) = "TIME" ; usertoken(3) = 0 ELSE TOKENIZE U_NOTES(4) ; Get bank info from NOTES count = 1 ; GETTOKEN usertoken(count) ; WHILE (usertoken(count) != "") DO ; count = count + 1 ; GETTOKEN usertoken(count) ; ENDWHILE ; ENDIF IF (LEFT(cmdtoken(1),1) = "D") THEN ; Look for "D"isplay PRINTLN "@POS:10@",clrs(1),usertoken(1)," ",usertoken(2),": ",clrs(2),usertoken(3)," min." ELSEIF (LEFT(cmdtoken(1),1) = "S") DO ; Look for "S"ave IF (LEFT(cmdtoken(2),1) = "T") DO ; Look for "T"ime chgtime = cmdtoken(3) ELSE error = clrs(3)+"Incorrect command syntex - "+clrs(1)+"BANK SAVE TIME nn" GOTO EXIT ENDIF IF (chgtime > (MINLEFT() -5)) DO ; check time remaining after save error = (MINLEFT()-5) error = (clrs(4)+"The maximum time available to save is "+clrs(1)+error+clrs(4)+" min.") GOTO EXIT ELSEIF ((chgtime+usertoken(3)) > maxtbank) DO ; check maxallowed time error = (maxtbank - usertoken(3))

Page 2: ;*****************************************************************************

error = (clrs(4)+"The maximum time you can add to the bank is "+clrs(1)+error+clrs(4)+" min.") GOTO EXIT ELSE usertoken(3) = chgtime+usertoken(3) U_NOTES(4) = usertoken(1)+" "+usertoken(2)+" "+usertoken(3) PUTUSER U_NOTES(4) ; update bank ADJTIME -chgtime ; update board time ENDIF PRINTLN "@POS:10@",clrs(2),chgtime,clrs(4)," min. added to bank" ELSEIF (LEFT(cmdtoken(1),1) = "R") THEN ; look for "R"estore IF (LEFT(cmdtoken(2),1) = "T") DO chgtime = cmdtoken(3) ELSE error = clrs(3)+"Incorrect command syntex - "+clrs(1)+"BANK RESTORE TIME nn" GOTO EXIT ENDIF IF (chgtime > usertoken(3)) DO ; check available time - no limits error = (usertoken(3)) ; on total restore error = (clrs(4)+"The maximum time available to restore is "+clrs(1)+error+clrs(4)+" min.") GOTO EXIT ELSE usertoken(3) = usertoken(3) - chgtime U_NOTES(4) = usertoken(1)+" "+usertoken(2)+" "+usertoken(3) PUTUSER U_NOTES(4) ; update bank ADJTIME chgtime ; update board time ENDIF PRINTLN "@POS:11@",clrs(2),chgtime,clrs(4)," min. added to use" ELSE PRINTLN "@POS:4@",clrs(4),"Syntex is: ",clrs(1),"BANK DISPLAY,clrs(4), ",clrs(1),"BANK SAVE TIME nn",clrs(4),", or ",clrs(1),"BANK RESTORE TIME ",clrs(1),"nn" ENDIF:EXIT IF (ERROR != "") THEN PRINTLN error ENDIF END