The Dink Network

script trouble

March 5th 2004, 12:09 PM
pillbug.gif
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.
March 5th 2004, 12:21 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
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).
March 5th 2004, 01:31 PM
pillbug.gif
yeah that is what happens when I try to write shoot from scratch lol.