script trouble
Im trying to make a script that keeps randomly picking one of 2 sounds and plays them. this is what i got so far
void main( void )
{
int &srand;
int &cricket1 = playsound(12, 0, 0, 0, 0);
int &cricket2 = playsound(50, 0, 0, 0 , 0);
&srand = random(3,1);
if &srand == 1 goto &cricket1
if &srand == 2 goto &cricket2
Loop;
}
the script plays the initinal two sounds but doesnt pick a random one and doesent loop.
void main( void )
{
int &srand;
int &cricket1 = playsound(12, 0, 0, 0, 0);
int &cricket2 = playsound(50, 0, 0, 0 , 0);
&srand = random(3,1);
if &srand == 1 goto &cricket1
if &srand == 2 goto &cricket2
Loop;
}
the script plays the initinal two sounds but doesnt pick a random one and doesent loop.
Whoa, bunny man, I think you've completely forgotten DinkC
You're missing parentheses, you can't goto variable names, and some other things. Here's a much more concise version:
void main( void )
{
int &srand;
loop:
&srand = random(2,1);
if (&srand == 1)
{
playsound(12,16000,0,0,0);
}
if (&srand == 2)
{
playsound(50,16000,0,0,0);
}
wait(1000);
goto loop;
}
Change the 16025 numbers to whatever speed the sound is (usually 8000, 16000, or 24000).

void main( void )
{
int &srand;
loop:
&srand = random(2,1);
if (&srand == 1)
{
playsound(12,16000,0,0,0);
}
if (&srand == 2)
{
playsound(50,16000,0,0,0);
}
wait(1000);
goto loop;
}
Change the 16025 numbers to whatever speed the sound is (usually 8000, 16000, or 24000).
yeah that is what happens when I try to write shoot from scratch lol.