Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Controlled random script
From: Paul Hagwood
Date: Fri, 09 Feb 2001 15:54:13 -0000

Hello List,

I have something that I know should be very simple but
I'm having a heck of a time...especially since my math
is for poop.

What I would like to do is create a script that sets a
bunch of objects to a random display. I have 14
objects and I need to make sure that they are randomly
displayed but they do not repeat. In other words, I
want to see 14 unique objects on the screen, then
click a button or something and see the same 14
objects displayed again but in a different random
order. Make sense?
Here is what I have so far:

for (var i = 1; i <= 14; i++) {
eval("p" add i).gotoAndStop("potion" add i);
}
for (var i =1; i <= 14; i++) {
px = parseInt(math.random() * 14) + 1;
py = parseInt(math.random() * 14) + 1;
eval("p" add px).gotoAndStop("potion" add py);
eval("p" add py).gotoAndStop("potion" add px);
}

This should swap the potions and make sure I don't get
repeats, but it doesn't work. My puny brain hurts now.

Can anyone help?

=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Paul Hagwood
Multimedia Illustrator
http://www.mindspring.com/~hagwood2
http://www.satyrinteractive.com

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/



[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]