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 / lottery data gone wrong somehow ?

Author
Message
zencreator03
21
Years of Service
User Offline
Joined: 11th Jul 2003
Location:
Posted: 30th Jul 2003 02:43
Hi all, i have managed to create a basic random lottery number game where the player inputs 5 numbers and must then compare his with 5 randomnly generated numbers, its not totally finished anyway but i have it working and have found there to be a problem, when the final compare numbers screen comes on, no matter what number the user inputs it always seems to appear as zero's, does anyone know why this is, check the code and see if u know. Thankyou you muchly in advance.
zencreator03
21
Years of Service
User Offline
Joined: 11th Jul 2003
Location:
Posted: 30th Jul 2003 02:57
also to help me finish the program how would i get the computer to check if any of your numbers are the same as their random ones and if they are then print a message to the screen. I was thinking about making it into a little betting game where if you get one number right then your money gets 1 added to it, and if you get two right then 2 is added etc,etc could anyone possibly give some help or guidlines as to how i could do this part ?thanx again

Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 30th Jul 2003 03:47 Edited at: 30th Jul 2003 03:48
You could do something like this:


I'm not sure if I got the syntax right but you should get the idea.

JetRace coming. Watch out!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 30th Jul 2003 03:53
Also, move the lines:

playernum(1,1)=a
playernum(1,2)=b
playernum(1,3)=c
playernum(1,4)=d
playernum(1,5)=e

after gosub startscreen

This will mean the array gets updated properly with user inputted numbers.

You were updating array before numbers are even entered!

The programmer formerly known as sonic
zencreator03
21
Years of Service
User Offline
Joined: 11th Jul 2003
Location:
Posted: 30th Jul 2003 04:20
Ok thanx all that is now working although i have ran into one more problem, the supposedly random numbers are not infact random, every time i run the program it starts with them same numbers, whats going on now ?please help, thanx, oh yeah the rebuilt code is in source.

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 30th Jul 2003 04:41
put following line at top:

randomize timer()

this gives you different numbers each time.

Also you are getting '0' as a lottery number. Remember RND(X) gives you a number between 0 and X. So if you want a number between 1 and 49 (UK lottery), you need RND(48)+1

The programmer formerly known as sonic
zencreator03
21
Years of Service
User Offline
Joined: 11th Jul 2003
Location:
Posted: 30th Jul 2003 04:47
Thanx alot spooky ! My little but big stepping stone program is running well and has been added to and i am quite proud of myself, que for an (ahhhhhhh). Thanx anyway !

zencreator03
21
Years of Service
User Offline
Joined: 11th Jul 2003
Location:
Posted: 30th Jul 2003 04:52
Okay im sorry i was wrong, there is one more thing i wud really like to know, in the subroutine check, it only checks to see if all the numbers are correct, i would like to know how to get each individual player number checked with each computer number, and perhaps if 1 number is correct with one of the comp numbers then money=money+1 or if all are wrong money=money-1, the check system cannot work at the moment because it is almost impossible to guess all 5 numbers in the right order first time, thanx !

Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 30th Jul 2003 22:45
you need to modify this code :

So that it does another check loop:

Login to post a reply

Server time is: 2024-11-25 01:41:56
Your offset time is: 2024-11-25 01:41:56