How many indentations are allowed?

I attempting to code an RPG-like combat system (not really to use so much as see if it were possible). I have to have code that goes really deep, however, and have started getting errors when I run the script that say, along with the line number, “Increasing indent not allowed, expecting 6 was 8.”

Does this mean I did something wrong with my code, or I simply can’t indent past the point I’ve already reached?

My code, super rough, looks like something like this (with the dashes removed and replaced with space, of course. I just put them there to indicated space numbers for this post).

----*if (enemy_hp > 1)
------You deal damage! (insert rest of damage code)
------*rand enemy_magic_attempt 1 5
------*if (enemy_magic_attempt = 5)
--------Code for enemy magic damage.
--------Code for enemy physical damage.

My problem is that, on line six of that code, I get the error saying increasing indent was not allowed, expecting 6 was 8. I’m assuming it meant I can’t indent that much. If so, how could I make this code differently?

It’s all there, everything for a working battle. I tested it and it works almost perfect. My problem is that, if I have to leave out the part that is indented “too far” then my enemies will be able to do one single attack, no magic attacks or critical hits. How can I change this?

Or have I simply messed up my code?

As far as I know, there is no limit to the number of indentations and in my early coding for ‘The Race’ I used a lot more than 8 indents.

The error message you received first refers you to a line number.
That line has been indented 2 spaces too many to make the code work.
To correct it, delete 2 spaces on that line and the code should be fine.

If you still have errors, post the code in full and I can look through it.

Incidentally, you can reduce the number of indents needed for consecutive lines by using *goto and *label to start on fresh lines.

Alright, I got it to work. However, I’ve now bumped into a second problem. It’s an error I’ve never bumped into and I’m not sure how to interpret it?

“line 40: It is illegal to fall into an *else statement; you must *goto or *finish before the end of the indented block.”

Okay, ‘falling out’ of a block is when you reach the end of an indented portion and just return to the previous number of indents. I can’t really explain it well, so let me use an example (line numbers are in parentheses to make it easier to follow):

(01) This happens First
(02) *if variable = true
(03) -This happens if the variable is true
(04) This happens whether or not the variable is true.

After finishing line 3 we ‘fall into’ line 4, because there is nothing more indented after it.
‘falling into’ a line is sometimes legal, and sometimes not (depending on why the line is indented, and line being fallen into starts with a command).

Your line 40 is probably an *else command. Check the line before it. That line cannot ‘fall into’ an *else command, instead needing something to redirect it (a *goto).

Alright, I see what happened and fixed it as well.

Many thanks! I have a completely functional battle system, now! Player health, enemy health, randomized damage depending on what weapon is used, spells that use MP, random enemy damage, and 1-in-5 chance of enemy spells. The only thing left to do is code in the ability to use some health/mp potions and maybe a critical damage thing.

I appreciate the help!

Um, I have one more question. :">

The battle system is totally working, now. The one slight problem being that it takes up a whole turn in the battle to check your stats by clicking on the “Show Stats” tab. Is there anyway to change this?

Unfortunately, the stats screen causes problems with *rand. It rerolls everything, than reapplies any effects. The best way to handle this (IMO) is to disable the stats screen, then include an option in game to display stats in the game itself.

OK, sounds good! Thank you!