Forum Topic: Random Array?

(181 views • 2 replies)

This topic is 1 page long.

<< < > >>
Questioning

ApeLord

Reply To Post Reply & Quote

Posted at: 3/29/06 04:09 PM

ApeLord EVIL LEVEL 15

Sign-Up: 12/24/04

Posts: 1,562

Hello there, im trying to add a small function to my game, can anyone help me out?

_root.namez=new Array("Pad", "Elfred", "Fonboos");

How do I make it so that if _root.playersname ! = "", then _root.playersname = a random name from the array.

Can anyone help me out?

Thanks!


None

BleeBlap

Reply To Post Reply & Quote

Posted at: 3/29/06 04:18 PM

BleeBlap LIGHT LEVEL 24

Sign-Up: 03/08/05

Posts: 945

_root.names = new Array("Bob", "Joe", "Jason", "Fred", "Eric");
if (_root.playerName == null) {
_root.playerName = names[random(5)];
}


Shouting

ApeLord

Reply To Post Reply & Quote

Posted at: 3/29/06 04:31 PM

ApeLord EVIL LEVEL 15

Sign-Up: 12/24/04

Posts: 1,562

Thank you very much Sir.


All times are Eastern Standard Time (GMT -5) | Current Time: 01:10 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!