Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Is there have timer in the WME?  (Read 3808 times)

0 Members and 1 Guest are viewing this topic.

yaobifeng

  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • View Profile
Is there have timer in the WME?
« on: April 08, 2008, 06:39:57 AM »

hi,
I want to use a timer to get some data from server,ex get a string from the server per 3000ms,how can i do in the WME?Thinks.
another problem,i want to use a tread to get the data from the server,is tread supported in the wme?
Logged

MMR

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 349
  • http://mmrdeveloper.wordpress.com/
    • View Profile
    • TinyWME
Re: Is there have timer in the WME?
« Reply #1 on: April 08, 2008, 09:28:21 AM »

Timer:

You can have a script attached to your main script with something like this:

while(true)
{

    // code doing whatever you want

    Sleep(3000);
}

This will execute your code each 3000 milliseconds (3 seconds)

To attach a script to your main game script use this --> Game.AttachScript(script_file_name);

 ;)

Thread:

Each script is executed in a separated thread. So you only have to define the code you want in a separated script and attach it to your Scene or globally to your game's main script
« Last Edit: April 08, 2008, 09:31:12 AM by MMR »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Is there have timer in the WME?
« Reply #2 on: April 08, 2008, 09:37:48 AM »

However these are NOT hardware threads. WME does virtual threading for scripts, but the engine itself runs in a single thread.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

yaobifeng

  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • View Profile
Re: Is there have timer in the WME?
« Reply #3 on: April 08, 2008, 10:08:27 AM »

it's greatful。aha,the engine is powerful,thanks very much.i'm a chinese and is developing a simulation game for education。i found few of people know this engine in china,so i decide to write some articles to introduce it,i also want to translate the help document to chinese,can i do it?
thinks for Mnemonic's greatful working again。 ;)
Logged

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog
Re: Is there have timer in the WME?
« Reply #4 on: April 08, 2008, 10:14:28 AM »

i am sure if you made a translation mnem would post it on the wiki with the Russian version and stuff.
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Is there have timer in the WME?
« Reply #5 on: April 09, 2008, 06:58:25 AM »

i found few of people know this engine in china,so i decide to write some articles to introduce it,i also want to translate the help document to chinese,can i do it?
Oh that would be great :) I got the impression point'n'click adventure games weren't too popular in China in general. Or am I wrong?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.049 seconds with 20 queries.