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 / Help and Hello

Author
Message
Thane
20
Years of Service
User Offline
Joined: 17th Jan 2004
Location:
Posted: 17th Jan 2004 19:56
This is my first post so I think I would like to take this memorable occasion and say hello... Secondly I need some help because I fall on my head allot... Any how how exactly do you create a random number and then turn it into say a# ??? Please explain in a simple way because... I fall on my head allot...

P.S. Grand theft auto vice city is a cruel mistress!

Maths as abstract art:
b#=c#=b#=c#=b#=1000=f#=g#=b#=600=f#=4000=g#=7000=b#=c#
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 17th Jan 2004 20:01
welcome.

fltMyRandomVar as Float
Randomize Timer()
fltMyRandomVar=Rnd(9)+1

this will get you a random number from 1 and 10
rnd() actually returns integers from 0 to number specified so if you want to include zero, knock off the +1 part and change 9 to 10

hope this helps

-RUST-

Thane
20
Years of Service
User Offline
Joined: 17th Jan 2004
Location:
Posted: 17th Jan 2004 20:07 Edited at: 17th Jan 2004 20:09
Thank you however where would the algerbriac number be in that for example if you used that system how would you do something like this:

if a#=1 then print "dodo"
if a#=2 then print "modo"
if a#=3 then print "podo"
if a#=4 then print "sodo"
ect?

~As I said I do fall on my head allot...

Maths as abstract art:
b#=c#=b#=c#=b#=1000=f#=g#=b#=600=f#=4000=g#=7000=b#=c#
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 17th Jan 2004 20:47
use fltA instead of fltMyRandomVar. doesn't matter what you name it, a variable is a variable and it's the type that counts. Since you want A to be a # (float) then I would declare it

fltA as float

then fill it with:

Randomize Timer()
fltA=Rnd(9)+1

if fltA=1....
if fltA=2....
etc

but you should really use an integer for this so do:

intA as Integer
Randomize Timer()
intA=Rnd(9)+1

if intA=1....
if intA=2....
etc

no need to waste memory with a float when rnd() returns integers



-RUST-

Thane
20
Years of Service
User Offline
Joined: 17th Jan 2004
Location:
Posted: 18th Jan 2004 16:52
Thank you, it works very well.

Maths as abstract art:
b#=c#=b#=c#=b#=1000=f#=g#=b#=600=f#=4000=g#=7000=b#=c#
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 18th Jan 2004 18:50
Glad to help.


-RUST-

Login to post a reply

Server time is: 2024-09-21 15:34:24
Your offset time is: 2024-09-21 15:34:24