rv=1.05:goto@instructions {because we're sticking subroutines up here} £home {replaces home and rewrites only inverted bar - spc(40) doesn't have desired effect} poke36,0:poke37,1:call -958:inverse:?" ":normal:?:?:return £wait {ubiquitious "Press ENTER to continue} ?:input"Press enter to continue.";x$:return [ Bunch of positions I use commonly. ] £twofifteen vtab2:htab15:return £twosixteen vtab2:htab16:return £twoseventeen vtab2:htab17:return £twoeighteen vtab2:htab18:return £twonineteen vtab2:htab19:return £jetalthere inverse:gosub@twonineteen:?"Jet":normal:return £timera forj=1to2500:next j:k=int(rnd(1)+.5):return £timerb forj=1to1000:next j:return £timerc forj=1to2000:next j:return [ Rather than repeat the logic to check if a purchase or sale is valid based on inventory or wallet amount; we write either our drug inventory or the number we can afford to J; jump to these subroutines to ask for the amount; run the logic; and just return back to the subroutine if the buy/sale is valid...whichthenadjusts inventory and wallet. Otherwise we dump back to the menu. ] £howmuchbuy {some common purchase code} ?"You can afford ";j:?"You can carry ";f £howmanybuy ?:input"How many? (Enter 0 cancel):";k:ifK=0goto@menu ifkftheninverse:?"You can't carry that much!":normal:goto@howmanybuy ifk>jtheninverse:?"You can't afford that much!":normal:goto@howmanybuy return £howmuchsell {common sell code} ?"You can sell:";j:? £howmanysell input"How many? (Enter 0 to cancel.):";k ifK=0goto@menu ifk>jthen?"You don't have that many!":goto@howmanysell return £freespace f=i-((g*5)+m+n+o+u+t+q):return £chase inverse:gosub@twofifteen:?"Being Chased":normal:return £gmod speed=100:gosub@twosixteen:inverse:?"Game Over":normal:speed=255:return £bronxcheck ifp$="THE BRONX"then return ?"you need to head to the bronx":?"to take care of this business." gosub@timerc:goto@menu £cheater ifad>=3thengoto@threestrikes return £daily {randomizes drug prices, adds a day, calculates interests, checks day number} c=int(rnd(1)*12000+16000.5):h=int(rnd(1)*7000+5000.5):a=int((rnd(1)*34+10)*100+.5):z=int((rnd(1)*42+33)*10+.5):s=int((rnd(1)*15+7)*10+.5):l=int((rnd(1)*4+1)*10+.5):b=int(rnd(1)*20+.5):d=d+1:ac=int(((rnd(1)*3)+1)*-1) £checkday {so I can check the day by itself} ifD>=31goto@endgame:return £scorecalculate k=(w+e)-v:ifk<0thenk=0:return k=int(sqr((k/31.5)+.5)):ifk>100thenk=100 return £gamestart {set wallet, debt, location, inventory space, zero out inventory} w=2000:e=0:v=5000:p$="The Bronx":g=0:i=100:m=0:n=0:o=0:u=0:t=0:q=0:gosub@daily:home:htab16:?"Drugwar//e":goto@menu £menu {main menu. everything should loop back here} gosub@home:gosub@freespace inverse:vtab2:htab4:?"Day:"D:gosub@twoeighteen:?"Location:"p$:normal vtab4:?"(C)heck Prices":?"(T)renchcoat":?"(B)uy":?"(S)ell":?"(J)et":?"See (L)oan shark":?"(V)isit Bank":? input"Please make your selection:";x$ ifx$="C"goto@prices ifx$="T"goto@inventory ifx$="B"goto@buy ifx$="S"goto@sell ifx$="J"goto@jet ifx$="L"goto@loan ifx$="V"goto@bank goto@menu [ £debug ?"Testing Screen" ? ?"(w)allet,(g)uns,(v)debt,(e)savings,(i)nventory space" input"What to change?";db$ input"To?";dx ifdb$="w"then w=dx ifdb$="g"then g=dx ifdb$="v"then v=dx ifdb$="e"then e=dx ifdb$="i"then i=dx goto@menu ] £prices gosub@home inverse:gosub@twoeighteen:?"Prices":normal ?:?"cocaine:","$"c:?"heroin:","$"h:?"acid:","$"a:?"weed:","$"z:?"speed:","$"s:?"ludes:","$"l:?"wallet:","$"w gosub@wait:goto@menu £inventory gosub@home inverse:gosub@twosixteen:?"Trenchcoat":normal ?:?"cocaine:",m:?"heroin:",n:?"acid:",o:?"weed:",u:?"speed:",t:?"ludes:",q:?"free space:",f gosub@wait:goto@menu £buy gosub@home inverse:gosub@twonineteen:?"Buy":normal ?:?"What do you want to buy?":?:?"(C)ocaine":?"(H)eroin":?"(A)cid":?"(W)eed":?"(S)peed":?"(L)udes" input"Enter Selection:";x$ ifx$="c"goto@cokebuy ifx$="h"goto@herbuy ifx$="a"goto@acidbuy ifx$="w"goto@weedbuy ifx$="s"goto@spdbuy ifx$="l"goto@ludbuy goto@menu £sell gosub@home:inverse:gosub@twoeighteen:?"Sell":normal ?:?"What would you like to sell?":?:?"(C)ocaine":?"(H)eroin":?"(A)cid":?"(W)eed":?"(S)peed":?"(L)udes" £sellsel input"Enter Selection:(0 to cancel)";x$ ifx$="c"goto@cokesell ifx$="h"goto@hersell ifx$="a"goto@acidsell ifx$="w"goto@weedsell ifx$="s"goto@spdsell ifx$="l"goto@ludsell ifx$="0"goto@menu ?"Invalid Selection!":goto@sellsel £jet gosub@home:gosub@jetalthere ?:?"(B)ronx":?"(G)hetto":?"(C)entral Park ?"(M)anhattan":?"Coney (I)sland":?"Broo(K)lyn":?"(O)ops...stay!":input"Where to dude?";x$ ifx$="B"then y$="The Bronx":goto@jetb {we can use strings} ifx$="G"then y$="The Ghetto":goto@jetb ifx$="C"then y$="Central Park":goto@jetb ifx$="M"then y$="Manhattan":goto@jetb ifx$="I"then y$ ="Coney Island":goto@jetb ifx$="K"then y$="Brooklyn":goto@jetb ifx$="O"thengoto@menu {ifx$="COPTEST"then b=5:goto@police} goto@jet £jetb {input"event:";ev testing/debug} ify$=p$thengoto@alreadythere {more advanced than Bronx only on TI} p$=y$ {it's valid, copy it and move along}:y$="" goto@subway £loan gosub@home:inverse:gosub@twosixteen:?"Loan Shark":normal:?:gosub@bronxcheck:?"Your debt is:$";v:?"You have:$";w:?:input"(R)epay, (B)orrow, (L)eave:";X$ ifX$="R"THENgoto@payme ifX$="B"Thengoto@borrow ifX$="L"thengoto@Menu goto@loan £bank gosub@home:inverse:gosub@twofifteen:?"Bank O'Murica":normal:?:gosub@bronxcheck:?"Your balance:$";e:?"Your wallet:$";w:? input"(D)EPOSIT, (W)ITHDRAW, (L)EAVE:";X$ ifx$="d"thengoto@deposit ifx$="w"thengoto@mymoney ifx$="l"thengoto@menu {ifx$=eg$thengoto@egg} goto@bank [ How buy works: divide wallet by drug price - write to J hand to subroutine, it handles buy logic if pass subroutine-logic, return to actually complete ] £cokebuy gosub@home:inverse:gosub@twosixteen:?"Buy Cocaine":normal:?:j=int(w/c):AC=0:gosub@howmuchbuy:m=m+k:w=w-(c*k):goto@menu £herbuy gosub@home:inverse:gosub@twosixteen:?"Buy Heroin":normal:?:j=int(w/h):AC=0:gosub@howmuchbuy:n=n+k:w=w-(h*k):goto@menu £acidbuy gosub@home:inverse:gosub@twoseventeen:?"Buy Acid":normal:?:j=int(w/a):gosub@howmuchbuy:o=o+k:w=w-(a*k):goto@menu £weedbuy gosub@home:inverse:gosub@twoseventeen:?"Buy Weed":normal:?:j=int(w/z):gosub@howmuchbuy:u=u+k:w=w-(z*k):goto@menu £spdbuy gosub@home:inverse:gosub@twoseventeen:?"Buy Speed":normal:?:j=int(w/s):gosub@howmuchbuy:t=t+k:w=w-(s*k):goto@menu £ludbuy gosub@home:inverse:gosub@twoseventeen:?"Buy Ludes":normal:?:j=int(w/l):gosub@howmuchbuy:q=q+k:w=w-(l*k):goto@menu [ How sell works: write inventory to J run subroutine with logic if pass subroutine, adjust wallet and inventory ] £cokesell gosub@home:inverse:gosub@twofifteen:?"Sell Cocaine":normal:?:j=m:gosub@howmuchsell:m=m-k:w=w+(c*k):goto@menu £hersell gosub@home:inverse:gosub@twoseventeen:?"Sell Heroin":normal:?:j=n:gosub@howmuchsell:n=n-k:w=w+(h*k):goto@menu £acidsell gosub@home:inverse:gosub@twoseventeen:?"Sell Acid":normal:?:j=o:gosub@howmuchsell:o=o-k:w=w+(a*k):goto@menu £weedsell gosub@home:inverse:gosub@twoseventeen:?"Sell Weed":normal:?:j=u:gosub@howmuchsell:u=u-k:w=w+(z*k):goto@menu £spdsell gosub@home:inverse:gosub@twosixteen:?"Sell Speed":normal:?:j=t:gosub@howmuchsell:t=t-k:w=w+(s*k):goto@menu £ludsell gosub@home:inverse:gosub@twosixteen:?"Sell Ludes":normal:?:j=q:gosub@howmuchsell:q=q-k:w=w+(l*k):goto@menu £alreadythere gosub@home:gosub@jetalthere:?:?"You're already in:":htab15:? p$:gosub@timerc:goto@jet £subway gosub@home:gosub@daily:V=int(V*1.1+.5):E=int(E*1.06+.5):inverse:gosub@twoeighteen:?"Subway":normal:?:? ifb=1goto@cheapludes ifb=2goto@cheepweed ifb=3goto@pigheroin ifb=4goto@heroinbust ifb=5goto@heroinbust ifb=6goto@cokebust ifb=7goto@cokebust ifb=8goto@mugged ifb=9goto@cops ifb=10goto@cops ifb=11goto@cops ifb=12goto@gunbuy ifb=13goto@gunbuy ifb=14goto@dedweed ifb=15goto@newcoat ifb=16oto@dedguy ifb=17goto@homeacid £nothinghappens ?:?"Welcome to ";p$:?:gosub@timerc:goto@menu £cheapludes ?"Rival dealers are selling cheap ludes!":l=2:gosub@timerc:goto@menu £cheepweed ?"Weed prices have bottomed-out!":z=122:gosub@timerc:goto@menu £pigheroin ?"Pigs are selling cheap heroin":?"from last week's raid!":h=int((rnd(1)*1150)+850.5):gosub@timerc:goto@menu £heroinbust ?"Addicts are buying heroin":?"at outrageous prices!":h=int((rnd(1)*25000)+18000.5):gosub@timerc:goto@menu £cokebust ?"Pigs made a big coke bust!":?"Prices are outrageous!!!!":c=int((rnd(1)*60000)+80000.5):gosub@timerc:goto@menu £mugged ?"You got mugged!":?:j=int((w/3)*2):?"You lost $";w-j:w=w-j:gosub@timerc:goto@menu £cops gosub@freespace:iff=0goto@ded goto@nexta £theymiss ?"They missed!" £nexta gosub@timera:goto@police £ded ?:?"You've been killed!":gosub@wait:goto@endgame £allgone ?"You killed all of them!":?:gosub@timera j=int(((rnd(1)*1250)+750)+.5):w=w+j ?"You found $";j;"on officer Hardass'" ?"carcass!" ifw>=1200thengoto@doctor goto@menu £doctor gosub@timerc:?:?"Will you pay $1000 for a doctor":input"to sew you up? (Y/N)";x$ ifX$<>"Y"thengoto@menu w=w-1000:bb=100:goto@menu £gunbuy ifw<500thengoto@nothinghappens:gosub@freespace:iff<5thengoto@nothinghappens j=int((rnd(1)*2)+.5) ifj=0theny$="Baretta" ifj=1theny$="Saturday Night Special" ifj=2theny$=".44 Magnum" ?"Will you buy a ";y$:input"for $400? (Y/N)";x$:ifx$<>"Y"thengoto@menu g=g+1:w=w-400:goto@menu £dedweed {don't smoke the weed} ?"There's some weed here that smells":?"like good stuff!!":?:input"Will you smoke it? (Y/N)";X$ ifX$="Y"THENgoto@weedend goto@menu £newcoat ifw<300thengoto@nothinghappens ?"Will you buy a new trenchcoat":input"with more pockets for $200? (Y/N)";X$ ifX$<>"Y"thengoto@menu i=i+10:w=w-200:goto@menu £dedguy gosub@freespace iff<8thengoto@nothinghappens j=int((rnd(1)*7)+1.5):k=int(rnd(1)*5+.5) ifk=0thenq=q+j:y$="Ludes" ifk=1thent=t+j:y$="Speed" ifk=2thenu=u+j:y$="Weed" ifk=3theno=o+j:y$="Acid" ifk=4thenn=n+j:y$="Heroin" ifk=5thenm=m+j:y$="Coke" ?"You found "j"units of "Y$:?"on a dead dude in the subway!":?:gosub@timerc:goto@menu £homeacid ?"The market has been flooded":?"with cheap home-made acid!":a=int((rnd(1)*550)+250.5):gosub@timerc:goto@menu £payme input"Repay how much?";k:ifk=0then?"Get out of here, loser!":gosub@timerb:goto@menu ifk>wthen?:?"YOU DON'T HAVE THAT MUCH!":gosub@timerb:goto@LOAN ifk>vthen?:?"YOU DON'T OWE THAT MUCH!":gosub@timerb:goto@LOAN W=W-k:v=v-k:?:?"THANK YOU.":gosub@timerc:goto@MENU £borrow ?:j=int((rnd(1)*10000)+4000):input"How much do you want?";K:?:ifk=0goto@menu ifk<0then?"Trying to cheat? Double debt!":AD=ad+3:v=v*2:gosub@timerC:gosub@cheater:goto@menu ifK>14000then?"He's not that stupid!":gosub@timerc:goto@menu ifK>Jthen?"He doesn't feel like it.":gosub@timerb:goto@menu v=v+k:w=w+k:?:?"Here's your money.":?:?"Remember, I break thumbs.":gosub@timerc:goto@menu £deposit ?:k=int((rnd(1)*100)+1):input"How much?";j:ifj=0goto@menu ifj>wthen?"You don't have that much cash.":goto@deposit ifk=2thengoto@chaching ifj<0then?"You tried to rob the bank, but barely":?"made it out with nothing.":ad=ad+3:gosub@timerC:goto@menu £chaching e=e+j:w=w-j:?:?"Thank you for your deposit.":gosub@timerc:goto@menu [ £egg ?"You found the easter egg!" ? ?"$1,000,000 has been deposited in to your account." gosub@timerc goto@bank ] £mymoney ?:input"How much?";j ifj<0then?"Try making a deposit.":gosub@timerc:goto@bank ifj>ethen?"You don't have sufficient funds.":goto@mymoney e=e-j:w=w+j:?:?"Thank you for your business.":gosub@timerc:goto@menu £instructions home:vtab2:htab10:?"Welcome to Drugwar//e":htab14:?"Version ";rv:vtab8:htab3:?"Based on the classic TI-BASIC clone":htab2:?"of John E. Dell's 1984 IBM/TRS80 game.":vtab12:htab6:?"Applesoft version by:Jay Moore" vtab19:input"Would you like instructions? (Y/N):";X$:j =RND(-1 *(PEEK(78)+256*PEEK(79))):ifX$="Y"THENgoto@inst goto@gamestart £inst home:?:?"This is a game of buying and selling.":?"Your goal is to pay off your debt and":?"make as much money as possible in a one":?"month period. Prices fluctuate every dayand interest on your loan is calculated as well." ?:?"If you deal too heavily, you'll attract the attention of the police.":?:?"Commands are entered using the letter highlighted (L)ike (S)o. Y is yes and anything counts as no.":gosub@wait:goto@gamestart £threestrikes home:htab8:vtab10:?"Put a quarter in your ass":gosub@timerb:htab7:?"'Cause you played yourself!":gosub@timerc:gosub@timerc:vtab19:htab11:?"Don't cheat so much.":gosub@timerc:gosub@timerc:gosub@timerc:clear:end £weedend gosub@home:inverse:gosub@twofifteen:?"SMOKE Weed":NORMAL:speed=50:?"You hallucinate on the wildest trip":?"of your life, stumble on to the tracks,":?"and get creamed by a train!":?:? htab10:?"Just say NO to drugs!":speed=255:gosub@timerc:gosub@timerb:goto@ironicend £endgame gosub@home:gosub@scorecalculate:gosub@gmod:?:?"Your score on a scale of 1 to 100:";k:? input"Would you like to play again? (Y/N)";x$:ifx$="Y"thengoto@gamestart ?"Don't forget to watch your back!":?:?"Thanks for playing.":?"Have a nice day" £ironicend gosub@home:gosub@gmod:?:speed=50:?"You died from smoking weed.":?:?:gosub@timerc:?"See? Games are totally fake.":speed=255:?:input"Would you like to play again?";x$:ifx$= "Y"THENgoto@GAMESTART clear:end rem Drugwar//e - Version 1.05 rem 5-NOV-2018 rem Copyright 2018 Jay Moore rem gitlab.com/dewdude/drugwar2e rem twitter:_nq4t