Trying to make a program involving groups...
Trying to make a program involving groups...
I set a variable as level$, and the text tells the user to type their character level in Final Fantasy 1. This value can be any number between
1 and 50. I want to know if you can set it so that if the person using this pogram types a number between 1 and 10, or 11 and 20 it displays two different sets of command for each set, so if input lies in between (and including) 11 and 20 it shows a message such as 'Good level, but need to work harder and if the input is greater than 50, it shows a message like:
'Cheater, you Sharked the game!'
Is this possible, because as far as I can see it only works with single digit numbers.
1 and 50. I want to know if you can set it so that if the person using this pogram types a number between 1 and 10, or 11 and 20 it displays two different sets of command for each set, so if input lies in between (and including) 11 and 20 it shows a message such as 'Good level, but need to work harder and if the input is greater than 50, it shows a message like:
'Cheater, you Sharked the game!'
Is this possible, because as far as I can see it only works with single digit numbers.
Either use an integer variable instead of a string one:
Or use VAL:
Code: Select all
Dim level as integer
Print "type your level:";
Input level
if level >= 11 and level <= 20
print "good job"
else if level > 50 then
print "cheater"
end if
Code: Select all
' assuming level$ has the level number
level_int = val(level$)
if level_int >= 11 and level_int <= 20
print "good job"
else if level_int > 50 then
print "cheater"
end if
or you can use case
Code: Select all
input "Enter your level>"; level
select case level
case 1 to 10
print "You need more work..."
case 11 to 20
print "ok..."
case 31 to 50
print "whoa!"
case > 50
print "damnit cheaters"
end select
-
- Posts: 680
- Joined: May 28, 2005 1:11
- Contact:
string comparison's still doable by padding it with a space...
Code: Select all
if len(level$)=1 then level$=" "+level$
select case level$
case " 1" to "10"
? "n00b"
case "11" to "20"
'...etc
I tried Dumbledore's and Nathan's methods, but they both complain of a syntax error. My code follows:
[/quote]
BTW changed to FF 7: Max on that game is 99 ^_^
Code: Select all
[start]
print "What is the level of a character of yours in Final Fantasy VII"
input "Level"; level
select case level
case 1 to 10
print "Just started eh? Keep at it newbie"
case 11 to 20
print "You're becoming quite the warrior. Keep at it!"
case 21 to 30
print "Wow, you're tough!"
case 31 to 40
print "You're strong enough to beat the Materia Keeper?! I had trouble at that!"
case 41 to 50
print "Ok, approaching the Overkill zone..."
case 51 to 60
print "Alright, now your getting SILLY!!!"
case 61 to 70
print "You're being ridiculous!"
case 71 to 80
print "Is the game easy enough yet?"
goto [start]
BTW changed to FF 7: Max on that game is 99 ^_^
Code: Select all
start:
print "What is the level of a character of yours in Final Fantasy VII"
input "Level"; level
select case level
case 1 to 10
print "Just started eh? Keep at it newbie"
case 11 to 20
print "You're becoming quite the warrior. Keep at it!"
case 21 to 30
print "Wow, you're tough!"
case 31 to 40
print "You're strong enough to beat the Materia Keeper?! I had trouble at that!"
case 41 to 50
print "Ok, approaching the Overkill zone..."
case 51 to 60
print "Alright, now your getting SILLY!!!"
case 61 to 70
print "You're being ridiculous!"
case 71 to 80
print "Is the game easy enough yet?"
end select
goto start
The error is on the following line:
It says "BASIC compile halted:Syntax error"
What is the error?
Code: Select all
case 1 to 10
What is the error?
-
- Posts: 612
- Joined: Jun 15, 2005 13:22
- Location: Upstate NY
- Contact:
-
- Posts: 680
- Joined: May 28, 2005 1:11
- Contact: