Jerok,
Firstly try to indent and space out your code, this makes it easier to read when your looking back at it
The problem you have in that code is the second Do Loop is never called.
The program will calculate the variables, but once in the first Do Loop you do not tell the computer to run the second do loop. You can do this in many different ways, either through a function or the Goto command, personally for what your doing, keeping it all in one loop will more than likely be ok. Also I dont like using goto commands, it makes your code look like speggeti junction and creates a bigger .exe once its been compiled.
Below is a quick revise of your code, hope I havnt ruined any battle calculations!!
` Deafult Variables
` For our hero
level# = 1
con# = (level#+1) * 2
dex# = con# - 3
speed# = dex# * 2
strength# = dex# + con#
intl# = level# * 2
accuracy# = level# + dex# + 6
health# = con# * 10
magic# = intl# * 10
xp# = 0
stats# = con# + strength# + speed# + dex# + intl# + level# + accuracy#
rem intl#=intelligence
rem con#=constitution
rem dex=dextarity
` And our foe
ENMYlevel# = 1
ENMYcon# = level# * 2
ENMYdex# = con# - 2
ENMYspeed# = dex# * 2
ENMYstrength# = dex# + con#
ENMYintl# = level# * 2
ENMYaccuracy# = level# + 4
ENMYhealth# = con# * 4
ENMYmagic# = intl# * 4
ENMYDMG# = ENMYstrength# + ENMYpower#
ENMYDFE# = ENMYdex# + ENMYintl#
` Main Loop
do
` I clear the screen every loop otherwise the 'Text' command messes up
cls
` We Battle!!
PHIT# = rnd(100)+1
EHIT# = rnd(100)+1
EDMG# = rnd(ENMYDMG#)+1
PDAMG# = rnd(PDMG#)+1
PDEF# = rnd(PDFE#)+1
EDEF# = rnd(ENMYDFE#)+1
PHURT# = PDAMG#-EDEF#
EHURT# = EDMG#-PDEF#
if xp#>20*stats#
level#=level#+1
Command3$ = "Your level grew to level :" + str$(level#)
xp# = 0
else
Command3$ = ""
endif
` We can allow a variable with a $ on the end to store a string, we then Text this variable onto the screen
` We also want to player to be able to read the outcome, yet if there is a miss, then hurry on, to preform this,
` we set a variable Waiting to 0 (no wait), but if either you or the enemy has hit, wait for 2500 (2.5 seconds)
Waiting = 0
if PHURT#>0 and PHIT#<accuracy#
ENMYhealth# = ENMYhealth# - PHURT#
Command1$ = "You have hit ENEMY 1 for " + str$(PHURT#) + " damage!"
Command2$ = "ENEMY 1's HEALTH is now " + str$(ENMYhealth#)
Waiting = 2500
else
` As we have missed, there is no Command2, so we reset that to blank
Command1$ = "You have missed"
Command2$ = ""
endif
if EHURT#>0 and EHIT#<ENMYaccuracy#
health#=health#-EHURT#
ENMYCommand1$ = "ENEMY1 has hit you for " + str$(EHURT#) + " damage"
ENMYCommand2$ = "Your HEALTH is now " + str$(health#)
Waiting = 2500
else
ENMYCommand1$ = "Enemy 1 has missed"
ENMYCommand2$ = ""
endif
` We now Text this information onto the screen
Text 8,250,"Battle Information:"
Text 16,270,Command1$
Text 16,285,Command2$
Text 16,310,Command3$
Text 360,270,ENMYCommand1$
Text 360,285,ENMYCommand2$
` We recalculate our stats
` For our hero
con# = (level#+1) * 2
dex# = con# - 3
speed# = dex# * 2
strength# = dex# + con#
intl# = level# * 2
accuracy# = level# + dex# + 6
magic# = intl# * 10
stats# = con# + strength# + speed# + dex# + intl# + level# + accuracy#
rem intl#=intelligence
rem con#=constitution
rem dex=dextarity
PDMG#=strength#+weapon#
PDFE#=dex#+intl#
` And our foe
ENMYcon# = level# * 2
ENMYdex# = con# - 2
ENMYspeed# = dex# * 2
ENMYstrength# = dex# + con#
ENMYintl# = level# * 2
ENMYaccuracy# = level# + 4
ENMYmagic# = intl# * 4
ENMYDMG# = ENMYstrength# + ENMYpower#
ENMYDFE# = ENMYdex# + ENMYintl#
` I now text our heros stats
text 75,50," - YOUR STATS - "
text 20,75,"Constitution : " + str$(con#)
text 20,90,"Stength : " + str$(stength#)
text 20,105,"Speed : " + str$(speed#)
text 20,120,"Dexterity : " + str$(dex#)
text 20,135,"Intellegence : " + str$(intl#)
text 20,150,"Accuarcy : " + str$(accuracy#)
text 20,165,"Magic : " + str$(magic#)
text 20,180,"Health : " + str$(health#)
` I now text our enemys stats
text 420,50," - ENEMY STATS - "
text 475,75,"Constitution : " + str$(ENMYcon#)
text 475,90,"Stength : " + str$(ENMYstength#)
text 475,105,"Speed : " + str$(ENMYspeed#)
text 475,120,"Dexterity : " + str$(ENMYdex#)
text 475,135,"Intellegence : " + str$(ENMYintl#)
text 475,150,"Accuarcy : " + str$(ENMYaccuracy#)
text 475,165,"Magic : " + str$(ENMYmagic#)
text 475,180,"Health : " + str$(ENMYhealth#)
` We want the user to be able to read this information so we pause for a moment (2 and 1/2 seconds) before continuing
wait waiting
loop
Although this is by far complete, the XP# doesnt seem to work, I have left this for you to work out (I find it helps me more when I don't just copy code)
Also notice I have used Text commands not Print, the reason for this is you can then easily position the text where ever you want, I also belive it runs quicker...
If you need anymore help or don't understand the code, just ask!!
James Morgan
[Edit]
If you find it easier, use the Goto commands in your main Do Loop to go between battle, story etc. As this is a small 2D program, the Goto wont really affect the .Exe size.
Also, why not think about trying to add commands to this, such as when its your turn in battle, A to attack, M for magic (then pick what type of magic) and I for Item (then you pick what type of item).
Although for starters, try just A or M for either Attack of Magic, once this is sorted, then add different types of magic etc...
You can even add colour, look into the INK command, turn your stats a different colour to the enemys + different colours for Health, Attack strength, etc...
My first sexual experiance was in my girlfriends house, then she came down stairs and ruined it...