-+-+-+-+-+-+-+-+ START OF PART 8 -+-+-+-+-+-+-+-+ X goto 2657 X end if X a$="Amount to purchase> "\call display(1,a$)\q=val(a$) X if q=0 then return end if X if q<0 then X`09call display(33,"Invalid amount - re-enter") X`09goto 2667 X end if X X ! make sure quantity available has been updated X when error in X get #3%, key#0% eq name$(pr::planet), wait 60% X use X end when X X if q>c(a)::qtrade then`20 X`09call display(33,"There isn't that much for sale.") X free #3% X`09goto 2667 X end if X if q*c(a)::pprice>pr::credits then`20 X a$="You can only afford up to "+ & X`09str$(int(pr::credits/c(a)::pprice))+" of "+edit$(c(a)::trade,128%)+"." X`09call display(23,a$) X free #3% X goto 2667 X end if`20 X if (pr::totcargo+q>pr::maxcargo) then X a$="You only have room for "+str$(pr::maxcargo-pr::totcargo)+" "+ & X edit$(c(a)::unit,128%)+"s in your hold." X`09call display(23,a$) X free #3% X goto 2667 X end if`20 X pr::cargo(a)=pr::cargo(a)+q X pr::totcargo=pr::totcargo+q X if pr::legal=1 and (pr::cargo(2)+pr::cargo(7))*rnd>50*rnd then X pr::legal=2 X end if X c(a)::qtrade=c(a)::qtrade-q X when error in X update #3%\free #3% X use X end when X pr::credits=pr::credits-q*c(a)::pprice\gosub 1700 X goto 2657 X X2680 ! sell cargo X if revived$="OK" then`20 X`09a$= "The trading center is closed by government order." X`09call display(23,a$) X return X end if X a$="The traders offer you the above rates per unit of cargo" X call display(23,a$) Xshow_goods: X call smg$begin_display_update(trade_id) X call display(4,)`09! clear`20 X a$="Item Price Quantity in hold" X call display(24,a$) X for i=1 to ntcargo X a1$=str$(c(i)::pprice) X`09a2$=str$(pr::cargo(i)) X if pr::cargo(i)<>0 then X a$=str$(i)+space$(3-len(str$(i)))+c(i)::trade+a1$+ & X`09 space$(15-len(a1$))+& X`09 a2$+space$(5-len(a2$))+edit$(c(i)::unit,128%)+"s" X`09 call display(24,a$) X end if X next i X call smg$end_display_update(trade_id) X2691 a$="Item to sell> "\call display(1,a$)\a=val(a$) X if a<0 or a>10 or a<>int(a) then goto 2691 else if a=0 then return end V if X a$="Quantity to sell> "\call display(1,a$) X q=val(a$) X if q=0 then return end if X if q<0 then q=0 end if X if pr::cargo(a)0 then goto show_goods end if X return X`20 X2800 ! ---------------------- Options ------------------------ X call smg$begin_pasteboard_update(new_pid) X if scanner_on=1 then call display(12,) end if X call display(4,) X a$=" Toggle Controls" X call display(24,a$) X call display(24,"") X a$="1) Ignore Police on Landing "+g_option$(2) X call display(24,a$) X a$="2) Ignore Asteroids on Landing "+g_option$(3) X call display(24,a$) X a$="3) Landing Computer "+g_option$(4) X call display(24,a$) X a$="4) Automatic Fuel Purchase "+g_option$(5) X call display(24,a$) X a$="5) Automatic Missile Purchase "+g_option$(6) X call display(24,a$) X a$="6) Save Options settings`09 " X call display(24,a$) X call display(24,"") X call display(24,"") X a$="Enter number of feature you want to toggle or return to cancel" X call display(24,a$) X call smg$end_pasteboard_update(new_pid) Xtoggle_option: X call display(26,a$) X if a$="0" or a$=CR or a$=LF then X if scanner_on=1 then X new_smg=1 X gosub 3000 X end if X return X end if X if a$<"1" or a$>"7" then goto toggle_option end if X a=val(a$) X select a X %IF (%SECURITY = 0) %THEN X case 7 X! Only allow superusers to use debug mode X if super_user_mode%=1 then debug%=1 end if X %ELSE X case 7 X %END %IF`20 X case 6 X gosub save_options X case else X if g_option$(a+1)="ON" then g_option$(a+1)="OFF"`20 X else g_option$(a+1)="ON" end if X end select X goto 2800 X Xhelp: X ! provide a list of relevant commands along with a 1 line description X when error in X open "gal_disk:gal-help.dat" for input as file #4% X input #4%, a$ X while a$<>menumode$ X`09 input #4%,a$ X next X call display(7,) X call display(19,) X ! display 21 lines of help text X for a=1 to 21 X input #4%,a$ X call display(8,a$) X next a X call display(17,) X call display(20,) X use X`09a$="An error has occured in HELP. Check that gal-help.dat is" X`09call display(23,a$) X`09a$="present and up to date." X`09call display(23,a$) X end when X close #4% X return X Xrestore_options: X ! -------------------- Restore Menu Options ------------------ X saved_options=1 X when error in X open "sys$login:"+pr::username+".OPT" for input as file #4% X for i=2 to 6 X input #4%, g_option$(i) X next i X use X saved_options=0 X end when X close #4% X return X Xsave_options: X ! ---------------------- Save Menu Options ------------------- X when error in X open "sys$login:"+pr::username+".OPT" for output as file #4% X for i=2 to 6 X`09 print #4%, g_option$(i) X next i X print #4%, pr::personalname X a$="Current options saved." X call display(23,a$) X use X a$="Error occured saving options: "+ert$(err) X call display(23,a$) X end when X close #4% X return X X2900 ! ------------------------ Buy Missile ----------------------- X a$="You have room for "+str$(pr::maxmissile-pr::equip(a))+" missiles an Vd "& X`09+"can afford "+str$(int(pr::credits/50))+"." X call display(23,a$) X2912 a$="Number of missiles to purchase> "\call display(1,a$)\b=val(a$) X if b<0 or b<>int(b) then goto 2900 end if X if b>pr::maxmissile-pr::equip(a) then `20 X`09call display(33,"You don't have room for that many.") X`09goto 2912 X end if X if 50*b>pr::credits then`20 X`09call display(33,"You can't afford that many.") X`09goto 2912 X end if X a$="You buy "+str$(b)+" missiles and install them in your ship." X call display(23,a$) X pr::equip(a)=pr::equip(a)+b X pr::credits=pr::credits-b*50 X gosub 1700 X if pr::equip(a)=pr::maxmissile then`20 X`09call display(23,"Your missile rack is now full.") X return X`20 X3000 ! -------------- describe ships in vicinity ---------------- X if new_smg=1 then X gosub damage_report X`09call display(15," ") X call display(17,) X`09call display(13,) X call display(10,) X`09call display(31,) X scanner_on=1 X end if X call smg$begin_pasteboard_update(new_pid) X nearest=50 X gosub 1700 !display status X a=3\a$=" " X call display(13,)`20 X for i=1 to noship X if t(i)::ship=-1 or t(i)::player=2 then iterate end if X d=abs(t(i)::spos-pr::rpos) X e=sgn((pr::rpos-t(i)::spos)*pr::direction) X b$=str$(i)+": "+edit$(s(t(i)::ship)::sname,128%) X if t(i)::ship<>10 or t(i)::ship<>14 then X b$=b$+" ("+t(i)::username+") " X end if X if e=-1 then c$="-" X else if e=1 then c$="+" X else let c$=" " end if X end if X if d=pr::scanrange then X b$="Ship(s) further than "+ str$((pr::scanrange-1)*2000)+" km detecte Vd." X call display(11,b$) X end if X call smg$end_pasteboard_update(new_pid) X if new_smg=1 then new_smg=0 end if X return X X3100 ! ------------- Determine Other Ships Next Move ---------------- X if (t(shipno)::sintent=9 or t(shipno)::sintent<-1) or & X`09t(shipno)::player<>0 then return end if X if t(shipno)::ship=1 or t(shipno)::ship=18 then X`09if pr::lsj = 0 or rnd > .9 then `20 X`09 gosub police_action X`09end if X end if X if t(shipno)::ship>10 and t(shipno)::ship<14 then`20 X`09gosub fleet_action X end if X if t(shipno)::ship=4 or t(shipno)::ship=7 or t(shipno)::ship=8 or & X t(shipno)::ship=17 or t(shipno)::ship=19 or t(shipno)::ship=16 the Vn`20 X gosub pirate_action X end if X if t(shipno)::others(1)=0 then t(shipno)::others(1)=shipnum end if X if t(shipno)::ship=9 or t(shipno)::ship=21 then`20 X`09t(shipno)::sintent=2 X end if X if t(shipno)::ship=2 or t(shipno)::ship=3 or & X t(shipno)::ship=6 then`20 X`09gosub trader_action X end if X if t(shipno)::ship=5 or t(shipno)::ship=15 then`20 X`09gosub scout_action X end if X if t(shipno)::ship=10 then t(shipno)::sintent=0 end if X if t(shipno)::sintent=3 or t(shipno)::sintent=2 then X if t(shipno)::sintent=2 and t(shipno)::senergy.6 and t(shipno)::ship<>1 and t(ship)::ship<>9 then`20 X`09 t(shipno)::sintent=6`09`09! wimp out X end if X if pr::moves>=5 then X ! missile actions X if pr::legal=5 and t(shipno)::ship=1 and rnd>.8 then`20 X`09 t(shipno)::sintent=8\return X end if X if (t(shipno)::ship=2 or t(shipno)::ship=8) and rnd>.8 then`20 X`09 t(shipno)::sintent=8\return X end if X if t(shipno)::ship=9 and pr::moves>20 and rnd>.85 then`20 X`09 t(shipno)::sintent=8\return X end if X if (t(shipno)::ship=4 or t(shipno)::ship=7) and rnd>.9 then X`09 t(shipno)::sintent=8\return X end if X if t(shipno)::ship=3 and rnd>.5 then t(shipno)::sintent=8 end if X end if X end if X return X Xpolice_action: X if (t(shipno)::sintent=12 or t(shipno)::sintent=7) and pr::legal=2 then X`09 return X end if X if (t(shipno)::sintent=15 or t(shipno)::sintent=7) then return end if X if pr::legal<=2 then t(shipno)::sintent=pr::legal-1`20 X else t(shipno)::sintent=2 X end if X return X Xpirate_action: X if t(shipno)::sintent=0 and rnd>.4 then t(shipno)::sintent=3 X else X`09if rnd>.4 then t(shipno)::sintent=2 end if X end if X if t(shipno)::sintent=0 then X`09if rnd>.5 then t(shipno)::sintent=6 X`09else t(shipno)::sintent=4 X`09end if X end if X return X Xtrader_action: X ! if ship is not a transport then there is chance it will sit and attac Vk X if t(shipno)::sintent=0 and t(shipno)::ship<>3 then X`09if rnd>.3 then t(shipno)::sintent=3 end if X end if X if t(shipno)::sintent=0 then`20 X`09if rnd>.5 then t(shipno)::sintent=4 end if X end if X if t(shipno)::sintent=0 then`20 X`09if rnd>.5 then t(shipno)::sintent=5 end if X end if X return X Xscout_action: X if t(shipno)::sintent=0 then X if rnd>.4 then t(shipno)::sintent=2 X else t(shipno)::sintent=5 X end if X end if X return X Xfleet_action: X if t(shipno)::sintent=0 then`20 X`09if rnd>.5 then t(shipno)::sintent=4`20 X`09else t(shipno)::sintent=5 X end if X end if X if pr::legal=5 then t(shipno)::sintent=2 end if X return X`20 X3200 ! ----------------------- Manual Mode ---------------------------- X pr::dodge=0 X gosub 3000 X get #2%, key #0% eq pr::username, wait 60\free #2% X if mid$(op::message,1,1)<>" " then X gosub 1200 X end if X if numevents>0 then gosub 5200 end if ! process events X call display(5,)\call display(6,a$)\menumode$="manual" X3215 a$="`7E" X while a$="`7E" or len(a$)>20 X a$="ACTION> "\call display(1,a$) X a$=a$+"`7E" X next X oops_flag=0 X action_move=0 X action_free=0 X action_combat=0 X num_moves=1 X a=1 X i=1 X while mid$(a$,i,1)<>"`7E" X if mid$(a$,i,1)=" " then X action_cmd$(num_moves)=mid$(a$,a,i-a) X`09 a=i+1 X`09 num_moves=num_moves+1 X end if X`09i=i+1 X next X action_cmd$(num_moves)=mid$(a$,a,i-a) X action_cmd$(num_moves+1)="$$$" X for i=1 to num_moves X for j=1 to nactions X`09 if action_cmd$(i)=action_cost$(j,1) then X`09 select action_cost$(j,2) X`09 case "m" X`09`09action_move=action_move+1 X`09 case "f" X`09`09action_free=action_free+1 X `09 case "c" X`09`09action_combat=action_combat+1 X`09 end select X`09 end if X`09next j X next i X if action_move+action_free+action_combat=0 then X call display(33,"Invalid command sequence. Enter '?' for help.") X goto 3215 X end if X ! check that requested moves are legal X if pr::equip(22)=1 then X`09if action_combat>2 or action_move>1 then X`09 oops_flag=1 X end if X else X if action_combat+action_move>1 then X`09 oops_flag=1 X`09end if X end if X if oops_flag=1 then X a$= "You aren't allowed that combination of moves in a turn." X call display(23,a$) X goto 3215 X end if +-+-+-+-+-+-+-+- END OF PART 8 +-+-+-+-+-+-+-+-