Hi!
Im making an RPG Battle system were you customize your stats at the start, and customize your face. Then you battle an opponent. Note that it is the same opponent each time.
Anyway, I have a bug in the code. First you roll your stats. Then you further customize them by adding-subtracting points.
Here is the code:
set window on
set display mode 700,500,32
sync on
`These are the Variables
strength=rnd(10)
vitality=rnd(10)
dexterity=rnd(10)
magic=rnd(10)
luck=rnd(10)
level=0
customizations=15
`This is were the Variables are Printed and you may reroll them
printvar:
cls
ink rgb(255,255,255),0
SET CURSOR 230,166 : print "Strength:"
SET CURSOR 313,166 : print strength
SET CURSOR 230,186 : print "Vitality:"
SET CURSOR 313,186 : print vitality
SET CURSOR 223,206 : print "Dexterity:"
SET CURSOR 313,206 : print dexterity
SET CURSOR 255,226 : print "Magic:"
SET CURSOR 313,226 : print magic
SET CURSOR 263,246 : print "Luck:"
SET CURSOR 313,246 : print luck
do
if text_button(425,171,"Reroll Strength")= 1 then goto stroll:
if text_button(425,191,"Reroll Vitality")= 1 then goto vitroll:
if text_button(429,211,"Reroll Dexterity")= 1 then goto dexroll:
if text_button(413,231,"Reroll Magic")= 1 then goto magroll:
if text_button(410,251,"Reroll Luck") = 1 then goto lucroll:
if text_button(383,271,"Next") = 1 then goto customizestats:
if text_button(306,271,"Back") = 1 then goto mainmenu:
sync
loop
stroll:
strength=rnd(10)
cls
goto printvar:
vitroll:
vitality=rnd(10)
cls
goto printvar:
dexroll:
dexterity=rnd(10)
cls
goto printvar:
magroll:
magic=rnd(10)
cls
goto printvar:
lucroll:
luck=rnd(10)
cls
goto printvar:
`Customize your Stats
customizestats:
SET CURSOR 230,166 : print "Strength:"
SET CURSOR 313,166 : print strength
SET CURSOR 230,186 : print "Vitality:"
SET CURSOR 313,186 : print vitality
SET CURSOR 223,206 : print "Dexterity:"
SET CURSOR 313,206 : print dexterity
SET CURSOR 255,226 : print "Magic:"
SET CURSOR 313,226 : print magic
SET CURSOR 263,246 : print "Luck:"
SET CURSOR 313,246 : print luck
do
if text_button(425,171,"Reroll Strength")= 1 then goto stroll2:
if text_button(425,191,"Reroll Vitality")= 1 then goto vitroll2:
if text_button(429,211,"Reroll Dexterity")= 1 then goto dexroll2:
if text_button(413,231,"Reroll Magic")= 1 then goto magroll2:
if text_button(410,251,"Reroll Luck") = 1 then goto lucroll2:
if text_button(383,271,"Next") = 1 then goto faceselection:
if text_button(306,271,"Back") = 1 then goto printvar:
SET CURSOR 306,291 : print "You have "
SET CURSOR 336,291 : print customizations
SET CURSOR 356,291 : print "left"
sync
loop
stroll2:
if customizations>0 then strength=strength+1
cls
goto customizestats:
vitroll2:
if customizations>0 then vitality=vitality+1
cls
goto customizestats:
dexroll2:
if customizations>0 then dexterity=dexterity+1
cls
goto customizestats:
magroll2:
if customizations>0 then magic=magic+1
cls
goto customizestats:
lucroll2:
if customizations>0 then luck=luck+1
cls
goto customizestats:
`Select you characters Face
faceselection:
`Functions
function text_button(x,y,text$)
tx = text width(text$)
ty = text height(text$)
pressed = 0
if mousex() < x+(tx/2) and mousex() > x-(tx/2)
if mousey() < y+(ty/2) and mousey() > y-(ty/2)
pressed = 1
endif
endif
if pressed = 1
ink rgb(255,0,0),0
else
ink rgb(255,255,255),0
endif
if pressed = 0 then hold = 0
center text x,y-(text size()/2),text$
if mouseclick() = 0 then pressed = 0
endfunction pressed
I run it. After which I click "Next" after rolling the stats and it just ends instead of going to customizestats:
Whats up?