Post by antgurevich on Apr 12, 2019 0:15:38 GMT
I am trying to make one of my subroutines loop as long as a variable is greater than 0. I have tried multiple kinds of loops, but nothing is working and I am receiving an error. I want the program to loop this sub when the Open Next Pack button is clicked. (Packsleft is globally defined before this sub)
sub pack1 handle$
close #openpackmenu
WindowWidth = 600
WindowHeight = 480
BackgroundColor$ = "white"
ForegroundColor$ = "black"
rng=int(rnd(1)*75)+1
packsleft=packsleft-1
select case
case rng<5
Msg1$= "Congratulations! You received a LEGENDARY skin!" ;rng
print Msg1$
statictext #pack1.statictext1, Msg1$, 200, 50, 330, 32
case (rng>=5) and (rng<=15)
Msg2$= "Congratulations! You received a EPIC skin!"
statictext #pack1.statictext2, Msg2$, 200, 50, 330, 32
print Msg2$
case (rng>15) and (rng<=30)
Msg3$="Congratulations! You received a RARE skin!"
print Msg3$
statictext #pack1.statictext3, Msg3$, 200, 50, 330, 32
case (rng>30) and (rng<50)
Msg4$="Congratulations! You received a UNCOMMON skin!"
print Msg4$
statictext #pack1.statictext4, Msg4$, 200, 50, 330, 32
case else
Msg5$="Congratulations! You received a COMMON skin!"
print Msg5$
statictext #pack1.statictext5, Msg5$, 200, 50, 330, 32
end select
PR$= "Packs remaining: " ;packsleft ; rng
statictext #pack1.statictext6, PR$, 225, 150, 100, 100
button #pack1.button2 "Quit", ClosePack, UL, 305, 360
button #pack1.button "Open next pack", pack1, UL, 175, 360
open "Pack" for window as #pack1
wait
end sub
sub pack1 handle$
close #openpackmenu
WindowWidth = 600
WindowHeight = 480
BackgroundColor$ = "white"
ForegroundColor$ = "black"
rng=int(rnd(1)*75)+1
packsleft=packsleft-1
select case
case rng<5
Msg1$= "Congratulations! You received a LEGENDARY skin!" ;rng
print Msg1$
statictext #pack1.statictext1, Msg1$, 200, 50, 330, 32
case (rng>=5) and (rng<=15)
Msg2$= "Congratulations! You received a EPIC skin!"
statictext #pack1.statictext2, Msg2$, 200, 50, 330, 32
print Msg2$
case (rng>15) and (rng<=30)
Msg3$="Congratulations! You received a RARE skin!"
print Msg3$
statictext #pack1.statictext3, Msg3$, 200, 50, 330, 32
case (rng>30) and (rng<50)
Msg4$="Congratulations! You received a UNCOMMON skin!"
print Msg4$
statictext #pack1.statictext4, Msg4$, 200, 50, 330, 32
case else
Msg5$="Congratulations! You received a COMMON skin!"
print Msg5$
statictext #pack1.statictext5, Msg5$, 200, 50, 330, 32
end select
PR$= "Packs remaining: " ;packsleft ; rng
statictext #pack1.statictext6, PR$, 225, 150, 100, 100
button #pack1.button2 "Quit", ClosePack, UL, 305, 360
button #pack1.button "Open next pack", pack1, UL, 175, 360
open "Pack" for window as #pack1
wait
end sub