I shortened the "estats" sub routine, and reorganized "stats" so I could read more clearly whats going on. If I had to guess, I'd say it's due to a missing return statement in "stats". Without a return statement at the end, its possible that one is never reached because of the IF statements. Technically, the program would continue right on into "estats", but I'm unsure of whether that would give errors or not. I know java wouldn't let you get away with it.
estats:
estats:
estat = rnd(2)
dec rep, 1
if estat = 0 then inc es, 1
if estat = 1 then inc ea, 1
if estat = 2 then inc ee, 1
if rep = 0
return
else
gosub estats
endif
eh = 4*ee
inc killed, 1
return
stats:
stats:
center text 320,240,"(s) Increase Strength"
center text 320,265,"(e) Increase Endurance"
center text 320,290,"(a) Increase Agility"
center text 320,310,"(q) Finished"
center text 320,400,"Dead Points remaining: "+str$(rdp)
if keystate(31)=1
dec rdp,1
inc zs,1
center text 320,200,"Your Strength has increased!"
wait 250
cls
if rdp=0
gosub estats
else
gosub stats
endif
endif
if keystate(18)=1
dec rdp,1
inc ze,1
center text 320,200,"Your Endurance has increased!"
wait 250
cls
if rdp=0
gosub estats
else
gosub stats
endif
endif
if keystate(30)=1
dec rdp,1
inc za,1
center text 320,200,"Your Agility has increased!"
wait 250
cls
if rdp=0
gosub estats
else
gosub stats
endif
endif
if rdp = 0 or keystate(16)=1
cls
wait 250
epoints = rnd(2)
inc rep,epoints
gosub estats
return
else
gosub stats
endif
return
Also, take a look at "estats". Suppose "rep" equals zero as the subroutine is called. You subtract 1 from it, resulting in -1. It hits the IF ELSE statement at the bottom, and recalls "estats" again. This time, "rep" will be -2. See the pattern? You'll be infinitately stuck inside the subroutine, which if called too many times results in a stack overflow error.
"eureka" - Archimedes