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.

DarkBASIC Discussion / Help implementing dice rolls

Author
Message
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 15th Aug 2005 20:46
I am making a monopoly game and I need help making the dice roll when its your turn. I've tried this:


My problem is I don't konw how to take turns and add the dice to a position. I already have everything worked out. I just need to have something add the dice total to p1pos# if the turn#=1 and then add the dice to p2pos# when turn#=2 and so on. Can somebody help me please?

Thanks in advanced!

------------------------
Visit my website of Games!
http://dabip.stonerocket.net
Drew Cameron
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: Scotland
Posted: 15th Aug 2005 21:41 Edited at: 15th Aug 2005 21:43
I assume there are two players, right?



I changed 'turn#' to 'turn' and 'gonce#' to 'gonce' because adding the # just means it takes up more memory. You also don't need to have the dice as an array.

Good luck!
Reply if this isn't what you meant.


Katie Holmes does not endorse D&C or Drew Cameron.
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 16th Aug 2005 02:11
Actually! That will work! Thank you! When I tried, I made all sort of strange things and none of it worked properly.

I will add you to my thanks in the credits of my game.
Here is the code I will be using. I changed what you gave me slightly to make it work better (more the way I wanted it to). But thank you! :



------------------------
Visit my website of Games!
http://dabip.stonerocket.net
Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 16th Aug 2005 19:18
Are you remembering that rnd(6) gives you 0-6 (I think, can't check right now) and a dice gives you 1-6?

Might be better to use rnd(5)+1.
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Aug 2005 19:48
Maybe if the dice rolls of the table you get a 0?

Immunity and Annihalation makes Immunihalation...
oDCo
20
Years of Service
User Offline
Joined: 11th May 2005
Location:
Posted: 16th Aug 2005 21:41 Edited at: 16th Aug 2005 21:42
I was doing stuff with dice rolls and found the RND isn't actually random. Use this handy code snippet to generate a "random" number to seed the RANDOMIZE command . . . not my work though, it's Mentor's.



You only need to add it once at the top of your code mind you.

David
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 17th Aug 2005 23:20
@SvenB: ROFL...

@oDCo: Well, you've got to hand it to Mentor - You can't get much more of a random seed number than THAT ^_^

[Insert extremely witty comment here] :: Add me to MSN if you like, but don't expect any big favours [unless you like VB6]. ... IDK!!
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 18th Aug 2005 02:43
TinkerGirl:

I know that it goes 0 to 6 I put in the code

Sven B:
Good idea but not something I was aiming at.

oDCo:
Thanks, but the regular (I think I spelled it wrong) rnd command works for me.

Thanks everyone for helping me!!

------------------------
Visit my website of Games!
http://dabip.stonerocket.net
oDCo
20
Years of Service
User Offline
Joined: 11th May 2005
Location:
Posted: 18th Aug 2005 11:08 Edited at: 18th Aug 2005 11:10
You are aware that the RND command will produce the same sequence of "random" numbers each time you run the program aren't you?

This thread ( http://forum.thegamecreators.com/?m=forum_view&t=54246&b=10 ) explains alot.

Either way, good luck with your game
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 18th Aug 2005 13:09
Look at oDCo's reply. He should know it by now...

Immunity and Annihalation makes Immunihalation...
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 18th Aug 2005 17:50
Hmmm, that is interesting. I certainly don't want 32,000 repeating numbers. So, I gues I'll do two versions of dice rolls. I'll try each one and see which one produces better random numbers.

So in my code I should do this:


I would just have to do that?

------------------------
Visit my website of Games!
http://dabip.stonerocket.net

Login to post a reply

Server time is: 2025-05-22 20:30:18
Your offset time is: 2025-05-22 20:30:18