Sys_Time still Unaccessable?

About advanced scenes, and the Thyme scripting language used in Algodoo.

Sys_Time still Unaccessable?

Postby Blazemann » Mon Sep 07, 2009 2:41 am

Is the system time accessable in algodoo? If yes, how?
User avatar
Blazemann
 
Posts: 151
Joined: Tue Sep 01, 2009 1:19 am

Re: Sys_Time still Unaccessable?

Postby niffirg1 » Mon Sep 07, 2009 6:18 am

You mean like sim.time?
User avatar
niffirg1
 
Posts: 376
Joined: Mon Aug 31, 2009 10:31 pm
Location: The Great American South!

Re: Sys_Time still Unaccessable?

Postby Blazemann » Mon Sep 07, 2009 6:58 am

No, I mean the System Time.
User avatar
Blazemann
 
Posts: 151
Joined: Tue Sep 01, 2009 1:19 am

Re: Sys_Time still Unaccessable?

Postby kilebantick » Mon Sep 07, 2009 8:37 am

I think that emil let it remain that way, so that people can not change the time on your computer XD
Image
User avatar
kilebantick
 
Posts: 1267
Joined: Tue Sep 01, 2009 9:50 am

Re: Sys_Time still Unaccessable?

Postby gradyfitz » Mon Sep 07, 2009 10:04 am

Blazemann wrote:Is the system time accessable in algodoo? If yes, how?

It is, if you need a quieter method, describe how you'd want it done, and I'll help.

Algodoo receives these values in the variables:
Scene.my.Year (Year),
Scene.my.Month (Month),
Scene.my.Day (Day),
Scene.my.Hour (Hour),
Scene.my.Min (Minute) and
Scene.my.Second (Second).

You will need to have anyone use this program whenever you want to use system time :D.

The source code is as follows:
Code: Select all
#include <Windows.h>
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;

void UpdateLoop ();

int main(int argc, char *argv[])
{
    int x = 7;
    int y = 8;
    cout << "Beginning time upadate loop now..." << endl;
   
    for (x = 9; x> y; x++)
        UpdateLoop();

    cout << "Passed time update loop, there has been a problem in execution";
    system("PAUSE");
    return EXIT_SUCCESS;
}

void UpdateLoop()
{
        ofstream LocalTime;
        LocalTime.open("communication.cfg",ios::trunc|ios::out);
        SYSTEMTIME st;
        GetSystemTime(&st);
        LocalTime << "Scene.my.Year = " << st.wYear << ";\nScene.my.Month = " << st.wMonth << ";\nScene.my.Day = " << st.wDay << ";\nScene.my.Hour = " << st.wHour << ";\nScene.my.Min = " << st.wMinute << ";\nScene.my.Second = " << st.wSecond << ";\n";
        LocalTime.close();
        Sleep(100);
}

:D
Attachments
Local Time.rar
LocalTime 3 (Version 2)
I hope I chose the right file :).
Provided it is, this program will update the system time in phun constantly (as long as you run it).
(104.38 KiB) Downloaded 33 times
Mechanisms: 18 Mechanisms.
Thyme: Tutorial - Variables/Commands List.
Thymechanic
gradyfitz
 
Posts: 174
Joined: Tue Sep 01, 2009 8:33 am
Location: Victoria, Australia

Re: Sys_Time still Unaccessable?

Postby Blazemann » Mon Sep 07, 2009 4:51 pm

Thanks Grady, think I will pass thous if it isn't internal.
User avatar
Blazemann
 
Posts: 151
Joined: Tue Sep 01, 2009 1:19 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest