Thread

Vanishing Instances (Sdk)

Vanishing Instances // Sdk

1  |  

percipient

Oct 31, 2001, 4:57am
I'm programming a bot that has four instances; one in each quadrant of a
40x40 world. Trouble is, some of the instances vanish from the world,
sometimes just as soon as they enter. Always the last create/logged in
instance will stay in the world. AW_WORLD_DISCONNECT event is not triggered
when the other instances leave.

Anyone have any bright ideas what may be wrong? You help is much
appreciated. I'm programming in Borland C++, by the way.

Percipient

ananas

Oct 31, 2001, 6:10am
I had an effect like this when I didn't have an
aw_wait() active for some time.

[View Quote] --
"_
|
/\
\ /
__/ /_

andras

Oct 31, 2001, 12:40pm
[View Quote] Ananas is correct. Drag a TTimer to your form, set ti time period to 100 ms and within it's timer routine call aw_wait(1)

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
if (BotIsRunning) aw_wait(1); // just have 100 msec polling with 1 ms wait
// do other stuff in every 100 ms
}

Andras

grimble

Nov 1, 2001, 9:05am
Its been a while for me, but it sounds like you're only issuing the aw_wait
using the last allocated session number. I've always used one timer per bot,
setting the session number (aw_instance_set) before the aw_wait each time.

Grims


[View Quote]

andras

Nov 1, 2001, 11:27am
Session numbers/instances has nothing to do with aw_wait(). I never set it and sometimes I have 30+ bots running at once.
Andras

[View Quote]

percipient

Nov 1, 2001, 4:25pm
That seems to have done it. I already has a timer set at 500ms calling
aw_wait(0), but I guess that wasn't right, even if I think that's what XelaG
said he did.
Now I have a timer at 100ms calling aw_wait(10), I'll fiddle with these
numbers a bit to see what happens. I suppose that main reason for the
problem was calling aw_wait(0), instead of something bigger than 0?
Anyway, thanks for the help. Moving right along...

Percipient


"andras" <andras at andras.net> wrote...

Ananas is correct. Drag a TTimer to your form, set ti time period to 100 ms
and within it's timer routine call aw_wait(1)

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
if (BotIsRunning) aw_wait(1); // just have 100 msec polling with 1 ms wait
// do other stuff in every 100 ms
}

Andras

andras

Nov 1, 2001, 4:41pm
Don't call aw_wait() with a long time period - it is just a waste of CPU cycles and it will slow down your program. The value given in the parameter is simply a forced idle period - nothing will happen during that time.

Andras


[View Quote]

grimble

Nov 1, 2001, 6:16pm
lol ... I guess that bit doesn't belong in the bot class afterall then.
Something to remember in the future.

Cheers,

Grims

[View Quote]

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn