Thread

Is there a wait command? (Bots)

Is there a wait command? // Bots

1  |  

lord fett

Jul 15, 2002, 3:15am
How do I make a bot wait between doing actions or saying things? Do I change
the aw_wait time? or is there another command that I can use to pause the
bot for a certain amount of seconds? I am using MS Visual C++

Thanks,
Lord Fett

o0oiiijoshiiio0o

Jul 15, 2002, 9:14am
aw_wait can be used, as is seen in the AW SDK sample program #2 (the DJ).
That's the way I'd advise you to do it, though if you're using MFC, there
are others...
[View Quote]

agent1

Jul 15, 2002, 12:45pm
I wouldn't use aw_wait as a timer because it was never designed for that purpose.

You would probably be better off doing something like this (pseudocode):

int StartTime, CurrentTime;
StartTime = time(NULL);

while((CurrentTime - StartTime) < MILLISECONDS)
{
CurrentTime = time(NULL)
aw_wait(0);
}

-Agent1

[View Quote]

o0oiiijoshiiio0o

Jul 16, 2002, 9:50am
Not designed for that purpose, but that didn't stop the fine people at AW ;)

Anyways, the alternative is to include time.h - I don't have my K&R on hand
(:O) so I can't tell you how to do it, but I know that you get a time_t
struct with all sorts of time information..

-J

[View Quote]

agent1

Jul 16, 2002, 12:17pm
Actually, I've been informed that my code is a bad idea ;)

You could always have the bot start a Windows Timer and wait for that to be triggered before continuing...

-Agent1

[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