master
Jay 6 years ago
parent 492840bcc3
commit 01decde2af

@ -1,5 +1,5 @@
[ [
Drugwar //e beta-3 Drugwar //e beta-4
(c) 2018 Jay Moore (c) 2018 Jay Moore
Licensed under GPLv3 Licensed under GPLv3
] ]
@ -12,14 +12,14 @@ Licensed under GPLv3
input "Press enter to continue.";x$ input "Press enter to continue.";x$
return return
£howmuchbuy {some common purchase code} £howmuchbuy {some common purchase code}
print "You can afford ";j% print "You can afford ";j
print "You can carry ";fs% print "You can carry ";fs
print chr$(10) print chr$(10)
input "How many? (Enter 0 to return to menu.)";k% input "How many? (Enter 0 to return to menu.)";k
gosub @nobuysell gosub @nobuysell
return return
£howmuchsell {common sell code} £howmuchsell {common sell code}
print "You can sell: ";j% print "You can sell: ";j
print chr$(10) print chr$(10)
[ [
I'm using this to test how some of the logic might work for buying I'm using this to test how some of the logic might work for buying
@ -32,98 +32,98 @@ Checking valid freespace for buying can be put here too. But
lines that reference a specific drug are still in normal code. lines that reference a specific drug are still in normal code.
] ]
£howmanysell £howmanysell
input "How many? (Enter 0 to return to menu.)";k% input "How many? (Enter 0 to return to menu.)";k
If k%>j% then print "You don't have that many!" : goto @howmanysell {this should work according to my testing} If k>j then print "You don't have that many!" : goto @howmanysell {this should work according to my testing}
gosub @nobuysell gosub @nobuysell
return return
£nobuysell {I'll be reusing this a lot, so let's subroutine it.} £nobuysell {I'll be reusing this a lot, so let's subroutine it.}
if K%=0 goto @menu if K=0 goto @menu
return return
£statusbar £statusbar
inverse:print "DAY: ";D%,P$:normal inverse:print "DAY: ";D,P$:normal
print chr$(10) print chr$(10)
return return
£freespace {I'll probably call this from more than the menu} £freespace {I'll probably call this from more than the menu}
fs%=in%-((ci%+hi%+ai%+wi%+si%+li%)+(gn%*5)) fs=in-((ci+hi+ai+wi+si+li)+(gn*5))
return return
£daily {randomizes drug prices, adds a day, calculates interests, checks day number} £daily {randomizes drug prices, adds a day, calculates interests, checks day number}
c%=rnd(1)*12000+16000 c=int(rnd(1)*12000+16000)
h%=rnd(1)*7000+5000 h=int(rnd(1)*7000+5000)
a%=(rnd(1)*34+10)*100 a=int((rnd(1)*34+10)*100)
w%=(rnd(1)*42+33)*10 w=int((rnd(1)*42+33)*10)
s%=(rnd(1)*15+7)*10 s=int((rnd(1)*15+7)*10)
l%=(rnd(1)*4+1)*10 l=int((rnd(1)*4+1)*10)
b%=rnd(1)*20 b=int(rnd(1)*20)
d%=d%+1 d=d+1
ls%=ls%*1.1 ls=ls*1.1
sa%=sa%*1.06 sa=sa*1.06
£checkday {so I can check the day by itself} £checkday {so I can check the day by itself}
if D% >= 31 GOTO @endgame if D >= 31 GOTO @endgame
return return
£subwayevents £subwayevents
if b%=1 then goto @cheapludes if b=1 then goto @cheapludes
if b%=2 then goto @cheepweed if b=2 then goto @cheepweed
if b%=3 then goto @pigheroin if b=3 then goto @pigheroin
if b%=4 then goto @heroinbust if b=4 then goto @heroinbust
if b%=5 then goto @heroinbust if b=5 then goto @heroinbust
if b%=6 then goto @cokebust if b=6 then goto @cokebust
if b%=7 then goto @cokebust if b=7 then goto @cokebust
if b%=8 then goto @mugged if b=8 then goto @mugged
if b%=9 then goto @cops if b=9 then goto @cops
if b%=10 then goto @cops if b=10 then goto @cops
if b%=11 then goto @cops if b=11 then goto @cops
if b%=12 then goto @gunbuy if b=12 then goto @gunbuy
if b%=13 then goto @gunbuy if b=13 then goto @gunbuy
if b%=14 then goto @dedweed if b=14 then goto @dedweed
if b%=15 then goto @newcoat if b=15 then goto @newcoat
if b%=16 then goto @dedguy if b=16 then goto @dedguy
if b%=17 then goto @homeacid if b=17 then goto @homeacid
return return
£cheapludes £cheapludes
print "Rival dealers are selling cheap ludes!" print "Rival dealers are selling cheap ludes!"
l%=2 l=2
gosub @wait gosub @wait
goto @menu goto @menu
£cheepweed £cheepweed
print "Weed prices have bottomed-out!" print "Weed prices have bottomed-out!"
w%=122 w=122
gosub @wait gosub @wait
goto @menu goto @menu
£pigheroin £pigheroin
print "Pigs are selling cheap heroin" print "Pigs are selling cheap heroin"
print "from last week's raid!" print "from last week's raid!"
h%=(rnd(1)*1150)+850 h=int((rnd(1)*1150)+850)
gosub @wait gosub @wait
goto @menu goto @menu
£heroinbust £heroinbust
print "Addicts are buying heroin" print "Addicts are buying heroin"
print "at outrageous prices!" print "at outrageous prices!"
h%=(rnd(1)*25000)+18000 h=int((rnd(1)*25000)+18000)
gosub @wait gosub @wait
goto @menu goto @menu
£cokebust £cokebust
print "Pigs made a big coke bust!" print "Pigs made a big coke bust!"
print "Prices are outrageous!!!!" print "Prices are outrageous!!!!"
c%=rnd(1)*60000)+80000 c=int(rnd(1)*60000)+80000)
gosub @wait gosub @wait
goto @menu goto @menu
£mugged £mugged
print "You got mugged!" print "You got mugged!"
print chr$(10) print chr$(10)
ms%=wa%/3 ms=wa/3
ms%=ms%*2 ms=ms*2
ml%=wa%-ms% ml=wa-ms
print "You lost $";ml% print "You lost $";ml
wa%=ms% wa=ms
gosub @wait gosub @wait
gosub @menu gosub @menu
£cops £cops
we%=C%+H%+W%+A%+S%+L% we=C+H+W+A+S+L
[ [
my improved revisions will likely add some additional my improved revisions will likely add some additional
conditions on how/when we run cops conditions on how/when we run cops
] ]
if we%<50 then return {no return since last gosub means this should work} if we<50 then return {no return since last gosub means this should work}
print "It's the cops!" print "It's the cops!"
print chr$(10) print chr$(10)
print "Just kidding!" print "Just kidding!"
@ -131,19 +131,19 @@ conditions on how/when we run cops
gosub @wait gosub @wait
goto @menu {goto @police} goto @menu {goto @police}
£gunbuy £gunbuy
if wa% < 500 THEN return if wa < 500 THEN return
gosub @freespace gosub @freespace
if fs% < 5 THEN return if fs < 5 THEN return
gx%=int(rnd(1)*2) gx=int(rnd(1)*2)
if gx% = 0 then ax$ = "Baretta" if gx = 0 then ax$ = "Baretta"
if gx% = 1 then ax$ = "Saturday Night Special" if gx = 1 then ax$ = "Saturday Night Special"
if gx% = 2 then ax$ = ".44 Magnum" if gx = 2 then ax$ = ".44 Magnum"
print "Will you buy a ";ax$ print "Will you buy a ";ax$
input "for $400? (Y/N)";re$ input "for $400? (Y/N)";re$
if re$ <> "Y" then goto @menu if re$ <> "Y" then goto @menu
gn% = gn%+1 gn = gn+1
wa% = wa%-400 wa = wa-400
fs% = fs%-5 fs = fs-5
goto @menu goto @menu
£dedweed £dedweed
print "There's some weed here that smells" print "There's some weed here that smells"
@ -153,24 +153,24 @@ conditions on how/when we run cops
If X$ = "Y" THEN GOTO @weedend If X$ = "Y" THEN GOTO @weedend
return return
£newcoat £newcoat
if wa%<300 then return if wa<300 then return
print "Will you buy a new trenchcoat" print "Will you buy a new trenchcoat"
input "with more pockets for $200? (Y/N)";X$ input "with more pockets for $200? (Y/N)";X$
if X$ <> "Y" then goto @menu if X$ <> "Y" then goto @menu
in%=in%+10 in=in+10
wa%=wa%-200 wa=wa-200
goto @menu goto @menu
£dedguy £dedguy
If fs%<8 THEN return If fs<8 THEN return
dg%=(rnd(1)*7)+1 dg=int((rnd(1)*7)+1)
xg%=rnd(1)*5 xg=int(rnd(1)*5)
if xg%=0 THEN li%=li%+dg% : ss$ = "Ludes" if xg=0 THEN li=li+dg : ss$ = "Ludes"
if xg%=1 THEN si%=si%+dg% : ss$ = "Speed" if xg=1 THEN si=si+dg : ss$ = "Speed"
if xg%=2 THEN wi%=wi%+dg% : ss$ = "Weed" if xg=2 THEN wi=wi+dg : ss$ = "Weed"
if xg%=3 THEN ai%=ai%+dg% : ss$ = "Acid" if xg=3 THEN ai=ai+dg : ss$ = "Acid"
if xg%=4 THEN hi%=hi%+dg% : ss$ = "Heroin" if xg=4 THEN hi=hi+dg : ss$ = "Heroin"
if xg%=5 THEN ci%=ci%+dg% : ss$ = "Cocaine" if xg=5 THEN ci=ci+dg : ss$ = "Cocaine"
print "You found ";dg%;" units of" print "You found ";dg;" units of"
print " ";ss$ print " ";ss$
print "on a dead dude in the subway!" print "on a dead dude in the subway!"
print chr$(10) print chr$(10)
@ -179,7 +179,7 @@ conditions on how/when we run cops
£homeacid £homeacid
print "The market has been flooded" print "The market has been flooded"
print "with cheap home-made acid!" print "with cheap home-made acid!"
a%=(rnd(1)*550)+250 a=int((rnd(1)*550)+250)
gosub @wait gosub @wait
goto @menu goto @menu
@ -205,7 +205,7 @@ conditions on how/when we run cops
home home
gosub @titlebar gosub @titlebar
gosub @freespace {it might be more efficient to calculate freespace now} gosub @freespace {it might be more efficient to calculate freespace now}
inverse : print " Day:";D%;" ";ph$ : normal inverse : print " Day:";D;" ";ph$ : normal
print "(C)heck Prices" print "(C)heck Prices"
print "(I)nventory" print "(I)nventory"
print "(B)uy" print "(B)uy"
@ -228,13 +228,13 @@ conditions on how/when we run cops
gosub @titlebar {this is literally recycled from the price and gosub demo} gosub @titlebar {this is literally recycled from the price and gosub demo}
inverse:print" PRICES ":normal inverse:print" PRICES ":normal
print chr$(10) print chr$(10)
print"cocaine:","$"c% print"cocaine:","$"c
print"heroin:","$"h% print"heroin:","$"h
print"acid:","$"a% print"acid:","$"a
print"weed:","$"w% print"weed:","$"w
print"speed:","$"s% print"speed:","$"s
print"ludes:","$"l% print"ludes:","$"l
print"wallet:","$"wa% print"wallet:","$"wa
gosub @wait gosub @wait
goto @menu goto @menu
£inventory £inventory
@ -242,13 +242,13 @@ conditions on how/when we run cops
gosub @titlebar gosub @titlebar
inverse:print" INVENTORY ":normal inverse:print" INVENTORY ":normal
print chr$(10) print chr$(10)
print"cocaine:",ci% print"cocaine:",ci
print"heroin:",hi% print"heroin:",hi
print"acid:",ai% print"acid:",ai
print"weed:",wi% print"weed:",wi
print"speed:",si% print"speed:",si
print"ludes:",li% print"ludes:",li
print"free space:",fs% print"free space:",fs
gosub @wait gosub @wait
goto @menu goto @menu
£buy £buy
@ -285,66 +285,66 @@ works.
gosub @titlebar gosub @titlebar
inverse:print" BUY COCAINE ":normal inverse:print" BUY COCAINE ":normal
print chr$(10) print chr$(10)
j%=wa%/c% j=int(wa/c)
gosub @howmuchbuy gosub @howmuchbuy
if k%>fs% THEN inverse : print "You can't carry that much!" : normal : goto @cokebuy if k>fs THEN inverse : print "You can't carry that much!" : normal : goto @cokebuy
if k%<=j% then ci%=ci%+k% : wa%=wa%-(c%*k%) if k<=j then ci=ci+k : wa=wa-(c*k)
if k%>j% THEN inverse : print "You can't afford that much!" : normal : goto @cokebuy if k>j THEN inverse : print "You can't afford that much!" : normal : goto @cokebuy
goto @menu goto @menu
£herbuy £herbuy
home home
gosub @titlebar gosub @titlebar
inverse:print" BUY HEROIN ":normal inverse:print" BUY HEROIN ":normal
print chr$(10) print chr$(10)
j%=wa%/h% j=int(wa/h)
gosub @howmuchbuy gosub @howmuchbuy
if k%>fs% THEN inverse : print "You can't carry that much!" : normal : goto @herbuy if k>fs THEN inverse : print "You can't carry that much!" : normal : goto @herbuy
if k%<=j% then hi%=hi%+k% : wa%=wa%-(h%*k%) if k<=j then hi=hi+k : wa=wa-(h*k)
if k%>j% THEN inverse : print "You can't afford that much!" : normal : goto @herbuy if k>j THEN inverse : print "You can't afford that much!" : normal : goto @herbuy
goto @menu goto @menu
£acidbuy £acidbuy
home home
gosub @titlebar gosub @titlebar
inverse:print" BUY ACID ":normal inverse:print" BUY ACID ":normal
print chr$(10) print chr$(10)
j%=wa%/a% j=int(wa/a)
gosub @howmuchbuy gosub @howmuchbuy
if k%>fs% THEN inverse : print "You can't carry that much!" : normal : goto @acidbuy if k>fs THEN inverse : print "You can't carry that much!" : normal : goto @acidbuy
if k%<=j% THEN ai%=ai%+k% : wa%=wa%-(a%*k%) if k<=j THEN ai=ai+k : wa=wa-(a*k)
if k%>j% THEN inverse : print "You can't afford that much!" : normal : goto @acidbuy if k>j THEN inverse : print "You can't afford that much!" : normal : goto @acidbuy
goto @menu goto @menu
£weedbuy £weedbuy
home home
gosub @titlebar gosub @titlebar
inverse:print" BUY WEED ":normal inverse:print" BUY WEED ":normal
print chr$(10) print chr$(10)
j%=wa%/w% j=int(wa/w)
gosub @howmuchbuy gosub @howmuchbuy
if k%>fs% THEN inverse : print "You can't carry that much!" : normal : goto @weedbuy if k>fs THEN inverse : print "You can't carry that much!" : normal : goto @weedbuy
if k%<=j% THEN wi%=wi%+k% : wa%=wa%-(w%*k%) if k<=j THEN wi=wi+k : wa=wa-(w*k)
if k%>j% THEN inverse : print "You can't afford that much!" : normal : goto @weedbuy if k>j THEN inverse : print "You can't afford that much!" : normal : goto @weedbuy
goto @menu goto @menu
£spdbuy £spdbuy
home home
gosub @titlebar gosub @titlebar
inverse:print" BUY SPEED ":normal inverse:print" BUY SPEED ":normal
print chr$(10) print chr$(10)
j%=wa%/s% j=int(wa/s)
gosub @howmuchbuy gosub @howmuchbuy
if k%>fs% THEN inverse : print "You can't carry that much!" : normal : goto @spdbuy if k>fs THEN inverse : print "You can't carry that much!" : normal : goto @spdbuy
if k%<=j% THEN si%=si%+k% : wa%=wa%-(s%*k%) if k<=j THEN si=si+k : wa=wa-(s*k)
if k%>j% THEN inverse : print "You can't afford that much!" : normal : goto @spdbuy if k>j THEN inverse : print "You can't afford that much!" : normal : goto @spdbuy
goto @menu goto @menu
£ludbuy £ludbuy
home home
gosub @titlebar gosub @titlebar
inverse:print" BUY LUDES ":normal inverse:print" BUY LUDES ":normal
print chr$(10) print chr$(10)
j%=wa%/l% j=int(wa/l)
gosub @howmuchbuy gosub @howmuchbuy
if k%>fs% THEN inverse : print "You can't carry that much!" : normal : goto @ludbuy if k>fs THEN inverse : print "You can't carry that much!" : normal : goto @ludbuy
if k%<=j% THEN li%=li%+k% : wa%=wa%-(l%*k%) if k<=j THEN li=li+k : wa=wa-(l*k)
if k%>j% THEN inverse : print "You can't afford that much!" : normal : goto @ludbuy if k>j THEN inverse : print "You can't afford that much!" : normal : goto @ludbuy
goto @menu goto @menu
£sell £sell
home home
@ -376,10 +376,10 @@ works.
gosub @titlebar gosub @titlebar
inverse:print" SELL COCAINE ":normal inverse:print" SELL COCAINE ":normal
print chr$(10) print chr$(10)
j%=ci% j=ci
gosub @howmuchsell gosub @howmuchsell
ci%=ci%-k% ci=ci-k
wa%=wa%+(c%*k%) wa=wa+(c*k)
goto @menu goto @menu
£hersell £hersell
@ -387,10 +387,10 @@ works.
gosub @titlebar gosub @titlebar
inverse:print" SELL HEROIN ":normal inverse:print" SELL HEROIN ":normal
print chr$(10) print chr$(10)
j%=hi% j=hi
gosub @howmuchsell gosub @howmuchsell
hi%=hi%-k% hi=hi-k
wa%=wa%+(h%*k%) wa=wa+(h*k)
goto @menu goto @menu
£acidsell £acidsell
@ -398,10 +398,10 @@ works.
gosub @titlebar gosub @titlebar
inverse:print" SELL ACID ":normal inverse:print" SELL ACID ":normal
print chr$(10) print chr$(10)
j%=ai% j=ai
gosub @howmuchsell gosub @howmuchsell
ai%=ai%-k% ai=ai-k
wa%=wa%+(a%*k%) wa=wa+(a*k)
goto @menu goto @menu
£weedsell £weedsell
@ -409,10 +409,10 @@ works.
gosub @titlebar gosub @titlebar
inverse:print" SELL WEED ":normal inverse:print" SELL WEED ":normal
print chr$(10) print chr$(10)
j%=wi% j=wi
gosub @howmuchsell gosub @howmuchsell
wi%=wi%-k% wi=wi-k
wa%=wa%+(w%*k%) wa=wa+(w*k)
goto @menu goto @menu
£spdsell £spdsell
@ -420,10 +420,10 @@ works.
gosub @titlebar gosub @titlebar
inverse:print" SELL SPEED ":normal inverse:print" SELL SPEED ":normal
print chr$(10) print chr$(10)
j%=si% j=si
gosub @howmuchsell gosub @howmuchsell
si%=si%-k% si=si-k
wa%=wa%+(s%*k%) wa=wa+(s*k)
goto @menu goto @menu
£ludsell £ludsell
@ -431,10 +431,10 @@ works.
gosub @titlebar gosub @titlebar
inverse:print" SELL COCAINE ":normal inverse:print" SELL COCAINE ":normal
print chr$(10) print chr$(10)
j%=li% j=li
gosub @howmuchsell gosub @howmuchsell
li%=li%-k% li=li-k
wa%=wa%+(l%*k%) wa=wa+(l*k)
goto @menu goto @menu
£jet £jet
home home
@ -499,20 +499,20 @@ works.
input "I don't understand you. Y or N only. ";Q$ input "I don't understand you. Y or N only. ";Q$
goto @inserrorhandler goto @inserrorhandler
£gamestart {set wallet, debt, location, inventory space, zero out inventory} £gamestart {set wallet, debt, location, inventory space, zero out inventory}
wa%=2000 wa=2000
sa%=0 sa=0
ls%=5000 ls=5000
d%=0 {daily subroutine adds a day} d=0 {daily subroutine adds a day}
ph$="The Bronx" ph$="The Bronx"
gn%=0 gn=0
dp%=0 dp=0
in%=100 in=100
ci%=0 ci=0
hi%=0 hi=0
ai%=0 ai=0
wi%=0 wi=0
si%=0 si=0
li%=0 li=0
gosub @daily {the only time we'll call this outside of the subway} gosub @daily {the only time we'll call this outside of the subway}
goto @menu {the real start of the game} goto @menu {the real start of the game}
£inst £inst

Loading…
Cancel
Save