I have this on my Palm Pilot and thought I might make a KiX version. It is a little cut down (I am getting lazy in my old age), but it plays.
I copied some of the source code from the Palm version too, thanks Matthew Lee.
Basically, you are a drug dealer... you Jet around selling and buying dope. The prices vary and you want to make at least $1M in 30 days.
I haven't got around to the cops yet, so you have to finish the game the slow way. Each time you Jet, you lose a day - only have 30 days.
You can upgrade your coat to hold more drugs and don't forget to pay back the Loan Shark or else he'll send his thugs after you.
code:
break on
$=setascii("on")
srnd(val(substr("@time",7,2)))cls
color w+/n
"DopeWars Version 1.0" ?
"by cj" ? ?
color w/n
"Based on Drug Wars by John E. Dell"
at(21,0)
"Press Any Key"
?
;get$
; Setup vars
$location=""
$time=30
dim $qty[9]
dim $drugs[9]
$i=1 do $qty[$i]=0 $i=$i+1 until $i=9 ; reset quantities to 0
$startcash=2000
$cash=$startcash
$debt=5500
$savings=0
$coat=0
$coatmax=100
$hard=5 ; difficulty level, max=10
$bLoaned=0
$jet=0
$location="Bronx"
gosub randomise
goto main
:jet
cls
color w/n
box(1, 1, 20, 21, single)
at( 3, 3) "Where to, dude?"
at( 6, 4) "Bron" color w+/n "x"
at( 7, 4) "G" color w/n "hetto"
at( 8, 4) color w+/n "C" color w/n "entral Park"
at( 9, 4) color w+/n "M" color w/n "anhattan"
at(10, 4) "Coney " color w+/n "I" color w/n "sland"
at(11, 4) color w+/n "B" color w/n "rooklyn"
at(14, 3) "Current Location"
at(15, 3) color w+/n "$location" color w/n
at(18, 3) "ESC = Cancel trip"
at(23,1)
get $where
if $where=chr(224) get $where endif
$where=ucase($where)
select
case $where="X" $location="Bronx"
case $where="G" $location="Ghetto"
case $where="C" $location="Central Park"
case $where="M" $location="Manhattan"
case $where="I" $location="Coney Island"
case $where="B" $location="Brooklyn"
case $where=chr(27) return
case 1 goto jet
endselect
return
:screen
cls
color w/n
; draw drugs box
box(1, 1, 20, 39, single)
box(3, 3, 12, 25, single)
box(3, 9, 12, 17, single)
at( 3, 9) chr(194)
at(12, 9) chr(193)
at( 3, 17) chr(194)
at(12, 17) chr(193)
; update static info
at( 4, 10) "Acid"
at( 5, 10) "Cocaine"
at( 6, 10) "Ludes"
at( 7, 10) "PCP"
at( 8, 10) "Heroin"
at( 9, 10) "Weed"
at(10, 10) "Shrooms"
at(11, 10) "Speed"
at( 4, 28) "Cash"
at( 8, 28) "Debt"
at(12, 28) "Savings"
at(16, 28) "Coat"
at(16, 3) color w+/n "S" color w/n "ell " color w+/n "J" color w/n "et " color w+/n "B" color w/n "uy"
at(18, 3) color w+/n "Q" color w/n "uit"
; update dynamic info
at(14, 3) "Time remaining: "color w+/n "$time" color w/n " days"
at( 2, 7) color w+/n "$location "
; display current quantities
$i=1 do at($i+3, 4) $qty[$i] at($i+3, 18) " " at($i+3, 18) $t=$drugs[$i] if $t=0 " -" else "$$$t" endif $i=$i+1 until $i=9
if $jet=1
gosub randomevent
$i=1 do at($i+3, 4) $qty[$i] at($i+3, 18) " " at($i+3, 18) $t=$drugs[$i] if $t=0 " -" else "$$$t" endif $i=$i+1 until $i=9
endif
color w+/n
at( 5, 28) "$$$cash "
at( 9, 28) "$$$debt "
at(13, 28) "$$$savings "
at(17, 28) "$coat/$coatmax"
color w/n
if ($jet=1) and ($location="Bronx") ; the Bank and Loan Shark is at the Bronx
gosub loanshark
gosub bank
endif
:getwhat ; -----------------------------------------------------------------------------------------<<<<<<<<
get $what
$what=ucase($what)
select
case $what="S" ; sell
gosub highlight
at(16, 3) " "
at(16, 3) "Select drug to sell :"
gosub choosedrug
if $a<>"Q"
gosub sellcalc
$jet=0
endif
case $what="B" ; buy
gosub highlight
at(16, 3) " "
at(16, 3) "Select drug to buy :"
gosub choosedrug
if $a<>"Q"
gosub buycalc
$jet=0
endif
case $what="J" ; Jet to new location
$was=$location
$jet=0
gosub jet
if $location<>$was ; you have chosen a new location
$jet=1
$bLoaned=0
if $time=1 goto gameover endif ; time's up
$time=$time-1 ; a day has passed
gosub randomise ; the prices have changed
gosub interest ; you have earned interest
endif
case $what="Q" at(23,1) quit
case 1 goto getwhat
endselect
return
:randomevent
$i=0
do
$eventnum=rnd(16)+1 ; select event at random
select
case $eventnum=1 $message="The cops just did a big Cocaine bust! Prices are sky-high!" $affected=2 $affect="*10"
case $eventnum=2 $message="The cops just did a big Ludes bust! Prices are sky-high!" $affected=3 $affect="*10"
case $eventnum=3 $message="The cops just did a big PCP bust! Prices are sky-high!" $affected=4 $affect="*10"
case $eventnum=4 $message="The cops just did a big Heroin bust! Prices are sky-high!" $affected=5 $affect="*10"
case $eventnum=5 $message="The cops just did a big Weed bust! Prices are sky-high!" $affected=6 $affect="*10"
case $eventnum=6 $message="The cops just did a big Speed bust! Prices are sky-high!" $affected=8 $affect="*10"
case $eventnum=7 $message=" The market has been flooded with cheap home-made Acid!" $affected=1 $affect="/5"
case $eventnum=8 $message=" Addicts are buying Cocaine at outrageous prices!" $affected=2 $affect="/5"
case $eventnum=9 $message=" A gang raided a local pharmacy and are selling cheap Ludes!" $affected=3 $affect="/5"
case $eventnum=10 $message=" Addicts are buying PCP at outrageous prices!" $affected=4 $affect="/5"
case $eventnum=11 $message=" Addicts are buying Heroin at outrageous prices!" $affected=5 $affect="/5"
case $eventnum=12 $message="Columbians dusted the Coast Guard, weed prices bottomed out!" $affected=6 $affect="/5"
case $eventnum=13 $message=" Addicts are buying Shrooms at outrageous prices!" $affected=7 $affect="/5"
case $eventnum=14 $message=" Addicts are buying Speed at outrageous prices!" $affected=8 $affect="/5"
case $eventnum=15 $message="You found some Acid on a dead dude in the subway!" $affected=1 $affect="" $extra=rnd(10)
case $eventnum=16 $message="You found some Cocaine on a dead dude in the subway!" $affected=2 $affect="" $extra=rnd(10)
case $eventnum=17 $message="You found some PCP on a dead dude in the subway!" $affected=4 $affect="" $extra=rnd(10)
endselect
if len($affect)>0
$amount=$drugs[$affected]
if $amount<>0 ; if the drug exists here
$exec="$$newamount=($amount" + "$affect)"
$=execute($exec)
$drugs[$affected]=$newamount
else
goto eventdone
endif
else
$space=$coatmax-$coat if $extra>$space $extra=$space endif
$amount=$qty[$affected]
$qty[$affected]=$amount+$extra
$coat=$coat+$extra
endif
color w+/n
at(22,1) "$message" ; write message
get$ ; get key
at(22,1) $j=0 do " " $j=$j+1 until $j=len($message) ; clear message
$i=$i+1
until $i=1 ; <-- runs this many times
if rnd(10)=1 ; 1 in 10 of coat upgrade
at(22,1) "Do you want to upgrade your coat for $100?"
get $a
if $a="y"
if $cash<100
at(22,1) " "
at(22,1) "You do not have enough cash."
get$
else
$cash=$cash-100
$coatmax=$coatmax+100
endif
at(22,1) " "
endif
endif
:eventdone
return
:loanshark
at(16, 3) " " at(16, 3) "Vist the Loan Shark?"
at(18, 3) " " at(18, 3) color w+/n "Y" color w/n "es " color w+/n "N" color w/n "o " color w+/n "Q" color w/n "uit"
get $a
if $a="q" at(23,1) quit endif
if $a="y"
:loansharkmenu
at(16, 3) " " at(16, 3) if ($debt>0) and ($cash>0) color w+/n "R" color w/n "epay " endif
if $bLoaned=0 color w+/n "B" color w/n "orrow " endif color w+/n "D" color w/n "one"
at(18, 3) " " at(18, 3) color w+/n "Q" color w/n "uit"
get $a
if $a="q" at(23,1) quit endif if $a="d" goto loansharkdone endif
if $a="b" ; borrow
if $bLoaned=1 at(16, 3) " " at(16, 3) "Borrowed enough today" get$ goto loansharkmenu endif
:loansharkborrow
at(16, 3) " " at(16, 3) "How much? $$" gets $newloan $newloan=val($newloan)
if $newloan>$cash*30 at(16, 3) " " at(16, 3) "Too much, max $$" $cash*30 " " get$ goto loansharkborrow endif
$cash=$cash+$newloan $debt=$debt+$newloan $bLoaned=1 color w+/n at( 5, 28) "$$$cash " at( 9, 28) "$$$debt " color w/n
endif
if $a="r" ; repay
:loansharkrepay
at(16, 3) " " at(16, 3) "How much? $$" gets $repay $repay=val($repay)
if $repay>$cash at(16, 3) " " at(16, 3) "You don't have enough $$" get$ goto loansharkrepay endif
$cash=$cash-$repay $debt=$debt-$repay if $debt<1 $debt=0 endif $bLoaned=0 color w+/n at( 5, 28) "$$$cash " at( 9, 28) "$$$debt " color w/n
endif
endif
:loansharkdone
at(16, 3) " " at(16, 3) color w+/n "S" color w/n "ell " color w+/n "J" color w/n "et " color w+/n "B" color w/n "uy"
return
:bank
at(16, 3) " " at(16, 3) "Vist the Bank?"
get $a
if $a="q" at(23,1) quit endif
if $a="y"
at(16, 3) " " at(16, 3) if $cash>0 color w/n "D" color w+/n "e" color w/n "posit " endif
if $savings>0 color w+/n "W" color w/n "ithdraw " endif color w+/n "D" color w/n "one"
at(18, 3) " " at(18, 3) color w+/n "Q" color w/n "uit"
get $a
if $a="q" at(23,1) quit endif if $a="d" goto bankdone endif
if $a="w" ; withdraw
:bankwithdraw
at(16, 3) " " at(16, 3) "How much? $$" gets $withdraw $withdraw=val($withdraw)
if $withdraw>$savings at(16, 3) " " at(16, 3) "Too much, max $$$savings " get$ goto bankwithdraw endif
$cash=$cash+$withdraw $savings=$savings-$withdraw color w+/n at( 5, 28) "$$$cash " at(13, 28) "$$$savings " color w/n
endif
if $a="e" ; dEposit
:bankdeposit
at(16, 3) " " at(16, 3) "How much? $$" gets $deposit $deposit=val($deposit)
if $deposit>$cash at(16, 3) " " at(16, 3) "You don't have enough $$" get$ goto bankdeposit endif
$cash=$cash-$deposit $savings=$savings+$deposit color w+/n at( 5, 28) "$$$cash " at(13, 28) "$$$savings " color w/n endif
endif
:bankdone
at(16, 3) " " at(16, 3) color w+/n "S" color w/n "ell " color w+/n "J" color w/n "et " color w+/n "B" color w/n "uy"
return
:highlight ; only highlight if there are some for sale
$t=$drugs[1] if $t<>0 at( 4, 10) color w+/n "A" color w/n "cid" endif
$t=$drugs[2] if $t<>0 at( 5, 10) color w+/n "C" color w/n "ocaine" endif
$t=$drugs[3] if $t<>0 at( 6, 10) color w+/n "L" color w/n "udes" endif
$t=$drugs[4] if $t<>0 at( 7, 10) color w+/n "P" color w/n "CP" endif
$t=$drugs[5] if $t<>0 at( 8, 10) color w+/n "H" color w/n "eroin" endif
$t=$drugs[6] if $t<>0 at( 9, 10) color w+/n "W" color w/n "eed" endif
$t=$drugs[7] if $t<>0 at(10, 10) color w+/n "S" color w/n "hrooms" endif
$t=$drugs[8] if $t<>0 at(11, 10) "Spee" color w+/n "d" color w/n endif
return
:choosedrug
$a="" $c=0
do
get $a
select
case $a="A" $c=1
case $a="C" $c=2
case $a="L" $c=3
case $a="P" $c=4
case $a="H" $c=5
case $a="W" $c=6
case $a="S" $c=7
case $a="D" $c=8
case $a="Q" $c=0
case 1 $a=""
endselect
if $c<>0 $t=$drugs[$c] if $t=0 $a="" endif endif ; check that there is some
until $a<>""
return
:buycalc
; buying calculator
$a="" $h="" ; $c=drug number
do
at(18, 3) " "
at(18, 3) color w+/n "Q" color w/n "uit " color w+/n "M" color w/n "aximum"
at(16, 3) " "
at(16, 3) "Enter quantity :"
gets $h
select
case $h="M" ; maximum
$t=$drugs[$c] $max=$cash/$t
if $max>$coatmax $max=$coatmax endif
$space=$coatmax-$coat
if $max>$space $max=$space endif
$have=$qty[$c] $qty[$c]=$have+$max $coat=$coat+$max
$spent=$max*$t $cash=$cash-$spent
$a=" "
case $h="Q" ; quit buy
$a=" "
case 1 ; other amount
$h=val($h)
if $h<>0
$t=$drugs[$c]
$spent=$h*$t
if $spent<$cash
$space=$coatmax-$coat
if $h<$space
$have=$qty[$c] $qty[$c]=$have+$h
$coat=$coat+$h
$cash=$cash-$spent
$a=" "
else
at(16, 3) " "
at(16, 3) "Not enough coat space"
get$
endif
else
at(16, 3) " "
at(16, 3) "Not enough cash."
get$
endif
endif
endselect
until $a<>""
return
:sellcalc
; selling calculator
$a="" $h="" ; $c=drug number
do
$t=$qty[$c] ; $t=price of selected drug
if $t=0
at(16, 3) " "
at(16, 3) "You don't have any"
get$
goto selldone
else
at(18, 3) " "
at(18, 3) color w+/n "Q" color w/n "uit " color w+/n "M" color w/n "aximum"
at(16, 3) " "
at(16, 3) "Enter quantity :"
gets $h
select
case $h="M" ; maximum
$t=$drugs[$c]
$max=$qty[$c] ; $max=what you got
$cash=$cash+($t*$max)
$qty[$c]=0 $coat=$coat-$max
$a=" "
case $h="Q" ; quit buy
$a=" "
case 1 ; other amount
$h=val($h)
if $h<>0
$t=$drugs[$c]
$have=$qty[$c] ; $have=what you got
if $h<$have+1
$qty[$c]=$have-$h
$coat=$coat-$h
$cash=$cash+($t*$h)
$a=" "
else
at(16, 3) " "
at(16, 3) "You don't have enough"
get$
endif
endif
endselect
endif
until $a<>""
:selldone
return
:randomise
; set drugs prices
; some of this code is converted from the DopeWars Palm Pilot version C++ code by Matthew Lee
$drugs[1]=1000 +rnd(3500)
$drugs[2]=15000+rnd(15000)
$drugs[3]=10 +rnd(50)
$drugs[4]=1000 +rnd(2500)
$drugs[5]=5000 +rnd(9000)
$drugs[6]=300 +rnd(600)
$drugs[7]=600 +rnd(750)
$drugs[8]=70 +rnd(180)
$i=1
do
$drugs[rnd(7)]=0
$i=$i+1
until $i=$hard
return
:interest
; calculate interest on loans and bank
$savings=$savings+(($savings*625)/10000) ; 6.25%
$debt=$debt+(($debt*125)/1000) ; 12.5%
return
:drugs
color w/n
return
:gameover
cls
color w+/n
"DopeWars Version 1.0" ?
"by cj" ?
?
color w/n "Based on Drug Wars by John E. Dell" ?
?
?
"Game Over" ?
?
?
"How you did:"?
?
$total=$cash+$savings
"Total Cash: $$$total" ?
"Debt: $$$debt" ?
?
if $debt>0
"The Loan Shark's thugs broke your legs"
else
if $total>1000000
"Congradulations, you retired a millionaire in the Carribbean!"
else
if $total>$startcash
"Congradulations, you didn't do half bad!"
else
"You didn't make any money, better luck next time"
endif
endif
endif
? ?
at(23,1)
quit
:main
:again
gosub screen
goto again