Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / I need help with this code!

Author
Message
DannyBoi
19
Years of Service
User Offline
Joined: 29th Dec 2004
Location:
Posted: 1st Jan 2005 11:36
I was reading a tutorial and decided to start expirimenting with what I learned.

Part 1. Basicly the game will ask you to press any key to generate 4 random numbers.
Part 2. Then after you press any key, it will show you 4 random numbers. Part 3. Then it will ask you if you would like to do that again.
Part 4. If you type yes that it will, if you type no, then it will say, "Ah well" and then End

The Problem is I seem to get stuck at part 4. I can't seem to get the coding right. Can you guys help me? Thanks

Wait... If 4 out of 5 people suffer from diarrhea, does that mean that the other one enjoys it ?!?!?
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 1st Jan 2005 12:46
Your code isn't showing. The source box is bugged. Use the source tags instead. Something like this will work though you probably will want to use something other than the input command.



DannyBoi
19
Years of Service
User Offline
Joined: 29th Dec 2004
Location:
Posted: 1st Jan 2005 13:20
Well after looking at your code, it answered a bunch of my questions. Well more like 1 or 2. But it was very helpful! As you can see my code is abit different then yours. Also can you explaine to me the whole "lower$" thing. Why did you use it?

My Code: randomize timer()
start:
Print "Press any key to genrate 4 random numbers."
wait key
for i = 1 to 4
print rnd(100)
next i
input "Do you want to play again?", answer$
if lower$(answer$) = "yes"
cls
goto start
else
cls
print "Ah well, press any key to end."
exit
endif
wait key
end

Just asking to stop having you awesome mods approve of my not-spamming posts! Thanks!
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 1st Jan 2005 18:50
The lower$() command, takes all the letters in a string and makes them lower case. This means that as long as the user can spell "yes" it doesn't matter how they capitalise the letters - "Yes", "YeS" "yES" etc
All of them will work.


Cubes with guns? Something isn't right...
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 1st Jan 2005 19:08
Thx ReD_eYe. I thought I put comments in oh well. Also you can take out that exit command. I don't know why I put that there
Here is the commented code (ever late as it may be).



Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 1st Jan 2005 21:52
HereĀ“s a little improvement:




KLU 007 and The Nerd

Spiderman, Spiderman
Does whatever a spider can!
Check out PanzerGames at http://www.freewebs.com/panzergames

Login to post a reply

Server time is: 2024-09-23 08:19:23
Your offset time is: 2024-09-23 08:19:23