Use the Tab button young padawan!
INPUT "Default? 1 - yes | 2 - custom", d
IF d = 2
INPUT "Number of Enemies: ",enm
INPUT "Number of Allies: ",ali
INPUT "Enemy Strength: ",str
INPUT "Ally Strength: ",astr
GOSUB startgame
ENDIF
IF d = 1
PRINT "Please type either 'normal' or 'hard'"
WAIT 2000
INPUT "Difficulty: ",dfl$
ENDIF
IF dfl$ = "normal"
enm = 5
ali = 4
str = 5
astr = 4
GOSUB startgame
ENDIF
IF dfl$ = "hard"
enm = 7
ali = 4
str = 7
astr = 4
GOSUB startgame
ENDIF
IF OBJECT EXIST(9999)=0
startgame:
SYNC ON:SYNC RATE 100:BACKDROP OFF
IF enm > 9 THEN enm = 9
IF ali > 9 THEN ali = 9
IF str > 20 THEN str = 20
IF astr > 15 THEN astr = 15
DIM enemies(enm)
DIM allies(ali)
MAKE OBJECT BOX 999,30,10,10
MAKE MESH FROM OBJECT 1,999
FOR e = 1 TO enm
MAKE OBJECT SPHERE e, 50
COLOR OBJECT e, RGB(255,0,0)
ADD LIMB e,1,1
OFFSET LIMB e,1,5,20,0
COLOR LIMB e,1,RGB(121,121,121)
NEXT e
There were two problems, (well 3 if you count the crowded ugliness of the code
), 1. When you called the MAKE OBJECT SPHERE command you didnt specify an object number. Im assuming since its in that loop that you want it to be numbered e so that consecutive objects are created. 2. You were calling RETURN at the end of the subroutine, this was returning to where it left off, then following down the code and doing the startgame: subroutine again, thus creating the box object numbered 9999 twice, thus giving you the error of it already existing.
For now I removed the RETURN command as theres nothing after it, if you want to continue on after this I recommend 1 of two things. Either A) Learn to use functions as they're far more efficient and easier to use than subroutines, or B) use an if statement to cancel out the startgame: subroutine after it's been called once. The second one can be done a few ways, you could define a variable and set it to 1 and then check if it equals 1 and if so skip the subroutine, or you could check if one of the object's created in the routine already exists, or, er... Well theres more ways Im just tired right now.
There were two other things, not syntax errors but logic errors. Firstly, the second time you checked if astr > something then astr = something, instead of doing then astr = something you did then str = something. Im assuming you meant to have an "a" before the str and just mispelled it, but there ya go.
Also, I think your take on how limbs work is still way off. For some reason you're adding 10 to the limb number and creating a mesh numbered 998. Unless there is a specific reason behind numbering the mesh 998, number it 1. (MAKE MESH 1, 999). As for the 10+e thing, why are you adding 10 to the limb number? This will make the first limb number of the object 11, which will give an error because limbs must be added in chain sequence so the first limb added must always be 1 unless the object already has limbs. So, I changed the e+10 bit to just 1.
It works now, like I said you should really learn to use functions. If I have time I might convert the code to a function instead of a subroutine for you in a bit.
Goodluck,
- RUC'