
                 /*   sTAKE yOUR cREDITS v1.0 by dR fAUSTUS   */

  parse arg NODE
  signal on error
  signal on syntax
  signal on ioerr
  signal on break_C
  options results
  address value "AERexxControl"NODE

DT_NAME          = 100
DT_BYTESUPLOAD   = 117
DT_RATIOTYPE     = 106
DT_BYTEDOWNLOAD  = 118

getuser DT_NAME; uname=result

tr=transmit
se=sendstring
con=1
l=0
w=0

CLS='[H[J'

Start:

se CLS
showfile "Doors:sTAKE/title.ansi"
se '[0H[33m[1m'center('sTAKE yOUR cREDITS v1.0 by dR fAUSTUS',80)

GAME:

getuser DT_BYTESUPLOAD; Up=result
getuser DT_RATIOTYPE; Ratio=result
getuser DT_BYTEDOWNLOAD; Dl=result
getuser 145; time=result
if ratio=0 then ratio=3
k= ((up*ratio)-dl)
if con=1 then do
tot=k
con=0
end

se
if k="0" then call lamer
se '[3;3H[0m                                        '
se '[3;3H[31m'uname', you have 'k' Kb'
se '[5;43H[32m       |  ¬Y  ¬Y¬Y~|   |  ¬Y  ¬Y  ¬Y~|'
query '[5;3H[36mHow many Kb do you want to stake(q=aBORT)? ';bt=result
if bt="q" then call exit
if bt>k then do
se cls
se '[13H[32m' center(uname', you have 'k' Kb',80)
se '[15H[34m' center('yOU cAN`T sTAKE 'bt' Kb!!',80)
se '[17H[36m' center('sORRY, bUT yOU cAN`T bET oVER yOUR bUDGET! uPLOAD mORE!! ',80)

getchar
call start
end
if bt<=0 then call game

GAMEx:
se '[7H[32m                                                   7 | T | | |   | T | l_| T _'
query '[7;3H[37mYour Number Is [0-36] [31m';s=result
if s<0|s>36 then call gamex
if s="" then call gamex

se '[11;36H                 '
se '[11;3H[35mIf Your Number Is ok.. you win ...[33m'bt*35'[35m  Kb!!'
se '[9;18H        '
se '[9;3H[32mYou Have Staked [33m'bt'[35m Kb.'

se '[13;3H[0mThe Number Drawn Out Is... [31m'
do x = 1 to 50
rand=random(0,36,time)
if rand<10 then se '[13;30H  '
se '[13;29H[31m' rand
end

if s=rand then call WIN 

LOSE:
showfile "doors:roulette/lose.txt"
se '[15;3H[0mYou lose. You lost 'bt'Kb credits!!'
dl=dl+bt
l=l+1
call writestats

call Game

WIN:
w=w+1
se cls
showfile "Doors:sTAKE/win.txt"
a= 'You WIN!!! You gain 'bt*35' Kb credits!!!! You staked ' bt 'Kb!!'
se center(a,80)
getchar
up=up+(bt*35/ratio)
call writestats
call start

LAMER:
se cls
se "[3HSorry boy, but you haven't any credit here... ByeZ!"
tr '[5H'
shutdown
exit

/***************************************************************/
/************************* ERRORS ******************************/
ioerr:
tr "GENERAL I/O ERROR..."
SHUTDOWN
EXIT
/*===============================================================*/
syntax:
tr "GENERAL SYNTAX ERROR ..."sigl
call exit
/*==============================================================*/
error:
tr "GENERAL FAILURE..."
shutdown
exit


WRITESTATS:
putustr up
putuser DT_BYTESUPLOAD
putustr dl
putuser DT_BYTEDOWNLOAD
return

EXIT:
se cls
tr '[9H'
tr center('sTAKE yOUR cREDITS iS a dOOR fOR /X wRITTEN bY dR fAUSTUS (iVN/hE)',80)
tr
tr center('Before playing you had 'k' Kb, now you have 'tot' Kb',80)
tr
if tot<k then tr center('You gain ' k-tot ' Kb!! ',80)
if tot>k then tr center('You lost ' tot-k ' Kb!! ',80)
tr ''
tr center('You lost 'l' times and won 'w,80)
tr ''
tr center('10x fOR pLAYING! ByeZ!',80)
getchar
tr cls
shutdown
exit
