The Dink Network

random talking issue

April 3rd 2011, 09:27 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
well i wanted a sprite to say random stuff telling how bored it is etc. etc.
and well first time i used the system in a script so i'm well aware the mistake might be a noobish mistake. but as with all experienced scripter they had to begin somewhere and ask help from time to time.

well for now here is the talk segment and please help me out els e i might not make the deadiline

void talk (void)
{
int &rndme random(4,0)
if (&rndme == 0)
 {
 say("`3Thank god you can't litterally bore yourself to death",&current_sprite);
 }
if (&rndme == 1)
 {
 say("`3I'm so bored",&current_sprite);
 }
if (&rndme == 2)
 {
 say("`3I wish someone lively'd up this place",&current_sprite);
 }
if (&rndme >= 3)
 {
  say("`3When i moved here i wanted peace and quiet but this is just boring.",&current_sprite);
 }
}


any hep is welcome providing it is help and not scolding and such
April 3rd 2011, 09:33 AM
dinkdead.gif
int &rndme random(4,0)

should be
int &rndme = random(4,0);


I always forget exactly how random() works but I think random(4, 0) will return 0,1,2, or 3, not 4.
Random number between 0 (inclusive) and 0+4 (ie 4 - but not inclusive).

And don't worry we don't bite people's heads off! Usually
April 3rd 2011, 09:33 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
int &rndme random(4,0)


This is missing stuff

int &rndme;
&rndme = random(4,0);


This would work best. You can do it in one line, but I think it's better practice (in Dink) to declare it seperately because you can't redeclare a variable twice.

EDIT: ARGH! SPARROW!
April 3rd 2011, 09:43 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
ok thanks Kyle your's worked dunno why but the 1 line version never changed the chosen line. with that fixed i can now place more victims to slaughter .