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 / range of numbers

Author
Message
mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 13th Aug 2010 04:35
Hey all,
If I have a variable rng,

rng = 0 to 2 then ToHit= 90
rng = 3 to 5 then ToHit= 90
rng = 6 to 10 then ToHit= 90
rng = 11 to 15 then ToHit= 60
rng = 16 to 20 then ToHit= 30
rng = 21 to 25 then ToHit= 20
rng = 26 to 30 then ToHit= 10
rng = 31 to 40 then ToHit= 10
rng = 41 to 50 then ToHit= 10

and I need to figure how to find out which bracket it falls into? I tried using if statements, didnt work.
How would I code that?

Mike

some cool stuff someone else said here
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 13th Aug 2010 04:52
IF/THEN statements would work if you used the less than and more than signs also.

The = symbol means equal to.
The < symbol means less than.
The > symbol means more than.

So if you wanted a range between 10 and 20 you would say.

if rnd=>10 and rnd<=20 then ...

Which reads out loud:

if rnd is equal to or more than 10 and rnd is less than or equal to 20 then...



mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 13th Aug 2010 04:57
Thanks Grog.

I was working on it and got this far in the time it took you to post.



Now I see why mine would not compile.
You guys on here are great.
Thanks again Grog.

Mike

some cool stuff someone else said here
Dia
19
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 14th Aug 2010 14:14
I also wonder why you have 3 checks for an output of 90 and 3 checks for an output of 10?

it could be written

if rng<11 then tohit=90
...
...
...
if rng>25 then tohit=10

This is not the Sig you are looking for....
mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 14th Aug 2010 19:16
@ Dia,

Your are correct it could be. I just pulled those tables out of a old miniatures game. That is just one set out of 100 or so.
That is just for the 75mmL38. I plan to add all the weapons in data blocks. Even though some values are repeated, I need to keep the format, other weapons values are not repeated, but all use the same range bands.

Hope that makes sense.

Mike

some cool stuff someone else said here
Dia
19
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 15th Aug 2010 07:19
ahh okeydokey gotcha.

This is not the Sig you are looking for....

Login to post a reply

Server time is: 2024-09-28 20:21:19
Your offset time is: 2024-09-28 20:21:19