I've used multikey in the past (in one of my programs) and it caused so much problem that i had to ditch it. Actually found the code together with the comment i made at the time (line 42 and i've Asterisk'd the section). Multikey was used just for that block of checks (ESC,ENTER,FUNCTION+ARROW Keys) and pretty sure i was clearing the buffer also, but the problem persisted - oh well :)
Code: Select all
sub betting (brc as ubyte)
dim as ubyte bt,hb,money,raise,x,y,p=1
dim as uinteger a,b,c,d,e,n,t
dim as string text,ik
hb=val(right(herb,2))
n=int(rnd(1)*20)+12
bt=5
raise=5
if brc=4 then 'for bet/fold
put(20,700),bet,(0,200)-(310,225),pset
locate 47,6:?bt;
end if
if brc=1 then 'for bet/check/fold
put(20,700),bet,(0,0)-(310,25),pset
locate 47,6:?bt;
end if
if brc=2 then 'for call/raise/fold
put(20,700),bet,(0,75)-(310,100),pset
end if
if brc=3 then 'for call/fold
put(20,700),bet,(0,150)-(310,175),pset
end if
do
t=timer
ik=inkey
while ik=""
if timer-t>2 then put(20,554),black,(0,0)-(320,15),pset 'clear my hand text after 2secs
sleep 20,1
if timer-t>n then
a+=1
n+=8
text=str(herclothes)+"_hurryup"+str(a)
vtp=text
waitforvid:if flag then exit sub
if a=3 then a=0
t=timer
end if
ik=inkey 'must have this here
wend
put(20,554),black,(0,0)-(320,15),pset 'and straight away if i press a key
'******************************************************************************************************************************************************************************
if ik=ESC then quit 0 'have to use inkey as multikey just wouldn't work any good (misses keys repeatedly)
if ik=ENTER then exit do
if ik=F1 then savegame
if ik=F2 then loadgame:if flag then exit sub
if ik=RA and brc<3 and p<3 then p+=1
if ik=RA and brc>2 and p=1 then p=2
if ik=LA and brc<3 and p>1 then p-=1
if ik=LA and brc>2 and p=2 then p=1
'******************************************************************************************************************************************************************************
if brc=1 then
if p=1 then b=0:c=0:d=310:e=25
if p=2 then
locate 47,6
?" ";
b=0:c=25:d=310:e=50
end if
if p=3 then
locate 47,6
?" ";
b=0:c=50:d=310:e=75
end if
end if
if brc=2 then
if p=1 then
locate 47,22
?" ";
b=0:c=75:d=310:e=100
end if
if p=2 then
locate 47,22:?raise;" ";
b=0:c=100:d=310:e=125
end if
if p=3 then
locate 47,22
?" ";
b=0:c=125:d=310:e=150
end if
end if
if brc=3 then
if p=1 then b=0:c=150:d=310:e=175
if p=2 then b=0:c=175:d=310:e=199
end if
if brc=4 then 'bet/fold
if p=1 then b=0:c=200:d=310:e=225 'p must be position
if p=2 then
locate 47,6
?" ";
b=0:c=225:d=310:e=250
End if
end if
if ik=UP and bt<25 and p=1 then
if brc=1 or brc=4 then bt+=5
end if
if ik=UP and raise<25 and brc=2 and p=2 then raise+=5
if ik=DOWN and bt>5 and p=1 then
if brc=1 or brc=4 then bt-=5
end if
if ik=DOWN and raise>5 and brc=2 and p=2 then raise-=5
put(20,700),bet,(b,c)-(d,e),pset
if brc=1 or brc=4 then
if p=1 and bt<>0 then locate 47,6:?bt;" ";
end if
if brc=2 and p=2 and raise<>0 then locate 47,22:?raise;" ";
loop
if brc=1 then
if p=1 then
money+=bt
myb="bet"+str(bt)
end if
if p=2 then myb="check"
if p=3 then myb="fold"
end if
if brc=2 then
if p=1 then
money+=hb
myb="call"
end if
if p=2 then
money+=raise
money+=hb
myb="raise"+str(raise)
end if
if p=3 then myb="fold"
end if
if brc=3 then
if p=1 then
money+=hb
myb="call"
end if
if p=2 then myb="fold"
end if
if brc=4 then
if p=1 then
money+=bt
myb="bet"+str(bt)
end if
if p=2 then myb="fold"
end if
if left(myb,1)="b" or left(myb,1)="r" or myb="call" then
if accbal>money then
accbal-=money
pot+=money
else
sellclothes 0,money
pot+=money
end if
end if
locate 47,1
?" ";
put(20,700),black,(0,0)-(399,67),pset
uppot
if myb="bet5" then myb="bet05"
if myb="raise5" then myb="raise05"
if myb="fold" then
if clothes=4 and accbal<55 then gameover
end if
if clothes=4 and accbal<0 then
draw string(20,554),"SYSTEM FAILURE... watch bets next time!",&hdddddd
sleep 2000,1
put(20,554),black,(0,0)-(320,15),pset
gameover
myb="fold"
end if
end sub