Be a Supporter!

The Flash 'Reg' Lounge

  • 1,689,613 Views
  • 64,073 Replies
New Topic Respond to this Topic
Paranoia
Paranoia
  • Member since: Apr. 22, 2005
  • Offline.
Forum Stats
Member
Level 35
Game Developer
Response to The Flash 'Reg' Lounge 2008-03-23 14:38:13 Reply

At 3/23/08 02:31 PM, crushy wrote: Two Known UOTD's

In such a small amount of time too... wierd.

Coding Help :)

Does anyone know of a way that I can get a random number up to 20 randomly added OR taken away from a variable. So one time I could get plus 12 and another I could get minus 3. Any help would be much appreciated.

Yeah sure:

return(20 - Math.floor(Math.random() * 41));

Knock yourself out :P


BBS Signature
UnknownFury
UnknownFury
  • Member since: Aug. 10, 2005
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to The Flash 'Reg' Lounge 2008-03-23 14:46:17 Reply

At 3/23/08 02:38 PM, Paranoia wrote: Yeah sure:

return(20 - Math.floor(Math.random() * 41));

Knock yourself out :P

What does Math.floor do?

crushy
crushy
  • Member since: Sep. 17, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 14:47:26 Reply

At 3/23/08 02:38 PM, Paranoia wrote:
At 3/23/08 02:31 PM, crushy wrote: Coding Help :)
return(20 - Math.floor(Math.random() * 41));

Heh, that's two things you've helped me with this week, Thanks :D


BBS Signature
crushy
crushy
  • Member since: Sep. 17, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 14:49:03 Reply

At 3/23/08 02:46 PM, UnknownFury wrote:
At 3/23/08 02:38 PM, Paranoia wrote:
What does Math.floor do?

Rounds numbers to the nearest significant figure.


BBS Signature
BoMToons
BoMToons
  • Member since: Nov. 29, 2005
  • Offline.
Forum Stats
Moderator
Level 38
Game Developer
Response to The Flash 'Reg' Lounge 2008-03-23 14:49:26 Reply

I think this is Glaiel at the piano...amirite?

http://www.youtube.com/watch?v=tgT9OdVmL 4s

UnknownFury
UnknownFury
  • Member since: Aug. 10, 2005
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to The Flash 'Reg' Lounge 2008-03-23 15:04:14 Reply

At 3/23/08 02:49 PM, crushy wrote:
At 3/23/08 02:46 PM, UnknownFury wrote:
At 3/23/08 02:38 PM, Paranoia wrote:
What does Math.floor do?
Rounds numbers to the nearest significant figure.

oh okay.

1.49029052 will be rounded to 1?
241242 will be rouned to 200000?

Sweet ^^

DarkMana
DarkMana
  • Member since: Apr. 4, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 15:15:28 Reply

Math.floor() rounds down to the nearest integer.

Math.floor(1.99) == 1

Math.ceil() rounds up to the nearest integer.

Math.floor(1.01) == 2

Asus P5Q PRO, Intel E8400 @ 3.60 GHz, 4GB DDR2-1000, ATI HD4850

BBS Signature
DarkMana
DarkMana
  • Member since: Apr. 4, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 15:16:58 Reply

At 3/23/08 03:15 PM, DarkMana wrote: Math.floor(1.01) == 2

ARG. I meant...

Math.ceil(1.01) == 2

Asus P5Q PRO, Intel E8400 @ 3.60 GHz, 4GB DDR2-1000, ATI HD4850

BBS Signature
adman
adman
  • Member since: Jun. 26, 2005
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 15:16:58 Reply

At 3/23/08 03:15 PM, DarkMana wrote: Math.ceil() rounds up to the nearest integer.

Math.floor(1.01) == 2

*Math.ceil(1.01) == 2

there you go :)


.

BBS Signature
UnknownFury
UnknownFury
  • Member since: Aug. 10, 2005
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to The Flash 'Reg' Lounge 2008-03-23 15:20:03 Reply

Okay then. So crushy was wrong? :P

crushy
crushy
  • Member since: Sep. 17, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 15:20:32 Reply

At 3/23/08 02:49 PM, crushy wrote:
At 3/23/08 02:46 PM, UnknownFury wrote:
At 3/23/08 02:38 PM, Paranoia wrote:
What does Math.floor do?
Rounds numbers to the nearest significant figure.

Whoops, sorry got my maths lingo mixed up, it just rounds the decimal places to whole numbers.


BBS Signature
Paranoia
Paranoia
  • Member since: Apr. 22, 2005
  • Offline.
Forum Stats
Member
Level 35
Game Developer
Response to The Flash 'Reg' Lounge 2008-03-23 15:23:51 Reply

At 3/23/08 03:04 PM, UnknownFury wrote:
At 3/23/08 02:49 PM, crushy wrote:
At 3/23/08 02:46 PM, UnknownFury wrote:
At 3/23/08 02:38 PM, Paranoia wrote:
What does Math.floor do?
Rounds numbers to the nearest significant figure.
oh okay.

1.49029052 will be rounded to 1?
241242 will be rouned to 200000?

Actually, it rounds down to the nearest integer:

