Start Screen string question

Blitz3D Forums/Blitz3D Beginners Area/Start Screen string question

BlueWolf(Posted 2004) [#1]
I am doing a little start screen for my project(Like the ones featured in some of the blitz3d samples)

I have tried the following code

gfx$=Input("Use Windowed Mode?")

	If Left$(Lower$(gfx$),1)=y
		Graphics3D 800,600,0,3
	ElseIf Left$(Lower$(gfx$),1)=n
		Graphics3D 1200,1000,0,1
	EndIf	 	
in$=Input("How Many Balls?")
Print "Okay there will be"+in$+"balls"


,the user input has no effects on the screen mode.
I can't quite figure out what I am doing wrong here so any help would be appreciated.


GfK(Posted 2004) [#2]
gfx$=Input("Use Windowed Mode?")

	If Left$(Lower$(gfx$),1)="y"
		Graphics3D 800,600,0,3
	ElseIf Left$(Lower$(gfx$),1)="n"
		Graphics3D 1200,1000,0,1
	EndIf	 	
in$=Input("How Many Balls?")
Print "Okay there will be"+in$+"balls"

You should be aware that your code contains other problems - for instance, if you enter something other than "y" or "n", the program will continue regardless without setting either of your specified graphics modes.

Second, on the "How many balls?" bit, you aren't checking that the result is a numerical value - the end user can type anything there.


BlueWolf(Posted 2004) [#3]
ermm yes I was planning to do that just after I got the first bit to work :) Either that or I can just trust that the user won't type in anything besides a number :)


WolRon(Posted 2004) [#4]
Never trust the user. They will always crash your program if possible.


Floyd(Posted 2004) [#5]
The reason the original code doesn't set any graphics mode is that it looks for y and n.

It should be looking for strings "y" and "n", as in GfK's code.


BlueWolf(Posted 2004) [#6]
The reason the original code doesn't set any graphics mode is that it looks for y and n.

It should be looking for strings "y" and "n", as in GjK's code.
yeah I noticed that after he made his post, quite a silly mistake :-)


Hansie(Posted 2004) [#7]
@WolRon

you are correct! Murphey's law. if something can go wrong, it WILL go wrong :-D