/************************************************************************* Empire v2.00 By Crazy Cad Copyright (C) 1990,1991,1992 Updated 6-7-92 * * Do Not Modify This Program Without Consent of Crazy Cad * * Emp.EdPrice (Edit Investment Prices) Version 2.00 RELEASE Version ************************************************************************* See Empire documentation for additional program information. To contact me call at the Amiga Castle BBS (214) 219-0493 or write to me at the following address: Chris A.D. Post Box 294331 Lewisville, TX 75029-4331 This program is authorized to be ran on C-Net Amiga BBS Systems Only. ************************************************************************/ options results signal on error signal on syntax signal on ioerr signal on halt errors=0 lf='n1' name.0='Soldiers (Sending for Additional soldier)' name.1='Soldiers (From Investments)' name.2='Markets' name.3='Mills' name.4='Palace (10%)' name.5='Foundries' name.6='Shipyard' name.7='Nobles' name.8='Diplomats' name.9='Spies' call ReadConfig /* Read Emp.Config. (Get Paths) */ START: transmit 'f1n1c2 Empire Investment Cost Editor by c9Crazy Cadn1' do z=0 to 9 transmit ' c5 'z'c4.c7 'name.z end transmit 'n1 c5 Qc4.c7 Quitn2' sendstring 'c3Which investment cost would you like to change: ' call getans transmit ans if ans='Q' then signal done x=value(ans) if x<0 | x>9 then do transmit 'n1c3Investments are numbered 0-9. Please try again.n1' call anykey signal start end call ReadInvest(x) if valid=1 then do interpret line.1 transmit 'c2The Current cost of 'name.x' is 'cost prompt='c6Enter New Value c7(c9Return=No Changec7)c6:c1n1' call getmes if ans='' then do transmit 'c3No Change was made.n1' call anykey signal start end transmit 'c3Saving Change.' transmit 'c7n1NOTE: It is up to YOU to change the prices on the Investment Menu.' transmit ' Use a text editor or the WF to edit PFILES:Emp/Files/Emp.Menu2 file.n1' call anykey line.1='cost='ans' /* Cost of 'name.x' */' call saveinvest(x) end signal start QUIT: DONE: transmit 'n1c2Emp.EdPrice Program Completedn1q1' EXIT ANYKEY: transmit 'c7(c9Press Any Keyc7)g1' return READINVEST: /* PURPOSE: Read Investment file */ /* PRECONDITIONS: */ /* POSTCONDITIONS: */ arg inv filen=path.6||'Emp.Invest'inv if ~exists(filen) then do transmit filen' missing.' transmit 'Program Aborted.' signal done end call open(ifile,filen,'R') linenum=1 do until eof(ifile)=1 line.linenum=readln(ifile) linenum=linenum+1 end call close ifile valid=0 if upper(left(line.1,5))='COST=' then valid=1 if pos(';',line.1)>0 then valid=0 return /* READINVEST */ SAVEINVEST: /* PURPOSE: Save Investment file */ /* PRECONDITIONS: */ /* POSTCONDITIONS: */ arg inv filen=path.6||'Emp.Invest'inv call open(ifile,filen,'W') do z=1 to linenum call writeln(ifile,line.z) end call close ifile return /* SAVEINVEST */ READCONFIG: /* PURPOSE: Read Emp.Config variables */ /* PRECONDITIONS: Emp.Config exists. */ /* POSTCONDITIONS: Emp.Config vars (Paths) are in memory */ filen='PFILES:Emp.Config' if ~exists(filen) then do transmit 'Emp.Config missing.' transmit 'Program Aborted.' signal done end /* transmit 'c7- c6Reading Emp.Config' */ call open(config,filen,'R') do until eof(config)=1 interpret readln(config) end call close config return /* READCONFIG */ ERROR: type='Error';x=sigl;code=rc signal ERRORLOG SYNTAX: type='Syntax Error';x=sigl;code=rc signal ERRORLOG IOERR: type='I/O Error';code=rc;x=sigl signal ERRORLOG ERRORLOG: if errors>1 then exit errors=errors+1 fn='Error' call clock mes='c7'date time 'c6'name' Emp.UpEmp 'type' in line:' x call logit(0,fn) logentry mes mes='c2'sourceline(x) LF ' Error Code='code' ('errortext(code)')' call logit(0,fn) transmit 'c7Oops, c6It seems we got a 'type' in line:' x exit HALT: transmit 'Emp.UpEmp HALTED.' exit CLOCK: time=right(' '||time('c'),7) date=left(date(M),3)||' '||left(date(E),2) return LOGIT: arg p,fn filen=path.p||fn call clock if exists(filen)=0 then call open(logi,filen,'W') else call open(logi,filen,'A') call writeln(logi,mes) call close logi return GETANS: sendstring 'c9';getchar;ans=upper(result) if ans='###PANIC' then signal quit return GETMES: query prompt||'c9';ans=result if ans='###PANIC' then signal quit return GETNUM: query prompt||'c9' x=result if x='###PANIC' then signal quit if x='' then x=0 x=strip(x,,'%') x=strip(x,,'$') if datatype(x,w)~=1 then do transmit 'b1c7Invalid Input. Try Entering a Real Number!n1' bufferflush;signal getnum end if x<0 then do transmit 'b1c7Try Entering a Number that is POSITIVE!n1' bufferflush;signal getnum end return