rem Drugwar//e - Beta 9 rem Copyright 2018 Jay Moore rem Released under GPL v3 rem drugwar2e.sourceforge.io rem twitter: _nq4t goto @instructions {because we're sticking subroutines up here} £titlebar {this literally just draws the game title at the top of the screen} print ,"Drugwar//e", return £wait {ubiquitious "Press ENTER to continue} print chr$(10) input "Press enter to continue.";x$ return £timera for n = 1 to 500 next n return £timerb for n = 1 to 300 next n 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 £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 £checkday {so I can check the day by itself} if D >= 31 GOTO @endgame return £menu {main menu. everything should loop back here} home f=i-(m+n+o+u+t+q) {former sub-routine} gosub @titlebar inverse : print "Day:";D,p$, : normal print chr$(10) print "(C)heck Prices" print "(I)nventory" print "(B)uy" print "(S)ell" print "(J)et" print "See (L)oan shark" print "(V)isit Bank" input "Please make your selection: ";x$ if x$ = "C" goto @prices if x$ = "I" 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 goto @menu £prices home gosub @titlebar inverse: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:print" INVENTORY ":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: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 £cokebuy home gosub @titlebar inverse: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: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: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: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: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:print" BUY LUDES ":normal print chr$(10) j=int(w/l) gosub @howmuchbuy q=q+k : w=w-(l*k) goto @menu £sell home gosub @titlebar inverse: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 £cokesell home gosub @titlebar inverse:print" SELL COCAINE ":normal print chr$(10) j=m {write amount to variable} gosub @howmuchsell 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: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: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: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: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:print" SELL LUDES ":normal print chr$(10) j=q gosub @howmuchsell q=q-k w=w+(l*k) goto @menu £jet home gosub @titlebar inverse:print" JET ":normal print chr$(10) print "(B)ronx" print "(G)hetto" print "(C)entral Park print "(M)anhatten" 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$ = "Manhatten" : 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 if y$=p$ then goto @alreadythere {more advanced thatn Bronx only on TI} p$ = y$ {it's valid, copy it and move along} goto @subway £alreadythere home gosub @titlebar inverse:print" JET ":normal print chr$(10) print "You're already in:" print " ";p$ gosub @wait goto @jet £subway home gosub @daily V=int(V*1.1+.5) {loan calculation} E=int(E*1.06+.5) {savings calculation} gosub @titlebar inverse: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) input "Press ENTER to continue. ";X$ goto @menu £cheapludes print "Rival dealers are selling cheap ludes!" l=2 gosub @wait goto @menu £cheepweed print "Weed prices have bottomed-out!" z=122 gosub @wait goto @menu £pigheroin print "Pigs are selling cheap heroin" print "from last week's raid!" h=int((rnd(1)*1150)+850.5) gosub @wait goto @menu £heroinbust print "Addicts are buying heroin" print "at outrageous prices!" h=int((rnd(1)*25000)+18000.5) gosub @wait goto @menu £cokebust print "Pigs made a big coke bust!" print "Prices are outrageous!!!!" c=int((rnd(1)*60000)+80000.5) {the infamous line 930} gosub @wait 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 @wait 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 @wait goto @police £police home gosub @titlebar inverse:print" BEING CHASED!" :normal 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 inverse:print" BEING CHASED!" :normal print print print "You have ";g;" guns. print gosub @wait goto @police £damage home gosub @titlebar inverse:print" BEING CHASED!" :normal print print print "Your current damage is ";bb;"." print print "50 and you die!" print gosub @wait goto @police £ncops home gosub @titlebar inverse:print" BEING CHASED!" :normal print print print "There are ";b;" pigs still chasing you!" print print gosub @wait goto @police £run home gosub @titlebar inverse:print" BEING CHASED!" :normal print print print "RUNNING..." gosub @timera k=int(rnd(1)+.5) 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 inverse:print" BEING CHASED!" :normal print print "You shoot!" gosub @timera k = rnd(1) k = int(k+.5) 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 k = rnd(1) k = int(k+.5) 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(1)*1250)+750) w=w+j print "You found $";j;" on officer Hardass'" print "carcass!" if w>=1200 then goto @doctor gosub @wait goto @menu £doctor gosub @timera 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 f=int(i-(m+n+o+u+t+p)) if f < 5 THEN goto @nothinghappened j=int(rnd(1)*2) 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 = int(g+1) w = int(w-400) i = int(i-5) {I kept having problems calculating this with free space as guns * 5. gave up. put it here} 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 return {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=int(i+10) w=int(w-200) goto @menu £dedguy If f<8 THEN goto @nothinghappens {only if you have enough freespace} j=int((rnd(1)*7)+1.5) k=int(rnd(1)*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 @wait goto @menu £homeacid print "The market has been flooded" print "with cheap home-made acid!" a=int((rnd(1)*550)+250.5) gosub @wait goto @menu £notbronx print "you need to head to the bronx" print "to take care of this business." gosub @wait goto @menu £loan home gosub @titlebar inverse : print " LOAN SHARK ":normal print chr$(10) if p$ <> "THE BRONX" then goto @notbronx 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 £payme INPUT "Repay how much? ";k IF k>w THEN PRINT "YOU DON'T HAVE THAT MUCH!" : INPUT "PRESS ENTER TO CONTINUE. ";X$ : GOTO @LOAN IF k>v THEN PRINT "YOU DON'T OWE THAT MUCH!" : INPUT"PRESS ENTER TO CONTINE. ";X$ : GOTO @LOAN W=W-k v=v-k PRINT "THANK YOU." GOSUB @WAIT GOTO @MENU £borrow Input "How much do you want? ";K if K>5000 then print "He's not that stupid!" : goto @borrow v=v+k w=w+k print "Here's your money." : PRINT CHR$(10) : PRINT "Remember, I break thumbs." gosub @wait goto @menu £bank home gosub @titlebar inverse : print " BANK O'MURICA ":normal print chr$(10) if p$ <> "THE BRONX" then goto @notbronx 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 goto @bank £deposit 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 "Thank you for your deposit." gosub @wait goto @menu £mymoney INPUT "How much? ";j If j>e then print "You don't have sufficient funds." : goto @mymoney e=e-j w=w+j print "Thank you for your business." gosub @wait goto @menu £instructions home gosub @titlebar print chr$(10) print "Welcome to DRUGWAR//e Beta 9" print chr$(10) print chr$(10) input "Would you like instructions? (Y/N): ";X$ £inserrorhandler {I'm hoping this will prevent crashes} If X$ = "Y" THEN GOTO @inst GOTO @gamestart £gamestart {set wallet, debt, location, inventory space, zero out inventory} w=2000 e=0 v=5000 d=0 {daily subroutine adds a day} 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} £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 day" print "and interest on your loan is calculated" print "as well. If you deal too heavily, you'll" print "attract the attention of the police. print CHR$(10) print "Commands are usually the first letter" print "of what you want to do. Y = yes and" print "N = No." Input "Press ENTER to continue.";X$ goto @gamestart £weedend home gosub @titlebar inverse : print " SMOKE WEED " : NORMAL 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) print "Just say NO to drugs!" gosub @wait goto @ironicend £scorecalculate k=(w+e)-v if k<0 THEN k=0 : return k=sqr((k/31.5)+.5) k=int(k) if k>100 then k=100 return £endgame home gosub @titlebar gosub @scorecalculate inverse : print " GAME OVER " : NORMAL 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 @scorecalculate inverse : print " GAME OVER " : NORMAL print chr$(10) print "Your final score is: ";k print chr$(10) print "But you died from smoking weed? In a" print "game about dealing drugs? Buddy, no" print "score can redeem that stupidity." print chr$(10) input "Would you like to play again? ";x$ if x$= "Y" THEN GOTO @GAMESTART if x$= "N" THEN PRINT "I don't blame you." : end print "What? If you're that dumb, I'm leaving." clear end