rem Drugwar//e - Version 1.03 rem 20-OCT-2018 rem Copyright 2018 Jay Moore rem Released under GPL v3 rem drugwar2e.sourceforge.io rem twitter: _nq4t rv=1.03 goto @instructions {because we're sticking subroutines up here} £titlebar {this literally just draws the game title at the top of the screen} HTAB 16 : print "Drugwar//e" inverse:print" ":normal return £wait {ubiquitious "Press ENTER to continue} print chr$(10) input "Press enter to continue.";x$ return £twofifteen vtab 2 : htab 15 return £twosixteen vtab 2:htab 16 return £twoseventeen vtab 2:htab 17 return £twoeighteen vtab 2: htab 18 return £twonineteen vtab 2:htab 19 return £jetalthere inverse:gosub @twonineteen:print"Jet":normal return £timera for j = 1 to 2500 next j k = int(rnd(2)+.5) return £timerb for j = 1 to 1000 next j return £timerc for j = 1 to 2000 next j return [ "Common logic" has been moved to buy/sell subroutines. This has cleaned the code up a bit ] £howmuchbuy {some common purchase code} print "You can afford ";j print "You can carry ";f £howmanybuy print chr$(10) input "How many? (Enter 0 cancel): ";k if K=0 goto @menu if k>f THEN inverse : print "You can't carry that much!" : normal : goto @howmanybuy if k>j THEN inverse : print "You can't afford that much!" : normal : goto @howmanybuy return £howmuchsell {common sell code} print "You can sell: ";j print chr$(10) £howmanysell input "How many? (Enter 0 to cancel.): ";k If k>j then print "You don't have that many!" : goto @howmanysell if K=0 goto @menu return £freespace f=i-((g*5)+m+n+o+u+t+q) return £chase inverse:gosub @twofifteen: print"Being Chased":normal return £gmod speed=100:gosub @twosixteen:inverse:print"Game Over":normal:speed=255 return £bronxcheck if p$ = "THE BRONX" then return print "you need to head to the bronx" print "to take care of this business." gosub @timerc goto @menu £daily {randomizes drug prices, adds a day, calculates interests, checks day number} c=int(rnd(5)*12000+16000.5) h=int(rnd(5)*7000+5000.5) a=int((rnd(5)*34+10)*100+.5) z=int((rnd(5)*42+33)*10+.5) s=int((rnd(5)*15+7)*10+.5) l=int((rnd(5)*4+1)*10+.5) b=int(rnd(5)*20+.5) d=d+1 £checkday {so I can check the day by itself} if D >= 31 GOTO @endgame return £scorecalculate k=(w+e)-v if k<0 THEN k=0 : return k=int(sqr((k/31.5)+.5)) if k>100 then k=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 {the only time we'll call this outside of the subway} goto @menu {the real start of the game} £menu {main menu. everything should loop back here} home gosub @freespace gosub @titlebar inverse : vtab 2:htab 4:print "Day: "D : vtab 2:htab 18:print"Location: "p$ :normal print chr$(10) print "(C)heck Prices" print "(T)renchcoat" print "(B)uy" print "(S)ell" print "(J)et" print "See (L)oan shark" print "(V)isit Bank" print chr$(10) input "Please make your selection: ";x$ if x$ = "C" goto @prices if x$ = "T" goto @inventory if x$ = "B" goto @buy if x$ = "S" goto @sell if x$ = "J" goto @jet if x$ = "L" goto @loan if x$ = "V" goto @bank {if x$="debug" goto @debug} goto @menu [ £debug print "Testing Screen" print chr$(10) print "(w)allet,(g)uns,(v)debt,(e)savings,(i)nventory space" input "What to change?";db$ input "To?";dx if db$ = "w" then w=dx if db$ = "g" then g=dx if db$="v" then v=dx if db$="e" then e=dx if db$="i" then i=dx goto @menu ] £prices home gosub @titlebar inverse:gosub @twoeighteen:print"Prices":normal print chr$(10) print"cocaine:","$"c print"heroin:","$"h print"acid:","$"a print"weed:","$"z print"speed:","$"s print"ludes:","$"l print"wallet:","$"w gosub @wait goto @menu £inventory home gosub @titlebar inverse:gosub @twosixteen :print"Trenchcoat":normal print chr$(10) print"cocaine:",m print"heroin:",n print"acid:",o print"weed:",u print"speed:",t print"ludes:",q print"free space:",f gosub @wait goto @menu £buy home gosub @titlebar inverse:gosub @twonineteen: print"Buy":normal print chr$(10) print"What do you want to buy?" print chr$(10) print "(C)ocaine" print "(H)eroin" print "(A)cid" print "(W)eed" print "(S)peed" print "(L)udes" input "Enter Selection: ";x$ if x$="c" goto @cokebuy if x$="h" goto @herbuy if x$="a" goto @acidbuy if x$="w" goto @weedbuy if x$="s" goto @spdbuy if x$="l" goto @ludbuy goto @menu £sell home gosub @titlebar inverse: gosub @twoeighteen: print"Sell":normal print chr$(10) print "What would you like to sell?" print chr$(10) print "(C)ocaine" print "(H)eroin" print "(A)cid" print "(W)eed" print "(S)peed" print "(L)udes" £sellsel input "Enter Selection: (0 to cancel)";x$ if x$="c" goto @cokesell if x$="h" goto @hersell if x$="a" goto @acidsell if x$="w" goto @weedsell if x$="s" goto @spdsell if x$="l" goto @ludsell if x$="0" goto @menu print "Invalid Selection!" goto @sellsel £jet home gosub @titlebar gosub @jetalthere print chr$(10) print "(B)ronx" print "(G)hetto" print "(C)entral Park print "(M)anhattan" print "Coney (I)sland" print "Broo(K)lyn" print "(O)ops...stay!" input "Where to dude? ";x$ if x$="B" then y$ = "The Bronx" : GOTO @jetb {we can use strings} if x$="G" then y$ = "The Ghetto" : GOTO @jetb if x$="C" then y$ = "Central Park" : GOTO @jetb if x$="M" then y$ = "Manhattan" : goto @jetb if x$="I" then y$ = "Coney Island" : goto @jetb if x$="K" then y$ = "Brooklyn" : goto @jetb if x$="O" then goto @menu {if x$="COPTEST" then b = 5 : goto @police} goto @jet £jetb {input "event: ";ev testing/debug} if y$=p$ then goto @alreadythere {more advanced thatn Bronx only on TI} p$ = y$ {it's valid, copy it and move along} : y$ = "" goto @subway £loan home gosub @titlebar inverse : gosub @twosixteen:print "Loan Shark":normal print chr$(10) gosub @bronxcheck print "Your debt is: $";v print "You have: $";w print chr$(10) input "(R)epay, (B)orrow, (L)eave: ";X$ If X$ = "R" THEN goto @payme If X$ = "B" Then goto @borrow If X$ = "L" then goto @Menu goto @loan £bank home gosub @titlebar inverse : gosub @twofifteen: print"Bank O'Murica":normal print chr$(10) gosub @bronxcheck print "Your balance: $";e print "Your wallet: $";w print chr$(10) INPUT "(D)EPOSIT, (W)ITHDRAW, (L)EAVE: ";X$ if x$ = "d" then goto @deposit if x$ = "w" then goto @mymoney if x$ = "l" then goto @menu if x$ = eg$ then goto @egg goto @bank £cokebuy home gosub @titlebar inverse:gosub @twosixteen: print"Buy Cocaine":normal print chr$(10) j=int(w/c) {calculate how many we can buy} gosub @howmuchbuy m=m+k : w=w-(c*k) {when the subroutine sends us back when the purchase is valid} goto @menu £herbuy home gosub @titlebar inverse:gosub @twosixteen: print"Buy Heroin":normal print chr$(10) j=int(w/h) gosub @howmuchbuy n=n+k : w=w-(h*k) goto @menu £acidbuy home gosub @titlebar inverse:gosub @twoseventeen:print"Buy Acid":normal print chr$(10) j=int(w/a) gosub @howmuchbuy o=o+k : w=w-(a*k) goto @menu £weedbuy home gosub @titlebar inverse:gosub @twoseventeen: print"Buy Weed":normal print chr$(10) j=int(w/z) gosub @howmuchbuy u=u+k : w=w-(z*k) goto @menu £spdbuy home gosub @titlebar inverse:gosub @twoseventeen: print"Buy Speed":normal print chr$(10) j=int(w/s) gosub @howmuchbuy t=t+k : w=w-(s*k) goto @menu £ludbuy home gosub @titlebar inverse:gosub @twoseventeen: print"Buy Ludes":normal print chr$(10) j=int(w/l) gosub @howmuchbuy q=q+k : w=w-(l*k) goto @menu £cokesell home gosub @titlebar inverse:gosub @twofifteen:print"Sell Cocaine":normal print chr$(10) j=m {write amount to variable} gosub @howmuchsell {some buy logic} m=m-k {sub sends back here if valid, adjusts inventory} w=w+(c*k) {adds money to wallet} goto @menu £hersell home gosub @titlebar inverse:gosub @twoseventeen:print"Sell Heroin":normal print chr$(10) j=n gosub @howmuchsell n=n-k w=w+(h*k) goto @menu £acidsell home gosub @titlebar inverse:gosub @twoseventeen: print"Sell Acid":normal print chr$(10) j=o gosub @howmuchsell o=o-k w=w+(a*k) goto @menu £weedsell home gosub @titlebar inverse:gosub @twoseventeen:print"Sell Weed":normal print chr$(10) j=u gosub @howmuchsell u=u-k w=w+(z*k) goto @menu £spdsell home gosub @titlebar inverse:gosub @twosixteen:print"Sell Speed":normal print chr$(10) j=t gosub @howmuchsell t=t-k w=w+(s*k) goto @menu £ludsell home gosub @titlebar inverse:gosub @twosixteen:print"Sell Ludes":normal print chr$(10) j=q gosub @howmuchsell q=q-k w=w+(l*k) goto @menu £alreadythere home gosub @titlebar gosub @jetalthere print chr$(10) print "You're already in:" print " ";p$ gosub @timerc goto @jet £subway home gosub @daily {b=ev debugging code} V=int(V*1.1+.5) {loan calculation} E=int(E*1.06+.5) {savings calculation} gosub @titlebar inverse:gosub @twoeighteen:print"Subway":normal print chr$(10) if b=1 then goto @cheapludes if b=2 then goto @cheepweed if b=3 then goto @pigheroin if b=4 then goto @heroinbust if b=5 then goto @heroinbust if b=6 then goto @cokebust if b=7 then goto @cokebust if b=8 then goto @mugged if b=9 then goto @cops if b=10 then goto @cops if b=11 then goto @cops if b=12 then goto @gunbuy if b=13 then goto @gunbuy if b=14 then goto @dedweed if b=15 then goto @newcoat if b=16 then goto @dedguy if b=17 then goto @homeacid £nothinghappened £nothinghappens print chr$(10) {the only way you should wind up here is if nothing happens} print "Welcome to ";p$ {i hope} print chr$(10) gosub @timerc goto @menu £cheapludes print "Rival dealers are selling cheap ludes!" l=2 gosub @timerc goto @menu £cheepweed print "Weed prices have bottomed-out!" z=122 gosub @timerc goto @menu £pigheroin print "Pigs are selling cheap heroin" print "from last week's raid!" h=int((rnd(9)*1150)+850.5) gosub @timerc goto @menu £heroinbust print "Addicts are buying heroin" print "at outrageous prices!" h=int((rnd(9)*25000)+18000.5) gosub @timerc goto @menu £cokebust print "Pigs made a big coke bust!" print "Prices are outrageous!!!!" c=int((rnd(9)*60000)+80000.5) {the infamous line 930} gosub @timerc goto @menu £mugged print "You got mugged!" print chr$(10) j=int(w/3) j=int(j*2) k=int(w-j) print "You lost $";k w=j gosub @timerc gosub @menu £cops k=m+n+u+o+t+p {cops only active when inventory > 50} [ my improved revisions will likely add some additional conditions on how/when we run cops ] if k<50 then goto @nothinghappened if b=9 then b = 2 if b=10 then b=4 if b=11 then b=5 print "It's the cops!" print chr$(10) print "Officer Hardass and ";B-1;" of his" print "deputies are after you!" print gosub @timerc goto @police £police home gosub @titlebar gosub @chase print print print "View (G)uns" print "View (D)amage" print "(N)umber of pigs" print "(R)un" print "(F)ight" print input "What do you want to do? ";x$ if x$="G" goto @pgun if x$ = "D" goto @damage if x$ = "N" goto @ncops if x$ = "R" goto @run if X$="F" goto @fight goto @police £pgun home gosub @titlebar gosub @chase print print print "You have ";g;" guns. print gosub @wait goto @police £damage home gosub @titlebar gosub @chase print print print "Your current damage is ";bb;"." print print "50 and you die!" print gosub @wait goto @police £ncops home gosub @titlebar gosub @chase print print print "There are ";b;" pigs still chasing you!" print print gosub @wait goto @police £run home gosub @titlebar gosub @chase print print print "RUNNING..." gosub @timera if k = 0 then print "You lost them in an alley!" : goto @loserun print "You can't shake them!" print gosub @wait goto @police £loserun print gosub @wait goto @menu £fight if g<=0 then print : print : print "YOU DON'T HAVE ANY GUNS!" : gosub @wait : goto @police home gosub @titlebar gosub @chase print print "You shoot!" gosub @timera If K=0 THEN GOTO @miss print "You got one!" : b = b-1 : goto @next £miss print "You missed!" £next print print If b <= 0 THEN goto @allgone gosub @timerb print "They're firing at you!" gosub @timera if k=0 then goto @theymiss print "You've been hit!" bb=bb+3 if bb >= 50 goto @ded goto @nexta £theymiss print "They missed!" £nexta gosub @wait goto @police £ded print print "You've been killed!" gosub @wait goto @endgame £allgone print "You killed all of them!" print gosub @timera j=int(((rnd(7)*1250)+750)+.5) w=w+j print "You found $";j;" on officer Hardass'" print "carcass!" if w>=1200 then goto @doctor goto @menu £doctor gosub @timerc print print "Will you pay $1000 for a doctor" input "to sew you up? (Y/N)";x$ if X$ <> "Y" then goto @menu w=w-1000 bb=0 £gunbuy if w < 500 THEN goto @nothinghappened gosub @freespace if f < 5 THEN goto @nothinghappened j=int((rnd(4)*2)+.5) if j = 0 then y$ = "Baretta" if j = 1 then y$ = "Saturday Night Special" if j = 2 then y$ = ".44 Magnum" print "Will you buy a ";y$ input "for $400? (Y/N)";x$ if x$ <> "Y" then goto @menu g = g+1 w = w-400 {i = i-5} goto @menu £dedweed {don't smoke the weed} print "There's some weed here that smells" print "like good stuff!!" print chr$(10) input "Will you smoke it? (Y/N)";X$ If X$ = "Y" THEN GOTO @weedend goto@menu £newcoat if w<300 then goto @nothinghappens {only if you can afford it} print "Will you buy a new trenchcoat" input "with more pockets for $200? (Y/N)";X$ if X$ <> "Y" then goto @menu i=i+10 w=w-200 goto @menu £dedguy gosub @freespace If f<8 THEN goto @nothinghappens {only if you have enough freespace} j=int((rnd(3)*7)+1.5) k=int(rnd(3)*5+.5) if k=0 THEN q=q+j : y$ = "Ludes" if k=1 THEN t=t+j : y$ = "Speed" if k=2 THEN u=u+j : y$ = "Weed" if k=3 THEN o=o+j : y$ = "Acid" if k=4 THEN n=n+j : y$ = "Heroin" if k=5 THEN m=m+j : y$ = "Cocaine" print "You found ";j;" units of" print " ";y$ print "on a dead dude in the subway!" print chr$(10) gosub @timerc goto @menu £homeacid print "The market has been flooded" print "with cheap home-made acid!" a=int((rnd(4)*550)+250.5) gosub @timerc goto @menu £payme INPUT "Repay how much? ";k IF k>w THEN PRINT:PRINT "YOU DON'T HAVE THAT MUCH!" : GOSUB @timerb : GOTO @LOAN IF k>v THEN PRINT:PRINT "YOU DON'T OWE THAT MUCH!" : GOSUB @timerb : GOTO @LOAN W=W-k v=v-k PRINT:PRINT "THANK YOU." GOSUB @timerc GOTO @MENU £borrow print chr$(10) Input "How much do you want? ";K print j=int((rnd(10)*10000)+5000) if K>14000 then print "He's not that stupid!" : gosub @timerc : goto @menu if K > J then print "He doesn't feel like it." : gosub @timerb : goto @menu v=v+k w=w+k print chr$(10) print "Here's your money." : PRINT CHR$(10) : PRINT "Remember, I break thumbs." gosub @timerc goto @menu £deposit print chr$(10) INPUT "How much? ";j If j>w then print "You don't have that much cash." : goto @deposit e=e+j w=w-j print chr$(10) Print "Thank you for your deposit." gosub @timerc goto @menu [ £egg print "You found the easter egg!" print print "$1,000,000 has been deposited in to your account." gosub @timerc goto @bank ] £mymoney print chr$(10) INPUT "How much? ";j If j>e then print "You don't have sufficient funds." : goto @mymoney e=e-j w=w+j print chr$(10) print "Thank you for your business." gosub @timerc goto @menu £instructions home vtab 2:htab10:print "Welcome to Drugwar//e":htab14:print"Version ";rv vtab 8:htab 3:print "Based on the classic TI-BASIC clone":htab2:print"of John E. Dell's 1984 IBM/TRS80 game." vtab12:htab6:print "Applesoft version by: Jay Moore" vtab19:input "Would you like instructions? (Y/N): ";X$ j =RND(-1 *(PEEK(78)+256*PEEK(79))) If X$ = "Y" THEN GOTO @inst GOTO @gamestart £inst home gosub @titlebar print chr$(10) print "This is a game of buying and selling." print "Your goal is to pay off your debt and" print "make as much money as possible in a one" print "month period. Prices fluctuate every dayand interest on your loan is calculated as well." print:print "If you deal too heavily, you'll attract the attention of the police." print CHR$(10) print "Commands are entered using the letter highlighted (L)ike (S)o. Y is yes and anything counts as no." gosub @wait goto @gamestart £weedend home gosub @titlebar inverse : gosub @twofifteen: print "SMOKE Weed" : NORMAL speed = 50 :print "You hallucinate on the wildest trip" print "of your life, stumble on to the tracks," print "and get creamed by a train!" print chr$(10) print chr$(10) htab 10:print "Just say NO to drugs!":speed=255 gosub @timerc gosub @timerb goto @ironicend £endgame home gosub @titlebar gosub @scorecalculate gosub @gmod print chr$(10) print "Your score on a scale of 1 to 100: ";k print chr$(10) input "Would you like to play again? (Y/N)";x$ if x$ = "Y" then goto @gamestart print "Thanks for playing." print "Remember, watch your back." print "Have a nice day!" clear end £ironicend home gosub @titlebar gosub @gmod print chr$(10) speed = 50 : print "You died from smoking weed." print chr$(10) print chr$(10) gosub @timerc: print"See? Games are totally fake." : speed = 255 print chr$(10) input "Would you like to play again? ";x$ if x$= "Y" THEN GOTO @GAMESTART clear end