Page 1 of 1

Playing Random music

PostPosted: Wed Jul 15, 2009 6:36 pm
by trippola77
How would I make a title play between two different songs randomly.

I used this (sound1 is a variable).

sound1=rand(2);

if(sound1=1)
{
playmusic..........blah blah
}

if(sound1=2)
{
palymusic...... blahh
}


but once i did it, it only played one song and the other one wouldnt play.
could you guys help
/

Re: Playing Random music

PostPosted: Wed Jul 15, 2009 7:45 pm
by skydereign
rand(2) picks a random number, in this case 0 or 1. So it is a random number not including the number in parenthesis It will never pick 2... Also the if statements, instead of =, they need ==
Code: Select all
sound1=rand(2);

if(sound1==1)
{
playmusic..........blah blah
}

if(sound1==2)
{
palymusic...... blahh
}