Math.round(); // rounds to whatever the nearest integer is
Math.floor(); // rounds down (i.e. always returns a lower or equal value)
Math.ceil();  // rounds up (i.e. always returns a higher or equal value)

When you're working with probabilities you should pretty much always use floor and ceil instead of round, otherwise you'll end up with an imbalance. For example, with:

Math.round(Math.random() * 3);

To return 0, a number needs to be less than 0.5, to return 3 it needs to be greater than or equal to 2.5, but for any other numbers it can be .5 above or below:

Math.round(Math.random() * 3);

Chance of returning 0 - 1/6
Chance of returning 1 - 1/3
Chance of returning 2 - 1/3
Chance of returning 3 - 1/6

By using floor and ceil you can ensure equal probabilities all round :)


BBS Signature
DarkMana
DarkMana
  • Member since: Apr. 4, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 15:24:02 Reply

At 3/23/08 02:49 PM, crushy wrote: Rounds numbers to the nearest significant figure.

How could it round an arbitrary number to a significant figure when there's no arithmetic or function going on?

In terms of significant figures:
3000 + 100 = 3000
10 * 2.05 = 20

... you can't just decide which figures are significant, it's all about the mathematical operation and other number(s) involved.


Asus P5Q PRO, Intel E8400 @ 3.60 GHz, 4GB DDR2-1000, ATI HD4850

BBS Signature
Paranoia
Paranoia
  • Member since: Apr. 22, 2005
  • Offline.
Forum Stats
Member
Level 35
Game Developer
Response to The Flash 'Reg' Lounge 2008-03-23 15:28:36 Reply

At 3/23/08 03:24 PM, DarkMana wrote: ... you can't just decide which figures are significant, it's all about the mathematical operation and other number(s) involved.

Ahem, a significant figure is the first non-zero number when reading from the left:

1 - one significant figure
0.23423 - five significant figures
0.000021 - two significant figures
1200000 - two significant figures

Or if you want to look at it as Flash probably sees it:

1E0 - one significant figure
2.3423E-1 - five significant figures
2.1E-5 - two significant figures
1.2E5 - two significant figures

BBS Signature
UnknownFury
UnknownFury
  • Member since: Aug. 10, 2005
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to The Flash 'Reg' Lounge 2008-03-23 15:30:39 Reply

Thanks paranoia. *Goes through current script and changes all the rounds*

Also, Imagine I have an dynamic textbox contained within a movieclip. How comes when the movieclips alpha is 0 the textbox is still visible? If I change it in the properties panel the text box disappears with the mc but if I change it via actionscript it doesn't. Is it because I'm setting a value to the text box so it assumes it has to stay visible? Ways around this?

DarkMana
DarkMana
  • Member since: Apr. 4, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 15:31:39 Reply

At 3/23/08 03:28 PM, Paranoia wrote: Ahem, a significant figure is the first non-zero number when reading from the left:

Damn my tenth grade math teacher.


Asus P5Q PRO, Intel E8400 @ 3.60 GHz, 4GB DDR2-1000, ATI HD4850

BBS Signature
adman
adman
  • Member since: Jun. 26, 2005
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 15:31:54 Reply

OK while the programmers talk about their programming stuff.. i have an art quesrtiton..

I recently went on work experiance and used photoshop a hell of a lot more then i did at home.. and the dude taught me how to use the fountain pen tool.. does anybody else use this?


.

BBS Signature
Mogly
Mogly
  • Member since: Sep. 5, 2004
  • Offline.
Forum Stats
Member
Level 25
Animator
Response to The Flash 'Reg' Lounge 2008-03-23 15:34:07 Reply

Sorry for a bit of irrelevance..

But I keep seeing this thread now and thinkin bloody hell the Artist showcase is getting popular again. Im not used to this thread having all these pages.


WEBSITE
BLOG ~ Dont fuck around with my dog. All that I can see I steal. ~
NG FFR ~ Automatic for the people.

BBS Signature
UnknownFury
UnknownFury
  • Member since: Aug. 10, 2005
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to The Flash 'Reg' Lounge 2008-03-23 15:35:48 Reply

At 3/23/08 03:31 PM, DarkMana wrote:
At 3/23/08 03:28 PM, Paranoia wrote: Ahem, a significant figure is the first non-zero number when reading from the left:
Damn my tenth grade math teacher.

I knew that :D
Whats the equivalent of tenth grade in england? 'cause I swear I learnt that years ago o.O

adman
adman
  • Member since: Jun. 26, 2005
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 15:37:38 Reply

I learnt that last year.. im in year 10 now :)


.

BBS Signature
UnknownFury
UnknownFury
  • Member since: Aug. 10, 2005
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to The Flash 'Reg' Lounge 2008-03-23 15:37:51 Reply

At 3/23/08 03:31 PM, adman1993 wrote: OK while the programmers talk about their programming stuff.. i have an art quesrtiton..

I recently went on work experiance and used photoshop a hell of a lot more then i did at home.. and the dude taught me how to use the fountain pen tool.. does anybody else use this?

The pen tool is a fantastic tool and is extremely useful. What were you using instead? It can take a while to master it but its so useful :3

