Thread

Time sequencing... (Sdk)

Time sequencing... // Sdk

1  |  

veleno

Oct 14, 1998, 9:55pm
I have my bot. But I want him to be able to recognize the VRT in the
Activeworlds browser. So he can change the backdrop and ground texture
from Night to Day according to the VRT time. How would I get him to do
that?

dthknight

Oct 14, 1998, 10:21pm
code VRT into the bot himself is probably the solution... I don't think
Roland has put a way for SDK bots to find out the VRT time in...

[View Quote]

roland vilett

Oct 14, 1998, 10:35pm
No VRT is not built into the SDK. VRT is simply GMT minus two hours.
You'll have to write your own code in your bot to calculate the current time
in VRT. There are a variety of calls under Windows that can give you the
current time in GMT. time() is one of them.

-Roland

[View Quote]

edward sumerfield

Oct 14, 1998, 10:43pm
When you say "recognize the VRT in the ... browser" what you mean is that
you need to get the current machine time and then adjust it to the VRT
timezone.

Look at the C functions localtime to get the current time. Remember you
don't have to know VRT, just compare the current time with your local times
equivelent to VRT. So if your world server is in NY you would compare 6:00pm
VRT with 3:00pm EST and switch the background textures appropriately.

Edward Sumerfield.

[View Quote]

veleno

Oct 14, 1998, 10:56pm
Alright, I'm still learning C/C++... so I don't know what the time() is or does.
Anybody care to explain how to use it?

[View Quote] > No VRT is not built into the SDK. VRT is simply GMT minus two hours.
> You'll have to write your own code in your bot to calculate the current time
> in VRT. There are a variety of calls under Windows that can give you the
> current time in GMT. time() is one of them.
>
> -Roland
>
[View Quote]

edward sumerfield

Oct 14, 1998, 11:53pm
Its time to get a C book. However let me give it a shot.

time() us a function that returns a tm structure.

struct tm
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};

So you will include the time.h include file to get this struncture and then
call the time() function to get a pointer to it.

#include <stdio.h>
#include <time.h>
main() {
struct tm *now = NULL;
now = time(NULL);
printf("The time now is %02d:%02d:%02d.\n",
now->tm_hours, now->tm_min, now->tm_sec);
}

Simple as that.

Check out this URL for a definition of all the time related functions:

http://www.dinkum.com/htm_cl/time.html#time

Actually this site is an excellent reference for standard C functions.

Edward Sumerfield.

[View Quote]

roland vilett

Oct 15, 1998, 9:06pm
A slight correction here...

time() does not return a tm structure, I believe you are thinking of
localtime(). time() returns a time_t which on most systems is a 32-bit
integer specifying the number of seconds that have elapsed since 12 AM,
January 1, 1970.

There are routines available in the Windows API to convert back and forth
between the various ways of representing time. For example I believe
localtime() takes a time_t as an argument and converts it to a struct tm.

Windows has a dizzying array of different formats for storing time values.
It's almost as if each programming team that developed a certain Windows
subsystem created their own personal time format, complete with their own
series of functions to operate on it...

-Roland

[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