Current location: Hot Scripts Forums » General Web Coding » Flash & ActionScript » Number Genarator


Number Genarator

Reply
  #1 (permalink)  
Old 09-30-09, 03:21 PM
tommyc325's Avatar
tommyc325 tommyc325 is offline
Wannabe Coder
 
Join Date: Sep 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Number Genarator

Hey Guys

I was wondering if i can get some help here.

Im trying to make a simulated slot machine kinda thing

the machine would have 3 slots

once i hit a button lets say the space bar all 3 slots start randomly going through numbers (0-9)

now for the hard part i think

i want to be able to hit a number on my keyboard and have column 1 finish rotating till it hits the number i pressed.

Then the same to column 2 and 3

Any help would be appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-30-09, 04:27 PM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
Your over thinking the problem.

Id do it this way.

1.Select the random number for the output ($OutNumb)
2.Select a random number of times to update the slot display ($SlotNumb)
3.Generate a random number to show in the box ($ShowNumb)
4.Show $ShowNumb in box
5. Loop back to #3 $SlotNumb of times
6.Show the final number $OutNumb in the box
7. Do for each box in slot display

Writen in psudo code because 1 you didnt specify a language, 2 Im to lazy to write the script for you, and 3 You should do it anyway.
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-30-09, 04:32 PM
tommyc325's Avatar
tommyc325 tommyc325 is offline
Wannabe Coder
 
Join Date: Sep 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
well the final number will not be determined till i choose the number at the end by hitting a number a number 0-9

so if i hit #4

slot 1 will say #4

i appreciate the help but im not following
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 09-30-09, 04:43 PM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
Oh hang on you want the number to be determined by the key input ... sorry I though you said that the number will be selected at random when the space bar is hit. The point is still the same though. You thinking back words the display and the number selection are 2 different non related things. The display is just for show.
So you could do something like this.

1.Generate a random number to show in the box ($ShowNumb)
2.Show $ShowNumb in box
3. Loop back to #1 until a key is pressed.
4. Get key input and save to variable
5. Display variable
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 09-30-09, 04:45 PM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
By the way what language are you using?
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 09-30-09, 07:36 PM
tommyc325's Avatar
tommyc325 tommyc325 is offline
Wannabe Coder
 
Join Date: Sep 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
thats it - as3

im going to try to get this going
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 09-30-09, 07:42 PM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
Oh a flash site? Good luck with your project.
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 09-30-09, 07:43 PM
tommyc325's Avatar
tommyc325 tommyc325 is offline
Wannabe Coder
 
Join Date: Sep 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
the main issue im having is part 4
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I need to pass this class Please Help! Negative6 Everything Java 1 05-03-07 07:55 AM
Perfect number... Argo_Jeude C/C++ 1 07-14-05 03:35 PM
add a number every 30 minutes Dion PHP 5 08-31-04 01:52 AM


All times are GMT -5. The time now is 07:19 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.