The Dink Network

Reply to Weird script problem

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
April 8th 2006, 08:31 PM
anon.gif
Neo
Ghost They/Them
 
Take a look at this:

void main( void )
{
int &counter = 0;
ing &wait;
loop:
int &randx = random(630, 20);
int &randy = random(440, 30);

int &en = create_sprite(&randx, &randy, 9, 349, 1);
sp_base_walk(&en, 340);
sp_speed(&en, 3);
sp_timing(&en, 66);
&counter += 1;
if (&counter < 10)
{
goto loop;
}

// pool:
// speak();
// &wait = random(1000, 1000);
// wait(&wait);
// goto pool;

}

void speak( void )
{
int &crap = get_rand_sprite_with_this_brain(9, &current_sprite);
say_stop_npc("I'm talking!", &crap);
}

This script is about to create ten people, and then make a routine that every 1-2 seconds one of them will say "I'm talking!".
But it doesn't work.

If I leave this script as it looks above, it works. It makes ten wandering guys.

But if I uncomment commented lines (which should enable the script to randomly call speak() function), it doesn't work properly. There are not TEN people, but ONE HUNDRED (Ack!), and it happens that TEN of them at the same time say "I'm talking!".

Weird. I think that this may be bug either in my code or in DinkC engine either...