|
Post by Wayne Rayner on May 3, 2010 6:10:29 GMT -5
Ok well guys here is the source of the create new engine system from games world.
well I have this problem where if you type in production time either "fast" or "normal. ect. However if you type in "extra slow" or "random" well basically the engine is created and thats basically a cheating way. Is there any way to fix it here is the source code of the new engine system
ResizeText (60,40)
dim Engine_Name$, Engine_Genre$, Production_Speed$, Production_Time# dim Production_Quality#, Engine_Quality# Locate 15,15 : Print "Engine Name: " input Engine_Name$ Locate 15,16 : Print "Genre: " input Engine_Genre$ Locate 15,17 : Print "Production Speed: " input Production_Speed$ if Production_Speed$ = "fast" or Production_Speed$ = "Fast" or Production_Speed$ = "FAST" then Production_Time# = 5 Engine_Quality# = 50 elseif Production_Speed$ = "normal" or Production_Speed$ = "Normal" or Production_Speed$ = "NORMAL" then Production_Time# = 10 Engine_Quality# = 70 elseif Production_Speed$ = "slow" or Production_Speed$ = "Slow" or Production_Speed$ = "SLOW" then Production_Time# = 20 Engine_Quality# = 90 else print "error didn't specify whether slow, normal or fast" endif
your help will be gratefull and it would help the production of gamesworld. also it's probably something as simple as a sqaure lol, basically just so easy it will mark me as the 'Blonde Programmer' lol
yours Wayne Rayner
|
|
|
Post by shadow008 on May 3, 2010 7:11:43 GMT -5
#1 - b4gl isnt case sensitive, instead of "if Production_Speed$ = "fast" or Production_Speed$ = "Fast" or Production_Speed$ = "FAST" then" try
"if lcase$(production_speed$) = "fast" then" .... you get the same effect, and do that for all of them
#2 - i dont see any problem with this section of code, maybe some other part?
|
|
|
Post by Supermonkey on May 3, 2010 7:58:33 GMT -5
Well the problem is that you're printing out an error message but not making the user reinput their production time, so the Product_Time# and Engine_Quality# variables will be set at 0. Also why are the variable data types floats and not integers?
ResizeText (60,40)
dim Engine_Name$, Engine_Genre$, Production_Speed$, Production_Time# dim Production_Quality#, Engine_Quality# dim done Locate 15,15 : Print "Engine Name: " input Engine_Name$ Locate 15,16 : Print "Genre: " input Engine_Genre$ do done = true Locate 15,17 : Print "Production Speed: " input Production_Speed$ if Lcase$(Production_Speed$) = "fast" then Production_Time# = 5 Engine_Quality# = 50 elseif Lcase$(Production_Speed$) = "normal" then Production_Time# = 10 Engine_Quality# = 70 elseif LCase$(Production_Speed$) = "slow" then Production_Time# = 20 Engine_Quality# = 90 else cls:print "error didn't specify whether slow, normal or fast" done = false endif loop until done
A few modifications to the code, it was done off the top of my head so there may be an error or two.
|
|
|
Post by Wayne Rayner on May 3, 2010 17:17:31 GMT -5
Well I might have the ratings be a random number between 0-30 with decimal numbers for the fast engine and with the normal between 30 and 60 and slow between 60 and 100.
I believe that would be good feature in the future.
But other than that no there is no real reason.
Supermonkey thanks for the code update.
|
|
|
Post by Supermonkey on May 4, 2010 4:02:51 GMT -5
I can understand that, by randomising the values for Production_Time and Engine_Quality you're making sure that the player doesn't get the exact same outcome each time round, good idea .
|
|
|
Post by Wayne Rayner on May 4, 2010 5:59:24 GMT -5
yea, well now the code is getting just a bit to big for me to handle in a program so I'm going to put the parts into include files so that I understand what is happening at all times.
It makes it easier for me to read. Also yea I know people get bored if it's the same all the time so randomising is better for longer game play.
Also anyone who wants to help in this project PM me as there is a lot that needs to be done.
The best for every one
|
|