Sorry for double post.
adman
adman
  • Member since: Jun. 26, 2005
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 15:40:21 Reply

At 3/23/08 03:37 PM, UnknownFury wrote: The pen tool is a fantastic tool and is extremely useful. What were you using instead? It can take a while to master it but its so useful :3

Well I mastered it whilst on work experiance.. I was using the line tool then manipulated it.. like bending the lines and stuff or drawing with my tablet then smoothing it over..
But it hit me the other day that im basically doing what is 10x easier with the pen tool :S

Sorry for double post.

Dw i saved you :3


.

BBS Signature
Senti
Senti
  • Member since: Dec. 1, 2003
  • Offline.
Forum Stats
Member
Level 38
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 15:46:11 Reply

At 3/23/08 03:31 PM, adman1993 wrote: I recently went on work experiance and used photoshop a hell of a lot more then i did at home.. and the dude taught me how to use the fountain pen tool.. does anybody else use this?

Whew, a break in the NUMBERS. I was about to starting talking about the color red or something...

The pen tool really is an amazing, and possibly the most powerful tool in photoshop. When cutting out images from the backgrounds I used to only use the magnet-lasso tool but after learned how to use the pen tool a couple years ago I've never gone back. The ability to edit an infinite amount of points on a line at any given time to make the EXACT PERFECT shape is something that has proved invaluable.


BBS Signature
Glaiel-Gamer
Glaiel-Gamer
  • Member since: Dec. 28, 2004
  • Offline.
Forum Stats
Member
Level 28
Game Developer
Response to The Flash 'Reg' Lounge 2008-03-23 15:47:51 Reply

At 3/23/08 02:49 PM, BoMToons wrote: I think this is Glaiel at the piano...amirite?

http://www.youtube.com/watch?v=tgT9OdVmL 4s

ya that's me... I did a better job on route 66 though (had a solo in that one).

Bezman
Bezman
  • Member since: Aug. 16, 2001
  • Offline.
Forum Stats
Member
Level 29
Melancholy
Response to The Flash 'Reg' Lounge 2008-03-23 16:03:28 Reply

At 3/23/08 07:28 AM, dELtaluca wrote: ^^ 3D fluid dynamics simulation, only got the fluid itself simulated, no densities or particles or anything running in it obviously.

I agree that that looks awesome.

Will you upload videos?

Happy New Year

I'm a couple days late but enh.

Glaiel-Gamer
Glaiel-Gamer
  • Member since: Dec. 28, 2004
  • Offline.
Forum Stats
Member
Level 28
Game Developer
Response to The Flash 'Reg' Lounge 2008-03-23 16:07:08 Reply

At 3/23/08 03:46 PM, Senti wrote: Whew, a break in the NUMBERS. I was about to starting talking about the color red or something...

Hmm the color red eh?

Known as 0xFF0000 to us nerds right? FF0000 is a hexidecimal number, which is similar to a decimal number (base 10) which we count in but is actually base 16 instead, so F is actually a number, not a letter. F = 15. There's a 15 in the 16^4 and 16^5 places, so 15*16^4 + 15*16^5 is what FF0000 stands for. Pretty neat if you think about it.

We use hex because it translates to binary easier than decimal. FF0000 can be translated as

1111 1111 0000 0000 0000 0000

a simple 4 digit replacement of hex digits with binary digits, so the computer can think a lot easier than having to perform more intensive tasks of converting our base-10 system to binary.

So back to red I guess.

The color red is perceived when our eyes detect a photon with a wavelength of ~625-740 NM (1 nm = 1x10^-9 m, or 1 billionth of a meter). Fun stuff, even though some colorblind people are missing the appropriate cells to detect that color, or distinguish it from other colors.
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah cock joke blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah....

UnknownFury
UnknownFury
  • Member since: Aug. 10, 2005
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to The Flash 'Reg' Lounge 2008-03-23 16:14:13 Reply

At 3/23/08 04:07 PM, Glaiel-Gamer wrote: stuff

hehe, I love you :3

I actually knew and understood all(I think, if not most) of that up untill 'The color red is perceived when our eyes detect a photon with a wavelength of ~625-740 NM'. My intelligence is increasing. One day I shall be as intelligent as you, bitch. Watch out.

crushy
crushy
  • Member since: Sep. 17, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 16:29:17 Reply

I made something. Please test it. http://spamtheweb.com/ul/upload/230308/7 3295_StockMarketC.php


BBS Signature
adman
adman
  • Member since: Jun. 26, 2005
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to The Flash 'Reg' Lounge 2008-03-23 16:33:13 Reply

Can we dumb down a bit..? Im feeling dumb :P All i can do is draw :3


.

BBS Signature
Glaiel-Gamer
Glaiel-Gamer
  • Member since: Dec. 28, 2004
  • Offline.
Forum Stats
Member
Level 28
Game Developer
Response to The Flash 'Reg' Lounge 2008-03-23 16:38:13 Reply

At 3/23/08 04:33 PM, adman1993 wrote: Can we dumb down a bit..? Im feeling dumb :P All i can do is draw :3

Ok, stare at this drawing for a while

The Flash 'Reg' Lounge