home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / arexx / megawars.lha / M6a < prev    next >
Encoding:
Text File  |  1990-11-27  |  49.7 KB  |  1,941 lines

  1. /*
  2. >**** 3meg RAM version ****< Do not alter any part of this window at top!!
  3. Mega-Wars I v1.2a by Rich Deck (aka The Caretaker) of The Lost City AMIGA BBS
  4. 313-274-1917   *   313-561-1399     300/1200/2400 baud on both ports
  5. ==========================================================================
  6. © 1990 Richard D. Deck. All Rights Reserved.  Distribution of this program
  7. without the expressed written consent of the author is in direct violation
  8. of strict Copyright laws.
  9. ==========================================================================
  10. Note: This program was written for C-Net Amiga and was not intended to run
  11. on any program BUT C-Net Amiga.
  12. */
  13. options results
  14. signal on error
  15. signal on syntax
  16. signal on ioerr
  17. signal on halt
  18. Getuser23;Port=Result
  19. Mem=GetClip('RAM'||Port);Jv=SetClip('RAM'||Port,'')
  20. Call INITIAL;Call BEGA
  21. Call LGAME;Quit=0
  22. Do Until Quit=1
  23. Call SETCOM
  24. Sendstring Ques
  25. Call INPUT
  26. Call COMMANDS
  27. End
  28. Signal Bye
  29. RAT:
  30. Arg Z,ZA
  31. ZB=int(abs(Z)/ZA*1000+.5)/10
  32. ZC='-';if Z >= 0 then ZC='+'
  33. if ZB=int(ZB) then ZB=ZB||'.0'
  34. ZB=ZC||ZB
  35. drop Z ZA ZC
  36. return ZB
  37. TEXT:
  38. arg Z,ZA
  39. WA=GetClip('Text.'Z);V=lastpos('%d',WA);t0=words(ZA)
  40. do while V~=0
  41. da=word(ZA,t0);if datatype(da,'N')~=1 then da=Up(da)
  42. if t0=1&left(ZA,1)=' ' then da=' '||da
  43. WB=left(WA,V-1)||da||right(WA,(length(WA)-V-1));WA=WB
  44. V=lastpos('%d',WA);t0=t0-1
  45. end;drop V ZA Z t0 DA
  46. return WA
  47. CLOAK_FIND:
  48. if (DevFnd=0 & random(1,1000,time('s'))>Num.3) then do
  49. transmit text(162,0) text(163,0) text(164,0)
  50. DevFnd=Stdt+45
  51. end
  52. return
  53. UP:
  54. arg ZB
  55. ch=' .:,&*()\';n1=0
  56. do i0=2 to length(ZB)
  57. ZC=right(left(ZB,i0),1)
  58. if lastpos(ZC,ch)~=0 then n1=1
  59. else if c2d(ZC)>64&c2d(ZC)<91 then do
  60. if n1=0 then do
  61. ZC=d2c(c2d(ZC)+32)
  62. ZB=left(ZB,i0-1)||ZC||right(ZB,(length(ZB)-i0))
  63. end
  64. n1=0
  65. end
  66. end;drop n1 ZC CH I0
  67. return ZB
  68. NB:
  69. arg ZS
  70. ZT=datatype(ZS,'N')
  71. drop ZS
  72. return ZT
  73. PLAYDELAY:
  74. z1=0;do until GetClip('Playing')~=1
  75. z1=z1+1;if z1>800 then Jv=SetClip('Playing','')
  76. end;Jv=SetClip('Playing',1)
  77. return
  78. MID:
  79. arg Schtuff,Strt,Lth
  80. Schtuff=right(Schtuff,(length(Schtuff)-Strt+1))
  81. if Lth~= 0 then Schtuff=left(Schtuff,Lth)
  82. drop Lth Strt
  83. return Schtuff
  84. COMPNAME:
  85. Temp=UName;UName='';do until Temp=''
  86. s=left(Temp,1);if s='.' then s=''
  87. else if s=' ' then s='.'
  88. UName=UName||s
  89. Temp=right(Temp,(length(Temp)-1))
  90. end
  91. return
  92. FIRSTPOS:
  93. arg Z,ZA
  94. ZC=0;ZB=1;do while (ZB <= length(ZA) & ZC=0)
  95. ZC=lastpos(Z,ZA,ZB);ZB=ZB+1
  96. end;drop Z ZA ZB
  97. return ZC
  98. SDSC:
  99. arg L0,L1
  100. Po3=Po3+L0;p1.l1=p1.l1+l0;p2.l1=p2.l1+l0
  101. z1=0;do until getclip('Sides.'Game)~=1
  102. if Z1>600 then Jv=SetClip('Sides.'Game,'')
  103. end;Jv=SetClip('Sides.'Game,1)
  104. Anz=GetClip('Score.'Game Side)
  105. l2=word(Anz,L1);l2=l2+l0
  106. Ant='';do l3=1 to 8
  107. if l3=l1 then Ant=Ant||l2' '
  108. else Ant=Ant||word(Anz,l3)' '
  109. end
  110. Jv=SetClip('Score.'Game Side,Ant)
  111. Jv=SetClip('Sides.'Game,'')
  112. drop l0 l1 l2 l3 Anz Ant
  113. return 0
  114. BUF:
  115. checkio;Anz=result;if (Anz=1 & length(SA)<201) then do
  116. receive;Anz=result;SA=SA||upper(Anz)||'/'
  117. end;drop Anz
  118. return
  119. INITTAR:
  120. TAR=0;Cond='\c5Green';drop TGT.
  121. call PlayIII;if length(String) > 1 then do
  122. do i=1 to length(string)
  123. Var=mid(String,i,1);if (Var~=Init & GetClip(Game||Var)~=1) then do
  124. inn=GetClip('Stats.'Var)
  125. TX=word(inn,6);TY=word(inn,7);TShip=word(inn,1)
  126. if ((abs(TX-XC)<=10 & abs(TY-YC)<=10)&(lastpos(Var,Enemy)~=0)) then do
  127. TAR=TAR+1
  128. TGT.TAR=TShip' @'||TX||'-'||TY||'  '||(TX-XC)||','||(TY-YC)||'; '
  129. TGT.TAR=TGT.TAR||Rat(word(inn,2),word(inn,3))'%'
  130. end
  131. end
  132. end
  133. end
  134. Max=getclip('Planets.'Ene'.0');if Max > 0 then do
  135. do i=1 to Max
  136. inn=getclip('Planets.'Ene'.'i)
  137. if words(inn)=3 then do
  138. parse var inn TX TY Bds
  139. if (abs(TX-XC) <= 10 & abs(TY-YC) <= 10) then do
  140. TAR=TAR + 1
  141. Dum='';if word(inn,3) > 0 then Dum='('word(inn,3)')'
  142. TGT.TAR=Ene||' Planet'Dum' @'||TX||'-'||TY||'  '||(TX-XC)||','||(TY-YC)
  143. end
  144. end
  145. end
  146. end
  147. Max=getclip('Bases.'Ene'.0');if Max > 0 then do
  148. do i=1 to Max
  149. inn=getclip('Bases.'Ene'.'i)
  150. if words(inn)=3 then do
  151. parse var inn TX TY Egy
  152. if (abs(TX-XC) <= 10 & abs(TY-YC) <= 10) then do
  153. TAR=TAR + 1
  154. TGT.TAR=Ene||' Base @'||TX||'-'||TY||'  '||(TX-XC)||','||(TY-YC)||'; '||Rat(Egy,11000)||'%'
  155. end
  156. end
  157. end
  158. end
  159. Max=GetClip('Planets.Neu.0');if Max > 0 then do
  160. do i=1 to Max
  161. inn=GetClip('Planets.Neu.'i)
  162. if words(inn)=2 then do;TX=word(inn,1);TY=word(inn,2)
  163. if (abs(TX-XC) <= 10 & abs(TY-YC) <= 10) then do
  164. TAR=TAR+1;TGT.TAR='Neu Planet @'||TX||'-'TY'  '||(TX-XC)','||(TY-YC)
  165. end
  166. end
  167. end
  168. end
  169. if TAR > 0 then Cond='\c7Yellow';if (att=1&TAR>0) then Cond='\c2Red'
  170. if Dock=1 then Cond=Cond||'\c1+\c3Docked'
  171. if ClkCtr=1 then Cond=Cond||'\c1+\c4Cloaked'
  172. return
  173. ATTA:
  174. if TAR > 0 then do
  175. transmit ''
  176. ok=0;tri=0;do until ok=1
  177. Jv=random(1,TAR,time('s'));tri=tri+1
  178. if ((lastpos('Planet',TGT.Jv) ~= 0 | lastpos('Base',TGT.Jv) ~= 0)|tri > 5) then Ok=1
  179. end
  180. DA1=abs(55.3/(Shields/MaxS))+random(1,3,time('s'))*0.571
  181. if Shields < 1 then Da1=Da1 * 3.35
  182. Da1=int(Da1*10+.5)/10
  183. if lastpos('Base',TGT.Jv) ~= 0 then Da1=Da1 * 2
  184. Msg=left(TGT.Jv,(lastpos('  ',TGT.Jv)));Dum=lastpos('+',TGT.Jv)
  185. if Dum ~= 0 then Msg=Msg||right(TGT.Jv,(length(TGT.Jv)-Dum+1))' '
  186. Msg=Msg||'makes 'Da1' unit phaser hit on\n1'Ship' @'XC'-'YC', '
  187. Msh=''
  188. If (ShdC='raised' & Shields <= 0)|(ShdC='lowered') then
  189. Energy=int(Energy) - Da1
  190. else Shields=Shields - (Da1*1.82)
  191. Msg=Msg||Rat(Shields,MaxS)||'%';Msi=''
  192. transmit '\n1\c2'Msg;Call SENDMES;att=1;call SHIPEE
  193. Cond='\c2Red';if Dock=1 then Cond=Cond||'\c1+\c3Docked'
  194. Z3=(Rat(Shields,MaxS)*random(1,500,time('s')))/100
  195. if Z3 < 50 then call DAMPICK;sendstring Col
  196. if Ques~='' then call SETCOM;sendstring Ques
  197. end
  198. return
  199. DELFILE:
  200. arg Z
  201. if exists(Z) then address command 'Delete "'Z'"'
  202. call Open(fng,Z,'W')
  203. return Z
  204. CHECKIT:
  205. arg Z
  206. getcarrier;if result="FALSE" then Z=1
  207. else Z=0
  208. return Z
  209. RFILE:
  210. arg Z
  211. if exists(Path||'tt'TermType'.'Z) then sendfile Path||'tt'TermType'.'Z
  212. else if exists(Path||Z) then sendfile Path||Z
  213. else if exists(Z) then sendfile Z
  214. return 0
  215. FILEO:
  216. arg Z
  217. if exists(Z) then call Open(fnh,Z,'A')
  218. else call Open(fnh,Z,'W')
  219. return 0
  220. FILEM:
  221. arg Z;ZA=right(Z,1);z1=0
  222. do until GetClip('Reading.'ZA) ~= 1
  223. z1=z1+1;if z1>500 then Jv=SetClip('Reading.'ZA,'')
  224. end
  225. if GetClip('Message.'ZA) ~= 1 then call Open(fnh,Z,'W')
  226. else call Open(fnh,Z,'A')
  227. Jv=SetClip('Reading.'ZA,1);drop ZA
  228. return 0
  229. MSGWAIT:
  230. if GetClip('Message.'Init)=1 then do;z1=0
  231. do until GetClip('Reading.'Init) ~= 1
  232. Z1=Z1+1;if Z1>500 then Jv=SetClip('Reading.'Init,'')
  233. end
  234. Jv=SetClip('Reading.'Init,1);if exists(PathM'Message.'Init) then do
  235. transmit '\c3';sendfile PathM'Message.'Init
  236. drop inn;inn=GetClip('Command.'Init)
  237. if inn~='INN' & length(compress(inn))>1 then do
  238. Com=inn;POS=firstpos('/',Com);if POS~=0 then do
  239. SA=right(Com,length(Com)-POS)
  240. Com=left(Com,POS-1)
  241. end
  242. Jv=SetClip('Command.'Init,'');call COMMANDS
  243. end
  244. sendstring Ques;Jv=SetClip('Message.'Init,'')
  245. end
  246. end;Jv=SetClip('Reading.'Init,'')
  247. inn=GetClip('Stats.'Init);Shields=word(inn,2);Energy=word(inn,4)
  248. if exists('Mail:_olm'Port) then do
  249. BBSCOMMAND '';Sendstring Ques
  250. end
  251. if random(1,1000,time('s'))<Num.2 then call ACHMSG
  252. return
  253. ACHMSG:
  254. if Ach>0 then do
  255. transmit '\c3'
  256. do until (Num>0&Num<=Ach)
  257. Num=random(0,(Ach+15),time('s'))
  258. end
  259. transmit text(1,(text(2,0)))
  260. inn=GetClip('Acherons.'Num)
  261. transmit inn;ba=getclip('Bases.'Ene'.0');pl=getclip('Planets.'Ene'.0')
  262. if ba+pl>0 then do
  263. if ba>0 then do
  264. Jv=random(1,ba,time('s'))
  265. data='base';line=getclip('Bases.'Ene'.'Jv)
  266. end
  267. else do
  268. Jv=random(1,pl,time('s'))
  269. data='planet';line=getclip('Planets.'Ene'.'Jv)
  270. end
  271. transmit text(3,(Ene data word(line,1)'-'word(line,2)))
  272. sendstring Ques
  273. end
  274. end
  275. return
  276. SETTOG:
  277. if NB(lev)=1 then lev=1-lev
  278. else lev=1
  279. return
  280. SETCOM:
  281. if lev~=1 then do
  282. Tm='';lev=0;if Shields < 1000 then Tm='S'
  283. if Energy < 1000 then Tm=Tm||'E';if Dock=1 then Tm=Tm||'D'
  284. if TAR>0 then Tm=Tm||'#'||TAR
  285. if Tm~='' then Tm=' (\c1'||Tm||left(Cond,3)')'
  286. Ques=left(Cond,3)||text(5,Tm)||Col
  287. end
  288. else Ques=left(Cond,3)||text(6,0)
  289. Ques=Ques||' '
  290. return
  291. INPUT:
  292. if CheckIt(1)=1 then signal Bye
  293. Energy=int(Energy*10+.5)/10
  294. if Energy <= 10 then do
  295. transmit text(7,Ship);Quit=1
  296. signal Bye
  297. end
  298. if SA ~= '' then do
  299. Com=SA;POS=firstpos('/',Com)
  300. if POS ~= 0 then do
  301. SA=right(Com,length(Com)-POS)
  302. Com=left(Com,POS-1)
  303. end
  304. else SA=''
  305. if left(Com,1)='<' then Com=LastCom
  306. transmit '';LastCom=Com
  307. Ques='';call MSGWAIT;signal DONE
  308. end
  309. Is=0;do until Is=1
  310. if Checkit(1)=1 then signal Bye
  311. checkio;if result then do;receive
  312. Com=upper(result);Is=1;Ques=''
  313. POS=firstpos('/',Com)
  314. if POS ~= 0 then do
  315. SA=right(Com,length(Com)-POS)
  316. Com=left(Com,POS-1)
  317. end
  318. if left(Com,1)='<' then Com=LastCom
  319. end
  320. call MSGWAIT
  321. if (TAR > 0)&(random(1,150,(time('S'))) < (TAR*Num.1)) then call ATTA
  322. end
  323. DONE:
  324. inn=GetClip('Stats.'Init);Shields=word(inn,2);Energy=word(inn,4)
  325. return
  326. INITIAL:
  327. Path='PFiles:MWars/'
  328. PathP=Path'Players/'
  329. PathG=Path'Games/'
  330. PathM='RAM:MWars/'
  331. PathS=Path'Ships/'
  332. PathT=Path'Text/'
  333. getuser41;SNbr=Result
  334. getuser 1;UName=Result;call COMPNAME
  335. getuser17;Sys=Result
  336. getuser28;TermType=Result
  337. getuser22;Calls=Result
  338. getuser27;Colms=Result
  339. getuser12;Date=result
  340. Date=compress(mid(Date,5,6))
  341. /* Variable Declarations */
  342. ve='Mega-Wars I v1.2a';BBS='C-Net Amiga'    /* "BBS" is your BBS Name */
  343. OSP=0;DEF=7;GAGL='.';LCH=6;Dock=0;att=0
  344. do i=1 to 8;p1.i=0.0;p2.i=0.0;end
  345. do i=1 to 51;form=form||' ';end;form=form||'::'
  346. LastCom='ST';Col='\c5';SA='SH RA'
  347. Cloak=0;ClkCtr=0;DevFnd=0
  348. CShips='LNRSV';EShips='DGHTW'
  349. if exists(Path'MW.Config') then do
  350. call open(fnn,Path'MW.Config','R')
  351. do i=1 to 3
  352. inn=readln(fnn)
  353. Num.i=left(inn,(firstpos(';',inn)-1))
  354. end
  355. call close fnn
  356. end
  357. else do
  358. Num.1=2.39;Num.2=35;Num.3=800
  359. end
  360. if ~exists(PathP||SNbr) then do
  361. sendfile Path'Information'
  362. transmit text(14,0)
  363. call Open(fnn,PathP||SNbr,'W')
  364. txt='0.0 Cadet 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0'
  365. Jv=writeln(fnn,txt)
  366. call close fnn
  367. end
  368. call Open(fnn,PathP||SNbr,'R')
  369. inn=readln(fnn)
  370. Po3=0.0;Rank=word(inn,2)
  371. do i=1 to 8;p1.i=word(inn,(2+i))
  372. a=lastpos('.',p1.i);if a~=0 then do
  373. if a=length(p1.i) then p1.i=p1.i||'0'
  374. else if a~=(length(p1.i)-1) then do
  375. do until a=(length(p1.i)-1)
  376. p1.i=left(p1.i,(length(p1.i)-1))
  377. a=lastpos('.',p1.i)
  378. end
  379. end
  380. end
  381. else p1.i=p1.i||'.0'
  382. Po3=Po3+p1.i
  383. end
  384. if words(inn)~=12 then Ch_Perm=''
  385. else do
  386. if word(inn,12)=upper(Date) then Ch_Perm=word(inn,11)
  387. end
  388. Rank=compress(Rank)
  389. call close fnn
  390. z1=0;do until GetClip('AchDelay')~=1
  391. z1=z1+1;if z1>50000 then Jv=SetClip('AchDelay','')
  392. end;Jv=SetClip('AchDelay',1)
  393. Ach=GetClip('Acherons.0');if Ach<1 then Ach=0
  394. if Ach=0 then do
  395. if exists(PathT'sys.Acherons') then do
  396. call open(fnn,PathT'sys.Acherons','R')
  397. do until eof(fnn)
  398. inn=readln(fnn);if words(inn)>1 then do
  399. Ach=Ach+1;Jv=SetClip('Acherons.'Ach,inn)
  400. end
  401. end
  402. call close fnn
  403. Jv=SetClip('Acherons.0',Ach)
  404. end
  405. end;Jv=SetClip('AchDelay','')
  406. z1=0;do until GetClip('TextDelay')~=1
  407. Z1=Z1+1;if z1>70000000 then jv=setclip('TextDelay','')
  408. end;Jv=setclip('TextDelay',1)
  409. MxTxt=GetClip('Text.0');if MxTxt<1 then MxTxt=0
  410. if MxTxt=0 then do
  411. call open(fnn,PathT'MW.Gametext','R')
  412. do until eof(fnn)
  413. inn=readln(fnn);if length(inn)>1 then do
  414. MxTxt=MxTxt+1;Jv=SetClip('Text.'MxTxt,inn)
  415. end
  416. end
  417. call close fnn
  418. Jv=SetClip('Text.0',MxTxt)
  419. end
  420. Jv=SetClip('TextDelay','')
  421. do i=1 to 6;Da.i=0;device.i=text((7+i),0);end;TDa=0.0
  422. if Po3 < 20000.0 then Rk=text(16,0)
  423. else if Po3 < 110000.0 then Rk=text(17,0)
  424. else if Po3 < 600000.0 then Rk=text(18,0)
  425. else Rk=text(19,0)
  426. if Rk~=Rank then do
  427. Rank=Rk
  428. transmit text(20,Rk)
  429. address command 'Delete "'PathP||SNbr'"'
  430. call Open(fnn,PathP||SNbr,'W')
  431. JV=writech(fnn,Po3 Rank' ')
  432. do i=1 to 8;Jv=writech(fnn,p1.i' ');end;Jv=writeln(fnn,'')
  433. call close fnn
  434. end
  435. return
  436. INT:
  437. arg c
  438. if c=0.0 then c=0
  439. if c<.0001 then return c
  440. if datatype(c,w)~=1 then c=trunc(c)
  441. return c
  442. RDM:
  443. do until ((X>0)&(X<76))
  444. X=random(0,100,(time('S')));X=X-6
  445. end
  446. do until ((Y>0)&(Y<76))
  447. Y=random(0,100,(time('S')));Y=Y-6
  448. end
  449. return
  450. LGAME:
  451. call SHIPINIT
  452. Game=1
  453. if exists(PathG||Game) then do
  454. transmit text(21,0)
  455. call PlayIII;if string=Init then call BEGB
  456. Leave=0;call SPACE
  457. do until Leave=1
  458. call RDM;jv=seek(Space,((y-1)*75+x-1),'B')
  459. inn=readch(Space);if inn='.' then Leave=1
  460. end
  461. jv=seek(Space,((y-1)*75+x-1),'B');XC=X;YC=Y
  462. if writech(Space,Init) < 1 then signal Bye
  463. OSP=0;call close Space;call SHIPEE;call INITTAR
  464. end
  465. else do
  466. transmit text(22,0) text(23,0)
  467. if Sys=1 then transmit text(24,0)
  468. signal Bye
  469. end
  470. return
  471. BYE:
  472. call close fng
  473. call close fnn
  474. call close Space;OSP=0
  475. drop form
  476. if XC ~= 'XC' then if (XC+YC) > 1 then do
  477. call POINTCH;call Open(fnn,PathM||Game,'R')
  478. jv=seek(fnn,((YC-1)*75+XC-1),'B')
  479. Jv=writech(fnn,'.')
  480. call close fnn
  481. end
  482. call PlayII
  483. exit
  484. LAST:
  485. LastCom=Com
  486. return
  487. COMMANDS:
  488. Com1=Word(Com,1);NCom=Words(Com)
  489. if length(Com1) > 2 then Com1=left(Com1,2)
  490. select
  491. when Com1='SC' then call SCAN
  492. when (left(Com1,1)='Q') then Quit=1
  493. when (Com1='?') then call Menu
  494. when (Com1='H' | Com1='HE') then sendfile Path'MW.Help'
  495. when Com1='MO' then call MOVE
  496. when Com1='ST' then call STATUS
  497. when Com1='RA' then call RAD
  498. when Com1='US' then call Playing
  499. when Com1='TE' then call TELL
  500. when Com1='SH' then call ShieldC
  501. when Com1='PO' then call POINTCH
  502. when Com1='EN' then call ENTRAN
  503. when Com1='LI' then call LISTING
  504. when Com1='CA' then call CAPTURE
  505. when Com1='HI' then call HISCORES
  506. when Com1='BU' then call BUILD
  507. when Com1='TA' then call TARGTS
  508. when Com1='DO' then call DOCKSH
  509. when Com1='RE' then call REPAIRSH
  510. when Com1='DA' then call DAMRPT
  511. when Com1='PH' then call PHASERS
  512. when Com1='OL' then do
  513. transmit text(25,0) text(26,0)
  514. BBSCOMMAND Com;call LAST
  515. end
  516. when Com1='IN' then sendfile Path'Information'
  517. when Com1='ME' then call MEMMAN
  518. when Com1='TO' then call TORPFI
  519. when Com1='SE' then call SETTOG
  520. otherwise BBSCOMMAND Com1
  521. end
  522. return
  523. MENU:
  524. file=Path||'Sys.Menu'
  525. if exists(File) then sendfile File
  526. else do
  527. file=Path||'tt'||TermType||'.Menu'
  528. if exists(File) then sendfile File
  529. end
  530. return
  531. SCAN:
  532. if (Da.4 >= 75) then Jv=Dam(4)
  533. else do
  534. call SPACE;Energy=Energy-MveE
  535. transmit ''
  536. if NCom < 2 then do
  537. if Def < 2 | Def > 15 then Def=7
  538. end
  539. else do
  540. Ans=Word(Com,2)
  541. if NB(Ans) ~=1 then Def=7
  542. else do
  543. if Ans < 2 | Ans > 15 then Ans=7
  544. Def=Ans
  545. end
  546. end
  547. sendstring '   '||left(Cond,3)
  548. XStart=XC-Def;XEnd=XC+Def
  549. YStart=YC-Def;YEnd=YC+Def
  550. if XStart < 1 then XStart=1
  551. if YStart < 1 then YStart=1
  552. if XEnd > 75 then XEnd=75
  553. if YEnd > 75 then YEnd=75
  554. do i=XStart to XEnd by 2
  555. sendstring right(i,2)'  '
  556. end;transmit ''
  557. do Y=YEnd to YStart by -1
  558. jv=seek(Space,((Y-1)*75+XStart-1),'B')
  559. inn=readch(Space,((abs(XEnd-XStart))+1))
  560. sendstring left(Cond,3)||right(Y,2)||' \z1\c6'
  561. do l=1 to length(inn)
  562. Jk=mid(inn,l,1);if datatype(Jk,'N')=1 then Jk=word(Junk,Jk)
  563. sendstring right(Jk,2)
  564. end
  565. transmit '\z0 '||left(Cond,3)||right(Y,2)
  566. checkio;Z=result;if Z=1 then leave
  567. end
  568. sendstring '   '||left(Cond,3);do i=XStart to XEnd by 2
  569. sendstring right(i,2)'  '
  570. end;transmit ''
  571. end
  572. OSP=0;call close SPACE
  573. return
  574. SPACE:
  575. if OSP ~= 1 then do
  576. OSP=1
  577. call Open(Space,PathM||Game,'R')
  578. end
  579. return
  580. DUH:
  581. transmit text(27,0)
  582. return
  583. UP_POS:
  584. jv=seek(Space,((YC-1)*75+XC-1),'B')
  585. VBN=Init;if ClkCtr=1 then VBN=6
  586. JV=writech(Space,VBN)
  587. return
  588. MOVE:
  589. call SPACE;call LAST;MX=MaxX;MY=MaxY
  590. if NCom < 3 then signal ASK
  591. if word(Com,2)='R' then do
  592. if (words(Com) ~= 4)|(NB(word(Com,3))~=1)|(NB(word(Com,4))~=1) then signal ASK
  593. TX=Word(Com,3);TY=Word(Com,4)
  594. if abs(TX) > MaxX then signal DUH
  595. if abs(TY) > MaxY then signal DUH
  596. signal OK
  597. end
  598. else do
  599. if words(Com) ~= 3 then signal ASK
  600. A1=Word(Com,2);A2=Word(Com,3)
  601. if NB(A1)~=1 | NB(A2)~=1 then signal ASK
  602. if ((abs(A1-XC) <= MaxX) & (abs(A2-YC) <= MaxY)) then do
  603. TX=A1-XC;TY=A2-YC;signal OK
  604. end
  605. ASK:
  606. query||text(28,0)||' ';Ans=result
  607. if NB(Ans) ~= 1 then Ans=0
  608. if (Ans<1 | abs(XC-Ans) > MaxX) then signal DUH
  609. else TX=Ans - XC
  610. query||text(29,0)||' ';Ans=result
  611. if NB(Ans) ~= 1 then Ans=0
  612. if (Ans<1 | abs(YC-Ans) > MaxX) then signal DUH
  613. else TY=Ans - YC
  614. OK:
  615. TY=int(TY);TX=int(TX)
  616. if ((YC+TY > 75) | (YC+TY < 1) | (XC+TX < 1) | (XC+TX > 75)) then do
  617. transmit text(30,0)
  618. signal DONE
  619. end
  620. if Da.1 ~= 0 then do
  621. MX=MaxX-int(Da.1/100)
  622. if MX<1 then MX=0
  623. if TX>MX|TY>MX then do
  624. transmit text(31,0)||text(32,MX)
  625. if MX=0 then transmit text(33,0) text(34,0)
  626. signal DONE
  627. end
  628. end
  629. Leave=0;do until Leave=1
  630. jv=seek(Space,((YC+TY-1)*75+XC+TX-1),'B')
  631. IsOk=1;inn=readch(Space);if inn='.' then Leave=1
  632. else do
  633. TY=TY-1;TX=TX-1
  634. if (YC+TY > 75 | YC+TY < 1 | XC+TX <1 | XC+TX > 75) then do
  635. transmit text(35,0)
  636. Leave=1;IsOk=0
  637. end
  638. else transmit text(36,0)
  639. end
  640. end;if IsOk=0 then signal DONE
  641. jv=seek(Space,((YC-1)*75+XC-1),'B')
  642. JV=writech(Space,'.')
  643. XC=XC + TX;YC=YC + TY
  644. call UP_POS
  645. transmit text(37,(Ship XC'-'YC));Dock=0;att=0
  646. Jv=0;if Shields < 0 then Jv=1
  647. Energy=Energy - ((abs(TX)*MveE + abs(TY)*MveE)*random(1,4,time('S')))
  648. if ((abs(TX)+abs(TY))*random(1,3,time('s'))) > 35 then do
  649. transmit text(38,Col)||text(39,0)
  650. Da1=int(((random(1,200,time('s'))*.9811)+(Da.1/2))*10+.5)/10
  651. transmit text(40,Da1) text(41,(Rat(Da1,30)/100))
  652. Da.1=Da.1+Da1+30
  653. end
  654. call ADVST;call SHIPEE;call INITTAR
  655. DONE:
  656. OSP=0;call close SPACE
  657. return
  658. SHIPINIT:
  659. call Open(fnn,PathS||Ship,'R')
  660. inn=readln(fnn);parse var inn Energy MaxS Torps MaxT MaxX MaxY MveE
  661. Damage=0;Stdt=0;Cond='\c5Green';Radio='On';Shields=MaxS;MaxE=Energy
  662. ShdC='raised';line=Ship||' On '||Side;MxTo=Torps
  663. Jv=SetClip('Radio.'Init,line)
  664. call close fnn
  665. return
  666. STATUS:
  667. transmit left(text(42,0),22)'\q1'Stdt
  668. transmit left(text(43,0),19)'\q1'Ship||' ('||Rank||')'
  669. transmit left(text(44,0),19)'\q1'Cond
  670. transmit left(text(45,0),19)'\q1'XC||'-'||YC
  671. transmit left(text(46,0),19)'\q1'Torps||text(47,MaxT)
  672. JV=Energy;if lastpos('.',JV)=0 then JV=JV||'.0'
  673. transmit left(text(48,0),19)'\q1'JV
  674. transmit left(text(49,0),19)'\q1'TDa
  675. transmit left(text(50,0),19)'\q1'Rat(Shields,MaxS)||text(51,Shields)
  676. transmit left(text(52,0),19)'\q1'Radio
  677. return
  678. ERROR:
  679. x=sigl
  680. logentry"\z1\c6"||overlay(":: Undefined Error: "||x||" of "ve,form)"\q1"
  681. logentry"\o1\c3\z2"||overlay(":: Cause: "||errortext(RC),form)"\q1"
  682. transmit text(53,x) text(54,0)
  683. signal Bye
  684. HALT:
  685. transmit text(55,0)
  686. signal Bye
  687. IOERR:
  688. x=sigl
  689. logentry'\z1\c6'||overlay(':: I/O Error: '||x||' of 've,form)'\q1'
  690. logentry'\o1\c3\z2'||overlay(':: Cause: '||errortext(RC),form)'\q1'
  691. transmit text(56,x) text(54,0)
  692. signal Bye
  693. SYNTAX:
  694. x=sigl
  695. logentry'\z1\c6'||overlay(':: Syntax Error: '||x||' of '||ve,form)'\q1'
  696. logentry'\o1\z2\c3'||overlay(':: Cause: '||errortext(RC),form)'\q1'
  697. transmit text(57,x) text(54,0)
  698. signal Bye
  699. ADVST:
  700. Stdt=Stdt+1
  701. TDa=0;do i=1 to 6
  702. if da.i ~= 0 then do
  703. Da.i=Da.i-30
  704. if re_now=i then Da.i=Da.i-15
  705. if Da.i < 1 then do
  706. Da.i=0
  707. transmit text(127,0) device.i text(128,0)
  708. if re_now=i then re_now=0
  709. end
  710. TDa=TDa+Da.i
  711. end
  712. end
  713. if Stdt>=DevFnd & DevFnd>0 then do
  714. transmit text(165,0) text(166,0) text(167,0) text(168,0) text(169,0)
  715. Cloak=1;DevFnd=-1
  716. end
  717. return
  718. RAD:
  719. if NCom > 1 then  Ans=word(Com,2)
  720. else do
  721. query||text(58,0)' ';Ans=result;Ans=upper(Ans)
  722. end
  723. select
  724. when left(Ans,2)='ON' then do
  725. Radio=text(59,0);GAGL='.';call UPDATE
  726. end
  727. when left(Ans,2)='OF' then do
  728. Radio=text(60,0);GAGL=CShips||EShips
  729. call UPDATE
  730. end
  731. when left(Ans,2)='GA' then do
  732. if NCom > 2 then Ans=word(Com,3)
  733. else do
  734. query||text(62,0)' ';Ans=result;Ans=upper(Result)
  735. end
  736. An=left(Ans,1);if c2d(An) ~= 32 then do
  737. if An='C' then Ans=CShips
  738. if An='E' then Ans=EShips
  739. Leave=0;do until Leave=1
  740. An=left(Ans,1);Ans=right(Ans,length(Ans)-1)
  741. if lastpos(An,'LNRSVDGHTW') ~= 0 then do
  742. if GAG ~= 1 then do
  743. Radio=text(61,0);GAG=1
  744. end
  745. Jv=lastpos(An,Radio)
  746. if Jv < 4 then Radio=Radio||An
  747. else Radio=left(Radio,Jv-1)||right(Radio,(length(Radio)-Jv))
  748. end
  749. if length(Ans) < 1 then Leave=1
  750. end
  751. if Radio=text(61,0) then do
  752. Radio=text(59,0);GAG=0;GAGL='.'
  753. end
  754. else do
  755. GAGL=right(Radio,(length(Radio)-4))
  756. end
  757. call Update
  758. end
  759. end
  760. otherwise transmit text(63,0)
  761. end
  762. if left(Radio,3) ~= left(text(61,0),3) then GAG=0
  763. return
  764. UPDATE:
  765. line=Ship GAGL Side
  766. Jv=SetClip('Radio.'Init,line)
  767. return
  768. PICKDELAY:
  769. transmit text(72,0)
  770. z1=0;do until GetClip('Picking')~=1
  771. z1=z1+1;if z1>10000 then Jv=SetClip('Picking','')
  772. end;Jv=SetClip('Picking',1);Pick_Del=1
  773. return
  774. BEGA:
  775. Jv=rfile('Welcome');call BEGC;call HISCORES;call Playing
  776. call PICKDELAY
  777. if (Ch_Perm=''|Sys=1) then do
  778. query||text(130,0)||text(131);Ans=result
  779. Ans=left(upper(Ans),1)
  780. end
  781. else Ans=left(upper(Ch_Perm),1)
  782. if (Ans ~='E' & Ans ~='C') then signal Bye
  783. if Ans='E' then do
  784. choices='DGHTW';Side='Emp';Junk='-- // ++ $$ @ .';Enemy='LNRSV'
  785. Ene='Coa';data='Kyron Empire'
  786. end
  787. else do
  788. choices='LNRSV';Side='Coa';Junk='++ $$ -- // @ .';Enemy='DGHTW'
  789. Ene='Emp';data='Coalition'
  790. end
  791. transmit text(112,0) data'.'
  792. File=PathS||'Ships.'||left(Side,1)||Rank
  793. transmit '';call PlayIII;call open(fnn,File,'R')
  794. do until eof(fnn)
  795. inn=readln(fnn);ing=left(upper(inn),1)
  796. if lastpos(ing,string)=0 & words(inn)=2 then transmit word(inn,1)
  797. end
  798. call close fnn
  799. query||text(65,0)' '
  800. Ans=Result;Ans=upper(left(Ans,1))
  801. if lastpos(Ans,choices)=0 then signal Bye
  802. if lastpos(Ans,string) ~= 0 then signal Bye
  803. Leave=0;call Open(fnn,File,'R')
  804. do until Leave=1
  805. inn=readln(fnn);parse var inn Ship M1
  806. if left(Ship,1)=Ans then Leave=1
  807. if eof(fnn) then Leave=1
  808. end
  809. call close fnn
  810. M1=M1+1
  811. transmit text(66,(Col M1 Ship))
  812. Init=left(Ship,1)
  813. call Open(fnn,PathS||'temp.'SNbr,'W')
  814. call Open(fng,File,'R')
  815. do i=1 to 5
  816. inn=readln(fng);parse var inn TShip TM1
  817. if left(TShip,1)=Init then TM1=M1
  818. JV=writeln(fnn,compress(TShip) compress(TM1))
  819. end
  820. call close fng
  821. call close fnn
  822. address command 'Delete "'File'"'
  823. stuff=PathS'temp.'SNbr'" "'File'"'
  824. address command 'ReName "'stuff
  825. call PLAYDELAY
  826. Jv=FILEO(Path'Playing');Jv=writeln(fnh,Ship Rank Po3 Side UName GAGL)
  827. call close fnh;do i=1 to 10;end;Jv=SetClip('Playing','')
  828. Jv=SetClip('Picking','');drop Pick_Del
  829. return
  830. HISCORES:
  831. if ~exists(Path'HiScores') then transmit '\n1\c2Sorry, no High Scores yet.'
  832. else do
  833. transmit text(67,0) text(68,0)
  834. call Open(fnn,Path'HiScores','R');did=0
  835. do until eof(fnn)
  836. inn=readln(fnn);if words(inn)=4 then do
  837. parse var inn HiName Ronk Score HiNbr;did=did+1
  838. transmit right(did,2)'. 'left(HiName,15) left(Ronk,10) Score
  839. end
  840. end
  841. call close fnn
  842. end
  843. sendstring '\q1'
  844. return
  845. PLAYING:
  846. call PLAYDELAY
  847. if ~exists(Path'Playing') then transmit text(69,0)
  848. else do
  849. transmit text(70,0)||text(71,0)
  850. call open(fnn,Path'Playing','R')
  851. do until eof(fnn)
  852. inn=readln(fnn)
  853. if words(inn)=6 then do
  854. parse var inn PShip PRank PPo3 PSide PUName PGAG
  855. transmit left(PShip,9) left(PUName,12) left(PRank,11) PSide'  'PPo3
  856. end
  857. end
  858. call close fnn
  859. end
  860. Jv=SetClip('Playing','')
  861. return
  862. PLAYII:
  863. transmit '\n1Leaving 've' to 'BBS'.';drop device. da. tgt. num.
  864. Jv=SetClip((Game||Init),'')
  865. if Pick_Del=1 then do
  866. drop Pick_Del;Jv=SetClip('Picking','')
  867. end
  868. address command 'Delete "'PathP||SNbr'"';Jv=SetClip('ReDock.'Init,'')
  869. if exists(PathM'Message.'Init) then
  870. address command 'Delete "'PathM'Message.'Init'"'
  871. Jv=SetClip('Reading.'Init,'');Jv=SetClip('Command.'Init,'')
  872. Jv=setclip('Radio.'Init,'')
  873. if Calls > 2 then do
  874. call UPHI;call open(fnn,PathP||SNbr,'W')
  875. if Po3>0 then Po3=int(Po3*10+.5)/10;Jv=writech(fnn,Po3 Rank' ')
  876. do i=1 to 8;Jv=writech(fnn,p1.i' ');end
  877. Jv=writeln(fnn,Side Date)
  878. Jv=writeln(fnn,'')
  879. call close fnn
  880. end
  881. Jv=SetClip('Stats.'Init,'');File=Path'Playing';Did=0
  882. call PLAYDELAY
  883. if exists(File) then do
  884. call open(fnn,Path'temp.'SNbr,'W')
  885. call Open(fng,File,'R')
  886. do until eof(fng)
  887. inn=readln(fng)
  888. if (word(inn,5) ~= UName) & (words(inn)=LCH) then do
  889. Jv=writeln(fnn,inn);did=1
  890. end
  891. end
  892. call close fng
  893. call close fnn
  894. address command 'Delete "'File'"';drop p1. p2.
  895. if did=0 then do;z1=0
  896. do until GetClip('Every.'Game)~=1
  897. z1=z1+1;if z1>4500 then Jv=SetClip('Every.'Game,'')
  898. end;Jv=SetClip('Every.'Game,1)
  899. transmit text(72,0);address command 'Delete "'Path'temp.#?" quiet'
  900. data.1='Coalition.';data.2='Empire.'
  901. do i=1 to 2;file=PathG||data.i||Game
  902. call open(fnn,file,'W')
  903. Jv=writeln(fnn,GetClip('Score.'Game left(data.i,3)))
  904. call close fnn
  905. Jv=SetClip('Score.'Game left(data.i,3),'')
  906. end
  907. NUM=GETCLIP('Acherons.0');JV=SETCLIP('Acherons.0','')
  908. if Num>0 then do
  909. DO I=1 TO NUM
  910. JV=SETCLIP('Acherons.'i,'')
  911. END
  912. end
  913. NUM=getclip('Text.0');Jv=SetClip('Text.0','')
  914. do i=1 to num
  915. Jv=SetClip('Text.'i,'')
  916. end
  917. data.1='Bases.Coa';data.2='Bases.Emp'
  918. data.3='Planets.Coa';data.4='Planets.Emp';data.5='Planets.Neu'
  919. if exists(PathM||Game) then do
  920. address command 'Delete "'PathG||Game'"'
  921. address command 'Copy "'PathM||Game'" "'PathG||Game'"'
  922. end
  923. do i=1 to 5
  924. if getclip(data.i'.0') > 0 then do
  925. if exists(Path||data.i) then
  926. address command 'Delete "'Path||data.i'"'
  927. call Open(fnn,Path||data.i,'W')
  928. line=GetClip(data.i'.0')
  929. Jv=writeln(fnn,line)
  930. do l=1 to getclip(data.i'.0')
  931. line=GetClip(data.i'.'l)
  932. Jv=writeln(fnn,line)
  933. Jv=setclip(data.i"."l,"")
  934. end
  935. call close fnn;Jv=setclip(data.i".0","")
  936. end
  937. else if exists(Path||data.i) then
  938. address command 'Delete "'Path||data.i'"'
  939. end
  940. address command 'Delete "'left(PathM,(length(PathM)-1))'" all quiet'
  941. end
  942. else do
  943. address command 'ReName "'Path'temp.'SNbr'" "'File'"'
  944. sendstring '\w1'
  945. end
  946. end
  947. Jv=SetClip('Every.'Game,'');Jv=SetClip('Playing','')
  948. return
  949. TELL:
  950. if NCom ~= 2 then do
  951. query||text(73,0)' ';Ans=result;Ans=upper(Ans)
  952. end
  953. else Ans=word(Com,2)
  954. An=left(Ans,1);ToWho=An
  955. select
  956. when An='C' then ToWho=CShips
  957. when An='E' then ToWho=EShips
  958. when An='A' then ToWho=CShips||EShips
  959. otherwise Jv=1
  960. end
  961. ToWho=compress(ToWho)
  962. if ToWho ~= '' then do;Max=10
  963. transmit text(74,0)||text(75,Max)||text(76,0)
  964. lines=0;End=0;do until End=1
  965. receive;Ans=result
  966. if left(Ans,1) ~= '/' then do
  967. lines=lines+1;txt.lines=''||Ans
  968. if lines >= Max then End=1
  969. end
  970. else End=1
  971. end;transmit ''
  972. Did=0;call PlayIII;Leave=0;do until Leave=1
  973. Ans=left(ToWho,1);if (lastpos(Ans,string) ~= 0 & lines > 0) then do
  974. inn=getclip('Radio.'Ans)
  975. PInit=Ans;PGAG=word(inn,2);PShip=word(inn,1)
  976. if ((lastpos(Init,PGAG)=0 | PGag='On') & (Init ~= PInit)) then do
  977. file=PathM'Message.'PInit
  978. Jv=FILEM(File)
  979. JV=writeln(fnh,text(1,(Ship||' ('||UName||')')))
  980. do i=1 to lines;Jv=writeln(fnh,txt.i);end;Jv=writeln(fnh,'')
  981. call close fnh;do i=1 to 10;end;Jv=SetClip('Reading.'PInit,'')
  982. JV=SetClip('Message.'PInit,1)
  983. transmit text(77,PShip);Did=1
  984. end
  985. else
  986. if PInit ~= Init then
  987. transmit text(78,PShip)
  988. end
  989. ToWho=right(ToWho,(length(ToWho)-1));if length(ToWho) < 1 then Leave=1
  990. end
  991. drop txt.
  992. if Did=0 then transmit text(79,0)
  993. end
  994. return
  995. PLAYIII:
  996. call PLAYDELAY
  997. string='';if exists(Path'Playing') then do
  998. call Open(fnn,Path'Playing','R')
  999. do until eof(fnn)
  1000. inn=readln(fnn)
  1001. if words(inn)=LCH then string=string||left(inn,1)
  1002. end
  1003. call close fnn
  1004. end
  1005. Jv=SetClip('Playing','')
  1006. return
  1007. DAM:
  1008. arg c
  1009. data='is';if right(device.c,1)='s' then data='are'
  1010. transmit text(80,0) device.c text(81,data)
  1011. drop data c
  1012. return 0
  1013. SHIELDC:
  1014. if Da.6 < 75 then do
  1015. if NCom ~= 2 then do
  1016. query||text(82,0)' ';Ans=upper(Result)
  1017. end
  1018. else Ans=word(Com,2)
  1019. Ans=left(Ans,2);if lastpos(Ans,'RA\LO\CL') ~= 0 then do
  1020. select
  1021. when (Ans='RA' & ShdC~='raised') then do
  1022. if Da.6 > 75 then Jv=Dam(6)
  1023. else do
  1024. Shields=abs(Shields);ShdC='raised'
  1025. end
  1026. end
  1027. when (Ans='LO' & ShdC~='lowered') then do
  1028. Shields=0-(abs(Shields));ShdC='lowered'
  1029. end
  1030. when (Ans='CL' & Cloak=1 & ClkCtr~=1) then do
  1031. Shields=abs(Shields);ClkCtr=1
  1032. Cond=Cond||'\c1+\c4Cloaked'
  1033. transmit text(129,0)
  1034. ShdC='cloaked'
  1035. Jv=SetClip((Game||Init),1)
  1036. end
  1037. otherwise Jv=1
  1038. end
  1039. transmit text(83,ShdC);call SHIPEE
  1040. if lastpos('cloaked',ShdC)=0 then do
  1041. Jv=SetClip((Game||Init),'')
  1042. ClkCtr=0
  1043. end
  1044. end
  1045. else transmit text(84,0)
  1046. call Space
  1047. call UP_POS
  1048. OSP=0;call close Space
  1049. end
  1050. else Jv=Dam(6)
  1051. return
  1052. POINTCH:
  1053. sendstring left(text(93,0),33)
  1054. t1=0;t2=0;t3=0;if Colms > 45 then do
  1055. sendstring right('Coalition',10) right('Empire',10) right(Ship,10)' '
  1056. end
  1057. transmit right('YourTotal',10)'\r0'
  1058. CSc=GetClip('Score.'Game' Coa');ESc=GetClip('Score.'Game' Emp')
  1059. do i=1 to 8
  1060. sendstring left(text((84+i),0),27)
  1061. if Colms>45 then do
  1062. sendstring right(word(CSc,i),10) right(word(ESc,i),10) right(p2.i,10)' '
  1063. t2=t2+word(CSc,i);t3=t3+word(ESc,i)
  1064. end
  1065. transmit right(p1.i,10);t1=t1+p2.i
  1066. end
  1067. sendstring left(text(94,0),30)
  1068. if Colms>45 then sendstring right(t2,10) right(t3,10) right(t1,10)' '
  1069. transmit right(Po3,10)
  1070. Var=0.0;if Stdt>0 then Var=int(T1/Stdt*10+.5)/10
  1071. transmit left(text(95,0),26) right(Var,10)
  1072. drop data. t1 CSc ESc Var Colms t2 t3
  1073. return
  1074. ENTRAN:
  1075. call LAST;if Shields <= 0 then transmit text(96,0)
  1076. else do
  1077. if NCom ~= 2 then do
  1078. query||text(97,0)' ';Ans=upper(Result)
  1079. end
  1080. else Ans=upper(word(Com,2))
  1081. if NB(Ans)=1 then do
  1082. if Ans > 0 then do
  1083. if ((Energy-Ans > 300) & (Shields+Ans <= MaxS)) then do
  1084. Energy=Energy - Ans;Shields=Shields + Ans;call SHIPEE
  1085. transmit text(98,0)
  1086. end
  1087. else transmit text(99,0)
  1088. end
  1089. else do
  1090. if (((Energy-Ans) <= MaxE) & ((Shields+Ans) > 300)) then do
  1091. Energy=Energy - Ans;Shields=Shields + Ans;call ShipEE
  1092. transmit text(98,0)
  1093. end
  1094. else transmit text(99,0)
  1095. end
  1096. end
  1097. else transmit text(100,0)
  1098. end
  1099. return
  1100. BEGB:
  1101. data.1=Path'Planets.Coa';data.2=Path'Planets.Emp'
  1102. data.3=Path'Bases.Coa';data.4=Path'Bases.Emp';data.5=Path'Planets.Neu'
  1103. data.6=PathG||Game;data.7='Coalition.';data.8='Empire.'
  1104. z1=0;do until GetClip('Every.'Game)~=1
  1105. z1=z1+1;if z1>5500 then Jv=SetClip('Every.'Game,'')
  1106. end;Jv=SetClip('Every.'Game,1)
  1107. do i=7 to 8
  1108. file=PathG||data.i||Game
  1109. if exists(file) then do
  1110. call open(fnn,file,'R')
  1111. inn=readln(fnn)
  1112. call close fnn
  1113. Jv=SetClip('Score.'Game' '||left(data.i,3),inn)
  1114. end
  1115. else Jv=SetClip('Score.'Game' '||left(data.i,3),right(text(15,0),31))
  1116. end
  1117. do i=1 to 5
  1118. file=right(data.i,(length(data.i)-lastpos('/',data.i)))
  1119. Jv=SetClip(file'.0',0);if exists(data.i) then do
  1120. call Open(fnn,data.i,'R')
  1121. inn=readln(fnn)
  1122. Jv=setclip(file'.0',inn)
  1123. do l=1 to inn
  1124. ing=readln(fnn)
  1125. Jv=setclip(file||'.'L,ing)
  1126. end
  1127. call close fnn
  1128. end
  1129. end
  1130. address command 'Copy "'data.6'" "'PathM||Game'"'
  1131. Jv=SetClip('Every.'Game,'')
  1132. drop data.
  1133. return
  1134. LISTING:
  1135. if (Da.5 >= 75) then Jv=Dam(5)
  1136. else do
  1137. if NCom=1 then do
  1138. query||text(101,0)' ';Ans=upper(result)
  1139. if words(Ans)=0 then signal LDONE
  1140. Com='LI '||Ans;NCom=words(Com)
  1141. end
  1142. Ant='';Ans='';if NCom=2 then Ans=word(Com,2)
  1143. else if NCom=3 then do
  1144. if left(word(Com,2),2)='CL' then do
  1145. CL=1;Ans=word(Com,3)
  1146. end
  1147. else do
  1148. CL=0;Ans=word(Com,2);Ant=word(Com,3)
  1149. end
  1150. end
  1151. else if NCom=4 then do
  1152. if left(word(NCom,2),2)='CL' then do
  1153. CL=1;Ans=word(Com,3);Ant=word(Com,4)
  1154. end
  1155. else do
  1156. CL=0;Ans=word(Com,2);Ant=word(Com,3)
  1157. end
  1158. end
  1159. else transmit text(102,0)
  1160. if Ans='ENE' then do
  1161. if Side='Coa' then Ans='EMP'
  1162. else Ans='COA'
  1163. end
  1164. if Ans='BA' | Ans='PL' | Ans='SH' then do
  1165. Ant=Ans;Ans='ALL'
  1166. end
  1167. if Ans~='COA' & Ans~='EMP' & Ans~='ALL' & Ans~='NEU' then do
  1168. transmit text(102,0)
  1169. signal LDONE
  1170. end
  1171. data.1='Coa';data.2='Emp';did=-1
  1172. do i=1 to 2
  1173. if ((Ans='ALL') & (Ant='SH' | Ant='') & i=1) then do
  1174. call PlayIII;do until string=''
  1175. Dum=left(string,1)
  1176. inn=getclip('Stats.'Dum)
  1177. if (words(inn)=7 & GetClip(Game||Dum)~=1) then do
  1178. Jv=GetClip('Radio.'Dum);TSide=word(Jv,3)
  1179. if (TSide=Side | (abs(XC-word(inn,6)) <= 15 & abs(YC-word(inn,7)) <=15)) then do
  1180. did=did+1;if did=0 then transmit ''
  1181. sendstring left(word(inn,1),10)' @'right(word(inn,6),2)'-'left(word(inn,7),2)'  '
  1182. sendstring right((word(inn,6)-XC),3)||','||right((word(inn,7)-YC),3)||';'
  1183. transmit ' '||Rat(word(inn,2),word(inn,3))||'%'
  1184. end
  1185. end
  1186. string=right(string,(length(string)-1))
  1187. end
  1188. end
  1189. if ((Ans='NEU' | Ans='ALL') & (Ant='PL' | Ant='') & i=1) then do
  1190. did=-1;do l=1 to getclip('Planets.Neu.0')
  1191. inn=GetClip('Planets.Neu.'l)
  1192. if words(inn)=2 then do
  1193. if (abs(XC-word(inn,1)) <= 15 & abs(YC-word(inn,2)) <= 15) then do
  1194. did=did+1;if did=0 then transmit ''
  1195. sendstring 'Neu Planet @'right(word(inn,1),2)'-'left(word(inn,2),2)'  '
  1196. transmit right((word(inn,1)-XC),3)||','||right((word(inn,2)-YC),3)
  1197. end
  1198. end
  1199. end
  1200. if did=-1 then transmit text(103,0)
  1201. end
  1202. if ((Ans=upper(data.i) | Ans='ALL') & (Ant='BA' | Ant='') & getclip('Bases.'data.i'.0') > 0) then do
  1203. did=-1
  1204. do l=1 to getclip('Bases.'data.i'.0')
  1205. inn=GetClip('Bases.'data.i'.'l)
  1206. if words(inn)=3 then do
  1207. if (data.i=Side | (abs(XC-word(inn,1)) <= 15 & abs(YC-word(inn,2)) <= 15)) then do
  1208. did=did+1;if did=0 then transmit ''
  1209. sendstring data.i' base @'right(word(inn,1),2)'-'left(word(inn,2),2)'  '
  1210. sendstring right((word(inn,1)-XC),3)||','||right((word(inn,2)-YC),3)||';'
  1211. transmit ' 'Rat(word(inn,3),11000)'%'
  1212. end
  1213. end
  1214. end
  1215. if did=-1 then transmit text(104,data.i)
  1216. end
  1217. if ((Ans=upper(data.i) | Ans='ALL') & (Ant='PL' | Ant='') & getclip('Planets.'data.i'.0') > 0) then do
  1218. did=-1
  1219. do l=1 to GetClip('Planets.'data.i'.0')
  1220. inn=GetClip('Planets.'data.i'.'l)
  1221. if words(inn)=3 then do
  1222. if (data.i=Side | (abs(XC-word(inn,1)) <= 15 & abs(YC-word(inn,2)) <= 15)) then do
  1223. did=did+1;if did=0 then transmit ''
  1224. sendstring data.i' planet @'right(word(inn,1),2)'-'left(word(inn,2),2)' '
  1225. sendstring right((word(inn,1)-XC),3)||','||right((word(inn,2)-YC),3)||';'
  1226. transmit ' 'word(inn,3)' builds'
  1227. end
  1228. end
  1229. end
  1230. if did=-1 then transmit text(105,data.i)
  1231. end
  1232. end
  1233. end
  1234. LDONE:
  1235. return
  1236. SENDMES:
  1237. call PlayIII
  1238. do until string=''
  1239. Ans=left(string,1);if Ans ~= Init then do
  1240. inn='';do until words(inn)=7
  1241. inn=GetClip('Stats.'Ans)
  1242. end
  1243. if abs(word(inn,6)-XC) <= 15 & abs(word(inn,7)-YC) <= 15 then do
  1244. FILE=PathM||'Message.'||Ans;Jv=FILEM(file)
  1245. Jv=writeln(fnh,''||Msg);wte=1
  1246. if length(Msh) < 3 then Jv=writeln(fnh,'')
  1247. else Jv=writeln(fnh,Msh)
  1248. end
  1249. else if Msi ~= '' then do;Jv=FILEM(PathM'Message.'Ans)
  1250. Jv=writeln(fnh,Msi);wte=1;end
  1251. call close fnh;do i=1 to 10;end
  1252. Jv=SetClip('Reading.'Ans,'');if wte=1 then do
  1253. wte=0;Jv=SetClip('Message.'Ans,1)
  1254. end
  1255. end
  1256. string=right(string,(length(string)-1))
  1257. end
  1258. return
  1259. CAPTURE:
  1260. call LAST;if NCom ~= 3 then do
  1261. query||text(106,0)' ';Ans=upper(result)
  1262. query||text(107,0)' ';Ant=upper(result)
  1263. NCom=3;Com='CA '||Ans||' '||Ant
  1264. end
  1265. TX=word(Com,2);TY=word(Com,3)
  1266. if (NB(TX) ~= 1 | NB(TY) ~= 1) | (TX < 1 | TY < 1 | TX > 75 | TY > 75) then
  1267. transmit text(108,0)
  1268. else do
  1269. if (abs(XC-TX) > 1 | abs(YC-TY) > 1) then
  1270. transmit text(109,Ship)
  1271. else do
  1272. call SPACE;Jv=Seek(Space,((TY-1)*75+TX-1),'B')
  1273. inn=readch(Space)
  1274. if inn='5' then do
  1275. transmit '\n1'Ship' capturing Neu planet @'TX'-'TY'.'
  1276. XT=TX;YT=TY;data='Planets.Neu';call LOCATE
  1277. Max=GetClip('Planets.Neu.0');Max=Max-1;Jv=SetClip('Planets.Neu.0',Max)
  1278. call DELPOS;call SPACE;Jv=Seek(Space,((TY-1)*75+TX-1),'B')
  1279. Jv=Sdsc(100,4)
  1280. if Side='Coa' then Ans='1'
  1281. else Ans='3'
  1282. Jv=writech(Space,left(Ans,1))
  1283. Max=GetClip('Planets.'Side'.0')
  1284. if Max < 1 then do
  1285. Max=1;Jv=Setclip('Planets.'Side'.0',1)
  1286. end
  1287. else do
  1288. Max=Max+1;Jv=SetClip('Planets.'Side'.0',Max)
  1289. end
  1290. line=TX TY 0
  1291. Jv=SetClip('Planets.'Side'.'Max,line);call INITTAR
  1292. call Cloak_Find
  1293. end
  1294. else do
  1295. if ((inn=3 & Side='Coa')|(inn=1 & Side='Emp')) then do
  1296. I=1;Leave=0;do until Leave=1
  1297. inn=GetClip('Planets.'Ene'.'i)
  1298. if words(inn)=3 then do
  1299. if TX=word(inn,1) & TY=word(inn,2) then do
  1300. if word(inn,3) > 0 then do
  1301. transmit text(110,0)
  1302. Bds=word(inn,3);Bds=Bds-1;att=1
  1303. end
  1304. else do
  1305. transmit text(111,(Ship Ene TX'-'TY));Bds=-1
  1306. Jv=Sdsc(100,4)
  1307. end
  1308. Did=int(random(1,10,time('S')))
  1309. do j=1 to did
  1310. Da1=abs(200/(Shields/MaxS)+random(1,3,time('s'))*0.571)
  1311. if ShdC='lowered' then Da1=Da1 * 1.75
  1312. Da1=int(Da1*10+.5)/10;if Bds > 0 then Is='('||Bds||')';else Is=''
  1313. call BLOW
  1314. Msg=Ene' Planet'Is' @'TX'-'TY' makes 'Da1' unit phaser hit on'
  1315. Msg=Msg||'\n1'Ship' @'XC'-'YC', '||Rat(Shields,MaxS)||'%';Msi=''
  1316. Msh='';transmit '\c2'Msg;call SENDMES;att=1
  1317. end
  1318. Leave=1;if Bds > -1 then do
  1319. line=TX TY Bds
  1320. Jv=SetClip('Planets.'Ene'.'i,line)
  1321. end
  1322. else do
  1323. inn=GetClip('Planets.'Side'.0');if inn < 1 then inn=0
  1324. inn=inn+1;Jv=SetClip('Planets.'Side'.0',inn)
  1325. line=TX TY 0
  1326. Jv=SetClip('Planets.'Side'.'inn,line)
  1327. Max=GetClip('Planets.'Ene'.0');Max=Max-1
  1328. Jv=SetClip('Planets.'Ene'.0',Max)
  1329. do k=i to Max
  1330. t=k+1;inn=GetClip('Planets.'Ene'.'t)
  1331. Jv=SetClip('Planets.'Ene'.'k,inn)
  1332. end
  1333. call SPACE;Jv=seek(Space,((TY-1)*75+TX-1),'B')
  1334. inn=readch(Space,1);Is=4-inn;Jv=seek(Space,((TY-1)*75+TX-1),'B')
  1335. Jv=writech(Space,left(Is,1));call INITTAR
  1336. call Cloak_Find
  1337. end
  1338. end
  1339. end
  1340. if Leave=0 then do
  1341. I=I+1;if I > GetClip('Planets.'Ene'.0') then Leave =1
  1342. end
  1343. end
  1344. end
  1345. end
  1346. end
  1347. end
  1348. OSP=0;call close SPACE
  1349. signal SHIPEE
  1350. SHIPEE:
  1351. line=Ship Shields MaxS Energy MaxE XC YC
  1352. Jv=setclip('Stats.'||Init,line)
  1353. return
  1354. BUILD:
  1355. call LAST;if NCom ~= 3 then do
  1356. query||text(113,0)' ';Ans=upper(result)
  1357. query||text(114,0)' ';Ant=upper(result)
  1358. NCom=3;Com='BU 'Ans' 'Ant
  1359. end
  1360. TX=word(Com,2);TY=word(Com,3)
  1361. if (NB(TX)~=1|NB(TY)~=1|TX<1|TY<1|TY>75|TX>75) then transmit text(115,0)
  1362. else do
  1363. call SPACE
  1364. Jv=seek(Space,((TY-1)*75+TX-1),'B')
  1365. inn=readch(Space)
  1366. if NB(inn) ~= 1 then transmit text(116,0)
  1367. else do
  1368. if (abs(TX-XC) < 2 & abs(TY-YC) < 2) then do
  1369. L=1;Leave=0;do until Leave ~= 0
  1370. if GetClip('Planets.'Side'.0') < 1 then
  1371. Leave=2
  1372. else do
  1373. inn=getclip('Planets.'Side'.'L)
  1374. if word(inn,1)=TX & word(inn,2)=TY then do
  1375. Leave=1;Plc=L
  1376. end
  1377. end
  1378. if Leave=0 then do
  1379. L=L+1;if L > GetClip('Planets.'Side'.0') then Leave=2
  1380. end
  1381. end
  1382. if Leave=2 then transmit text(116,0)
  1383. else do
  1384. inn=GetClip('Planets.'Side'.'Plc)
  1385. Bds=word(inn,3)
  1386. if Bds <= 3 then do
  1387. Bds=Bds+1
  1388. Pd='.';if Bds~=1 then Pd='s.'
  1389. transmit text(117,Bds)||PD;call AdvSt
  1390. line=TX TY Bds
  1391. Jv=setclip('Planets.'Side'.'Plc,line)
  1392. end
  1393. else do
  1394. May=GetClip('Bases.'Side'.0');Max=GetClip('Planets.'Side'.0')
  1395. if May >= 10 then transmit text(118,0)
  1396. else do
  1397. call Cloak_Find
  1398. Max=Max-1;May=May+1
  1399. transmit text(119,(Ship Side' base.'))
  1400. Jv=Sdsc(1000,5)
  1401. data='Planets.'Side;L=Plc
  1402. Jv=SetClip('Planets.'Side'.0',Max);call DELPOS
  1403. Jv=SetClip('Bases.'Side'.0',May)
  1404. line=TX TY 11000
  1405. Jv=SetClip('Bases.'Side'.'May,line)
  1406. call SPACE;Jv=Seek(Space,((TY-1)*75+TX-1),'B')
  1407. Dum=lastpos('$$',Junk);Dum=(Dum-1)/3+1
  1408. Jv=writech(Space,Dum)
  1409. end
  1410. end
  1411. end
  1412. end
  1413. else transmit text(120,Ship)
  1414. end
  1415. end
  1416. OSP=0;call close SPACE
  1417. return
  1418. TARGTS:
  1419. sendstring text(121,0)' ';getchar;Ans=result
  1420. if Ans~='Y' then transmit 'No.'
  1421. else do;transmit 'Yes.\n2Scanning..';call INITTAR;end
  1422. if TAR < 1 then transmit text(122,0)
  1423. else do
  1424. transmit ''
  1425. do i=1 to TAR
  1426. transmit TGT.i
  1427. end
  1428. end
  1429. return
  1430. DOCKSH:
  1431. if (Dock ~= 1)|(GetClip('ReDock.'Init)=1) then do;Jv=SetClip('ReDock.'Init,'')
  1432. data.1='Planets.';data.2='Bases.';L=1;Leave=0;Is=0;Dock=0
  1433. do until Leave=1
  1434. Max=GetClip(data.L||Side'.0');if Max > 0 then do
  1435. Is=0;Pos=1;do until (Is=1)
  1436. inn=GetClip(data.L||Side'.'Pos)
  1437. if words(inn)=3 then do
  1438. if (abs(XC-word(inn,1)) < 2 & abs(YC-word(inn,2)) < 2) then do
  1439. Is=1;Leave=1;Dock=1
  1440. end
  1441. end
  1442. Pos=Pos+1;if Pos > Max then Is=1
  1443. end
  1444. end
  1445. if (Dock=0 & L=1) then L=2
  1446. else Leave=1
  1447. end
  1448. end
  1449. if Dock ~= 1 then transmit text(123,Ship)
  1450. else transmit text(124,0)
  1451. if Dock=1 then do
  1452. Dum=random(1,50,time('s'));Dum=int((Dum*294/22*L)*10+.5)/10
  1453. Energy=Energy + Dum
  1454. if Energy > MaxE then Energy=MaxE
  1455. Shields=abs(Shields) + Dum
  1456. if Shields > MaxS then Shields=MaxS;Torps=MxTo
  1457. call AdvSt;if shdc~='raised' then SA='SH ON/'||SA
  1458. TDa=0
  1459. do i=1 to 6
  1460. if da.i>0 then do
  1461. da.i=da.i-70
  1462. if da.i<1 then do
  1463. da.i=0
  1464. transmit text(127,0) device.i text(128,0)
  1465. if re_now=i then re_now=0
  1466. end
  1467. end
  1468. TDa=TDa+da.i
  1469. end
  1470. end
  1471. signal SHIPEE
  1472. REPAIRSH:
  1473. re_now=0
  1474. call LAST;transmit '';num=0
  1475. do i=1 to 6
  1476. if Da.i > 0 then do
  1477. num=num+1;tm.num=i
  1478. transmit num'. 'left(device.i,18) da.i' units'
  1479. end
  1480. end
  1481. if num=0 then transmit text(125,0)
  1482. else do
  1483. if num>1 then do
  1484. query||text(126,0)
  1485. Ans=result;Ans=upper(Left(Ans,1))
  1486. end
  1487. else Ans='1'
  1488. if Ans>0&Ans<=Num then do
  1489. Z3=tm.Ans;Z1=Rat(da.z3,45)/100
  1490. transmit '\n1Repairs on the 'device.z3' will take 'z1' stardates.'
  1491. query||text(132,0)' ';Ans=result;Ans=upper(left(Ans,1))
  1492. if Ans~='N' then do
  1493. re_now=Z3
  1494. transmit text(133,0)
  1495. end
  1496. end
  1497. end
  1498. signal SHIPEE
  1499. DAMRPT:
  1500. hi=0.0;hd=0;num=0;head=text(134,0)
  1501. do i=1 to 6
  1502. if Da.i ~= 0 then do
  1503. if hd=0 then do;hd=1;transmit Head;end;Z2=Rat(Da.i,30)/100
  1504. tcol='';if re_now=i then do
  1505. tcol='\c1';Z2=Rat(Da.i,45)/100||Col
  1506. end
  1507. transmit left(device.i,18)||left(Da.i,11)||tcol||Z2;num=num+1
  1508. if Z2>hi then hi=Z2
  1509. end
  1510. end
  1511. if hd=0 then transmit '\n1'text(125,Rank)
  1512. else
  1513. if num~=1 then transmit left('Total',18)||left(TDa,11)||hi
  1514. drop tcol num i hi hd head
  1515. return
  1516. PHASERS:
  1517. call LAST;if TAR < 1 then transmit text(135,0)
  1518. else if ClkCtr=1 then transmit text(4,0)
  1519. else if (Da.2 < 75) then do
  1520. Dispurse=500;if NCom=3 then do
  1521. if word(Com,2)='C' then do
  1522. Ans=left(word(com,3),1)
  1523. inn=GetClip('Stats.'Ans)
  1524. if words(inn)=7 then Com='PH 'word(inn,6)' 'word(inn,7)
  1525. else Com='PH'
  1526. end
  1527. else if NB(word(Com,2)) ~= 1 | NB(word(Com,3)) ~= 1 then
  1528. Com='PH'
  1529. end
  1530. else if NCom=4 & word(Com,2)='C' then do
  1531. Ans=left(word(Com,4),1)
  1532. inn=GetClip('Stats.'Ans)
  1533. if words(inn)=7 then do
  1534. Com='PH 'word(inn,6)' 'word(inn,7)
  1535. if NB(word(Com,3))=1 then Dispurse=word(Com,3)
  1536. end
  1537. else Com='PH'
  1538. end
  1539. else if NCom=4 then Dispurse=Word(Com,2)
  1540. else Com='PH'
  1541. if words(Com)=1 then do
  1542. query||text(137,0)' ';Ans=result
  1543. query||text(138,0)' ';Ant=result
  1544. Com='PH 'Ans' 'Ant
  1545. end
  1546. if words(Com)=3 | words(Com)=4 then do
  1547. if words(Com)=3 then do;TX=word(Com,2);TY=word(Com,3);end
  1548. else do;TX=word(Com,3);TY=word(Com,4);Dispurse=word(Com,2);end
  1549. if NB(TX)~=1 | NB(TY)~=1 | NB(Dispurse)~=1 then
  1550. transmit text(139,0)
  1551. else do
  1552. L=1;Leave=0;do until Leave ~= 0
  1553. Dum=lastpos('@',TGT.l);XT=mid(TGT.l,Dum+1,2)
  1554. if right(XT,1)='-' then XT=left(XT,1)
  1555. Dum=firstpos('-',TGT.l);YT=mid(TGT.l,Dum+1,2)
  1556. if right(YT,1)='-' then YT=left(YT,1)
  1557. if TX=XT & TY=YT then Leave=1
  1558. if Leave=0 then do
  1559. L=L+1;if L > TAR then Leave=2
  1560. end
  1561. end
  1562. if Leave=2 then transmit text(136,0)
  1563. else do
  1564. data='';if firstpos('Planet',TGT.L) ~= 0 then data='Planets'
  1565. if firstpos('Base',TGT.L) ~= 0 then data='Bases'
  1566. if data ~= '' then do
  1567. data=data||'.'Ene;call LOCATE
  1568. if Leave=1 then do
  1569. if ShdC='raised' then do
  1570. transmit text(140,0)
  1571. if Dock ~= 1 then Energy=Energy - 200
  1572. end
  1573. if Rank='Cadet'|Rank='Lieutenant' then
  1574. if Dispurse < 200 | Dispurse > 1500 then Dispurse=500
  1575. if Rank='Captain' then
  1576. if Dispurse < 200 | Dispurse > 2500 then Dispurse=500
  1577. if data='Planets.'||Ene then do
  1578. if TEne > 0 then do
  1579. if Dispurse > 750 then
  1580. if Dispurse*(random(1,50,time('S'))/50) > 740 then TEne=TEne-1
  1581. end
  1582. line=word(inn,1) word(inn,2) TEne
  1583. Jv=SetClip(data'.'L,line)
  1584. Da1=int(Dispurse*(random(1,50,time('S'))/50.2)*10+.5)/10
  1585. Jv=Sdsc((0-Da1),8)
  1586. Msg=Ship' @'XC'-'YC' 'Rat(Shields,MaxS)'% makes '||Da1
  1587. Msg=Msg||' unit phaser hit on\n1'Ene' Planet('TEne') @'XT'-'YT
  1588. Msi='';Msh=''
  1589. att=1;transmit '\c5\n1'Msg;call SENDMES;call ShipEE
  1590. end
  1591. else if data='Bases.'||Ene then do
  1592. Far=((XC-XT)**2 + (YC-YT)**2)
  1593. do i=1 to 10 by .5
  1594. if Far/i < i then leave
  1595. end;Far=i
  1596. Da1=abs((Dispurse/Far)/((TEne+500)/11000)+random(1,800,time('s'))*0.571)
  1597. if Rank=text(19,0) then Da1=Da1 * 2
  1598. Da1=int(Da1*10+.5)/10
  1599. if Da1 > TEne then Da1=TEne
  1600. Jv=Sdsc(Da1,3);TEne=TEne-Da1
  1601. line=XT YT TEne
  1602. Jv=SetClip('Bases.'Ene'.'L,line)
  1603. Msg=Ship' @'XC'-'YC' 'Rat(Shields,MaxS)'% makes '||Da1
  1604. Msg=Msg||' unit phaser hit on\n1'Ene' base @'XT'-'YT' '
  1605. Is=Rat(TEne,11000);Msg=Msg||Is'%'
  1606. call COMMON
  1607. end
  1608. else do
  1609. transmit '\n1ERROR!';signal DONE
  1610. end
  1611. if Rank='Cadet' then Dispurse=int(Dispurse/1.3)
  1612. if Dock~=1 then Energy=Energy-Dispurse
  1613. end
  1614. end
  1615. else do
  1616. call Space;Jv=seek(Space,((TY-1)*75+TX-1),'B')
  1617. inn=readch(Space)
  1618. if lastpos(inn,Enemy)=0 then transmit text(136,0)
  1619. else do
  1620. Shi=inn;Far=((XC-XT)**2 + (YC-YT)**2)
  1621. do i=1 to 10 by .5
  1622. if Far/i < i then leave
  1623. end;Far=i;Ost=GetClip('Stats.'Shi)
  1624. Osh=word(Ost,2);OMs=word(Ost,3);OEn=word(Ost,4)
  1625. Da1=abs((Dispurse/Far)/((Osh+500)/OMs)+random(1,3,time('s'))*0.571)
  1626. if Rank=text(19,0) then Da1=Da1 * 1.4
  1627. Da1=int(Da1*10+.5)/10
  1628. Da1=Da1/3
  1629. Da2=0;if Da1 > Osh then do
  1630. Da2=abs(Da1-Osh);Da1=Osh
  1631. end;Osh=Osh-Da1;OEn=OEn-Da2
  1632. Jv=Sdsc((Da1+Da2),1)
  1633. Msg=Ship' @'XC'-'YC' 'Rat(Shields,MaxS)'% makes '||Da1
  1634. Msg=Msg||' unit phaser hit on\n1'word(Ost,1)' @'XT'-'YT' '
  1635. Msg=Msg||Rat(Osh,OMs)'%'
  1636. if Rat(Osh,OMs) < 15 then Msi=text(142,(word(Ost,1)))
  1637. else Msi='';Msh='';att=1
  1638. le=GetClip('Stats.'Shi)
  1639. line=word(le,1) OSh OMs OEn word(le,5) word(le,6) word(le,7)
  1640. Jv=SetClip('Stats.'Shi,line)
  1641. transmit '\c5\n1'Msg||Msh;call SENDMES
  1642. end
  1643. end
  1644. end
  1645. end
  1646. end
  1647. else transmit text(136,0)
  1648. end
  1649. else Jv=Dam(2)
  1650. call INITTAR;OSP=0;call close SPACE;call ShipEE
  1651. return
  1652. UPHI:
  1653. if HighDid~=1 then do
  1654. transmit text(142,0);z1=0;HighDid=1
  1655. do until GetClip('HiScore')~=1
  1656. z1=z1+1;if z1>500 then Jv=SetClip('HiScore','')
  1657. end
  1658. Jv=SetClip('HiScore',1);if exists(Path'HiScores') then do
  1659. call open(fnn,Path'HiScores','R')
  1660. call open(fng,Path'Temp.'SNbr,'W');did=0;yer=0
  1661. do until eof(fnn)
  1662. inn=readln(fnn)
  1663. if words(inn)=4 then do
  1664. if (Po3 >= word(inn,3) & yer=0) then do
  1665. Jv=writeln(fng,UName Rank Po3 SNbr);did=did+1;yer=1
  1666. end
  1667. if ((word(inn,4) ~= SNbr)&(did < 10)) then do
  1668. Jv=writeln(fng,inn);did=did+1
  1669. end
  1670. end
  1671. end
  1672. if (yer=0 & did < 10) then Jv=writeln(fng,UName Rank Po3 SNbr)
  1673. call close fng
  1674. call close fnn
  1675. address command 'delete "'Path'HiScores"'
  1676. address command 'Rename "'Path'Temp.'SNbr'" "'Path'HiScores"'
  1677. end
  1678. else do
  1679. call open(fnn,Path'HiScores','W')
  1680. jv=writeln(fnn,UName Rank Po3 SNbr)
  1681. call close fnn
  1682. end;end;Jv=SetClip('HiScore','')
  1683. return
  1684. TORPFI:
  1685. call Last
  1686. if ClkCtr=1 then transmit text(4,0)
  1687. else if (Da.3 < 75) then do
  1688. if NCom > 2 then do
  1689. if NCom=3 then do
  1690. NT=1;TX=word(Com,2);TY=word(Com,3)
  1691. end
  1692. else if (NCom=4 & word(Com,2) ~= 'C') then do
  1693. NT=word(Com,2);TX=word(Com,3);TY=word(Com,4)
  1694. end
  1695. else if (NCom=4 & word(Com,2)='C') then do
  1696. Ans=left(word(Com,4),1);inn=GetClip('Stats.'Ans)
  1697. if words(inn)=7 then do
  1698. NT=word(Com,3);TX=word(inn,6);TY=word(inn,7)
  1699. end
  1700. else Com='TO'
  1701. end
  1702. else Com='TO'
  1703. end
  1704. else Com='TO'
  1705. if Com='TO' then do
  1706. query||text(137,0)' ';Ans=result
  1707. query||text(138,0)' ';Ant=result
  1708. TX=Ans;TY=Ant;NT=1
  1709. end
  1710. if (NB(TX)~=1|NB(TY)~=1|NB(NT)~=1) then transmit text(143,0)
  1711. else do
  1712. NT=int(abs(NT));if TX < XC then ta=-1
  1713. if TX=XC then ta=0
  1714. if TX > XC then ta=1
  1715. if TY > YC then tb=1
  1716. if TY=YC then tb=0
  1717. if TY < YC then tb=-1
  1718. YT=YC;XT=XC;call SPACE
  1719. if NT > MaxT then NT=MaxT
  1720. if NT > Torps then transmit text(144,0)
  1721. else do
  1722. do i1=1 to NT
  1723. call BUF
  1724. Tmx=0;Tmy=0;Is=0;do until Is~=0
  1725. if YT~=TY then do;YT=YT+tb;Tmy=Tmy+1;end
  1726. if XT~=TX then do;XT=XT+ta;Tmx=Tmx+1;end
  1727. if (((Tmx>10)|(Tmy>10))|((XT<1)|(XT>75)|(YT<1)|(YT>75))) then do
  1728. transmit text(145,(i1 XT'-'YT));Is=1
  1729. end
  1730. else do
  1731. call SPACE;Jv=seek(Space,((YT-1)*75+XT-1),'B');inn=readch(Space,1)
  1732. if (inn~= '.' & inn~='6') then do
  1733. Is=1;txt=text(146,(i1 XT'-'YT))
  1734. if (NB(inn)=1|inn='*') then do
  1735. Var=inn;if NB(Var)=1 then
  1736. Var=word(Junk,inn)
  1737. if var='$$'|var='++' then transmit txt
  1738. else do
  1739. if Var='@' then do
  1740. Da1=abs(450/(120/500)+random(1,800,time('s'))*0.571)
  1741. Da1=int(Da1*10+.5)/10
  1742. Msg='\n1'Ship' @'XC'-'YC' 'Rat(Shields,MaxS)'% makes '||Da1
  1743. Msg=Msg||' unit torpedo hit on\n1Neu planet @'XT'-'YT
  1744. Msh=text(148,(XT'-'YT))
  1745. data='Planets.Neu';call Locate;Max=GetClip(data'.0');Max=Max-1
  1746. Jv=SetClip(data'.0',Max);call DELPOS
  1747. Jv=Sdsc((0-Da1),8);Msi=''
  1748. transmit '\c5'Msg||Msh;call SENDMES
  1749. Jv=Seek(Space,((YT-1)*75+XT-1),'B');Jv=writech(Space,'.')
  1750. call NEUMAKE;att=1
  1751. end
  1752. else if Var='*' then do
  1753. Da1=abs(1420*random(1,3,time('s'))*0.371)
  1754. Da1=int(Da1*10+.5)/10
  1755. Msg=Ship' @'XC'-'YC' 'Rat(Shields,MaxS)'% makes '||(Da1/2.2)
  1756. Msg=Msg||' unit torpedo hit on\n1Star @'XT'-'YT
  1757. Msh=text(148,(XT'-'YT))
  1758. Jv=Sdsc(-500,7);Msi=''
  1759. transmit '\n1\c5'Msg||Msh;call SENDMES
  1760. call BLOW
  1761. Jv=Seek(Space,((YT-1)*75+XT-1),'B');Jv=writech(Space,'.')
  1762. Msg='Nova @'XT'-'YT' makes 'Da1' unit energy hit on\n1'
  1763. Msg=Msg||Ship' @'XC'-'YC' 'Rat(Shields,MaxS)'%';Msh=''
  1764. transmit '\n1\c5'Msg||Msh;call SENDMES;att=1
  1765. do until inn='.';call RDM;Jv=Seek(Space,((Y-1)*75+X-1),'B')
  1766. inn=readch(Space);end;Jv=Seek(Space,((Y-1)*75+X-1),'B')
  1767. Jv=writech(Space,'*')
  1768. sev=1;call DAMPICK
  1769. end
  1770. else if Var='//' then do
  1771. data='Bases.'Ene;call LOCATE
  1772. Da1=abs(380/((TEne+500)/11000)+random(1,800,time('s'))*0.571)
  1773. if Rank=text(19,0) then Da1=Da1 * 2
  1774. Da1=int(Da1*10+.5)/10
  1775. if Da1 > TEne then Da1=TEne
  1776. Jv=Sdsc(Da1,3);TEne=TEne-Da1
  1777. line=XT YT TEne
  1778. JV=Setclip('Bases.'Ene'.'L,line)
  1779. Msg=Ship' @'XC'-'YC' 'Rat(Shields,MaxS)'% makes '||Da1
  1780. Msg=Msg||' unit torpedo hit on\n1'Ene' base @'XT'-'YT' '
  1781. Msg=Msg||Rat(TEne,11000)'%'
  1782. call COMMON;att=1;if dest=1 then do;TX=0;TY=0;end
  1783. end
  1784. else if Var='--' then do
  1785. data='Planets.'Ene;call LOCATE
  1786. Da1=abs(496/(random(1,3,time('s'))/2)*0.771)
  1787. Da1=int(Da1*10+.5)/10
  1788. if Da1 > 500 & TEne > 0 then TEne=TEne-1
  1789. Jv=Sdsc((0-Da1),8)
  1790. line=XT YT TEne
  1791. Jv=SetClip('Planets.'Ene'.'L,line)
  1792. Msg=Ship' @'XC'-'YC' 'Rat(Shields,MaxS)'% makes '||Da1
  1793. is='';if TEne>0 then Is='('TEne')'
  1794. Msg=Msg||' unit torpedo hit on\n1'Ene' planet'Is' @'XT'-'YT
  1795. Msi='';Msh='';transmit '\n1\c5'Msg;call SendMes;Call ShipEE;att=1
  1796. end
  1797. end
  1798. end
  1799. else do
  1800. if lastpos(inn,choices) ~= 0 then transmit text
  1801. else if lastpos(inn,Enemy) ~=0 then do
  1802. Shi=inn;Ost=GetClip('Stats.'Shi)
  1803. Osh=word(Ost,2);OMs=word(Ost,3);OEn=word(Ost,4)
  1804. Da1=abs(635/((Osh+500)/OMs)+random(1,3,time('s'))*0.571)
  1805. Da1=int(Da1/2.5*10+.5)/10
  1806. z=random(1,100,(time('s')));disp=0
  1807. if z/13=int(z/13) then do
  1808. Da1=0.0;line=GetClip('Command.'inn)
  1809. if compress(line)='' then line=''
  1810. line=line||'MO R -1 0/'
  1811. Jv=SetClip('Command.'Shi,line);disp=1
  1812. end
  1813. Ost=GetClip('Stats.'Shi)
  1814. Osh=word(Ost,2);OMs=word(Ost,3);OEn=word(Ost,4)
  1815. Da2=0;if Da1>Osh then do
  1816. Da2=abs(Da1-Osh);Da1=Osh
  1817. end;Osh=Osh-Da1;OEn=OEn-Da2
  1818. Jv=Sdsc((Da1+Da2),1)
  1819. Msg=Ship' @'XC'-'YC' 'Rat(Shields,MaxS)'% makes '||Da1
  1820. Msg=Msg||' unit torpedo hit on\n1'word(Ost,1)' @'XT'-'YT' '
  1821. Msg=Msg||Rat(Osh,OMs)'%'
  1822. if Rat(Osh,OMs) < 15 then Msi='\n1The 'word(Ost,1)' is near death.'
  1823. else Msi='';Msh=''
  1824. if disp=1 then
  1825. Msh='\n1'word(Ost,1)' displaced to '||(XT-1)||'-'||(YT-1)
  1826. if OEn < 1 then do
  1827. Msi=text(149,(word(Ost,1)))
  1828. Jv=Sdsc(500,2)
  1829. end
  1830. le=GetClip('Stats.'Shi)
  1831. line=word(le,1) Osh OMs OEn word(le,5) word(le,6) word(le,7)
  1832. Jv=SetClip('Stats.'Shi,line);att=1
  1833. transmit '\c5\n1'Msg||Msh||Msi;call SENDMES
  1834. end
  1835. end
  1836. end
  1837. else if (XT=TX&YT=TY) then do
  1838. Is=1;transmit text(145,(i1 XT'-'YT))
  1839. end
  1840. end
  1841. end
  1842. XT=XC;YT=YC;if Dock~=1 then Torps=Torps-1
  1843. end
  1844. end
  1845. end
  1846. end
  1847. else Jv=Dam(3)
  1848. OSP=0;call close SPACE
  1849. signal INITTAR
  1850. BEGC:
  1851. bufferflush;sendstring text(155,0);getchar;transmit ''
  1852. inn='0';if exists(Path'BegVar') then do
  1853. call Open(fnn,Path'BegVar','R')
  1854. inn=readln(fnn)
  1855. call close fnn
  1856. end
  1857. transmit text(156,(Col word(inn,1))) ve'.'
  1858. transmit text(157,word(inn,2))
  1859. Jv=DELFILE(Path'BegVar')
  1860. Tms=word(inn,1);Tms=Tms+1
  1861. Jv=writeln(fng,Tms UName)
  1862. call close fng
  1863. return
  1864. NEUMAKE:
  1865. inn='';call SPACE;do until inn='.'
  1866. call RDM;Jv=seek(Space,((Y-1)*75+X-1),'B')
  1867. inn=readch(Space)
  1868. end
  1869. Jv=seek(Space,((Y-1)*75+x-1),'B')
  1870. Jv=writech(Space,'5');OSP=0;call close SPACE
  1871. inn=GetClip('Planets.Neu.0');if inn < 1 then inn=1;else inn=inn+1
  1872. Jv=SetClip('Planets.Neu.0',inn);line=X Y;Jv=SetClip('Planets.Neu.'inn,line)
  1873. return
  1874. BLOW:
  1875. If (ShdC='raised' & Shields <=0)|(ShdC='lowered') then
  1876. Energy=int(Energy)-Da1
  1877. else Shields=Shields-Da1
  1878. return
  1879. COMMON:
  1880. if rat((TEne+Da1),11000)>92 then Msi=Ene' base @'XT'-'YT' 'Rat(TEne,11000)' is under attack.'
  1881. else Msi=''
  1882. Msh='';if Rat(TEne,11000)<13.6 & TEne >= 20 then Msh='\*1'Path'Critical2\'
  1883. dest=0;if TEne < 20 then do
  1884. call PlayIII;do h=1 to length(string)
  1885. Jv=SetClip('ReDock.'||mid(string,h,1),1);end
  1886. Msh='\*1'Path'Critical1\';dest=1
  1887. Msi=Ene' base @'XT'-'YT' has been destroyed.'
  1888. Max=GetClip('Bases.'Ene'.0')
  1889. Max=Max-1;Jv=SetClip('Bases.'Ene'.0',Max)
  1890. call SPACE;Jv=Seek(Space,((YT-1)*75+XT-1),'B')
  1891. Jv=writech(Space,'.');data='Bases.'Ene;call DELPOS
  1892. call NEUMAKE
  1893. end
  1894. att=1;transmit '\c5\n1'Msg||Msh;call SENDMES
  1895. signal SHIPEE
  1896. MEMMAN:
  1897. Men=Storage();transmit text(158,Mem)||text(159,Men)||text(160,(Mem-Men))
  1898. return
  1899. LOCATE:
  1900. Max=GetClip(data'.0')
  1901. if Max~=0 then do
  1902. L=1;Leave=0;do until Leave~=0
  1903. inn=GetClip(data'.'L)
  1904. if words(Inn) > 1 then do
  1905. if XT=word(inn,1) & YT=word(inn,2) then leave=1
  1906. end
  1907. if leave=0 then do
  1908. L=L+1;if L>Max then Leave=2
  1909. end
  1910. end
  1911. if Leave=2 then transmit text
  1912. else do
  1913. inn=GetClip(data'.'L)
  1914. TEne=word(inn,3)
  1915. end
  1916. end
  1917. else transmit text(136,0)
  1918. return
  1919. DELPOS:
  1920. if ((Max>0)&(L~=Max+1)) then do
  1921. do h=L to Max
  1922. t=H+1;inn=GetClip(data'.'t)
  1923. Jv=SetClip(data'.'h,inn)
  1924. end
  1925. end
  1926. Jv=SetClip(data'.'||(Max+1),'');drop H T
  1927. return Z
  1928. DAMPICK:
  1929. do a1=1 to 5
  1930. a=random(1,6,time('s'))
  1931. end
  1932. if right(device.a,1)='s' then data='ARE';else data='IS'
  1933. transmit '\n1\c4CAPTAIN!!! THE 'upper(device.a) data' DAMAGED!!'
  1934. Da1=((random(1,200,time('s'))*.9811)+(Da.a/2))
  1935. if sev=1 then do
  1936. Da1=Da1*9.62;transmit text(161,0)
  1937. end
  1938. Da1=int(Da1*10+.5)/10
  1939. Da.a=Da.a+Da1;TDa=TDa+Da1;sev=0;sendstring Col
  1940. return
  1941.