Jump to content

Recommended Posts

  • 4 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Premium

I don't know what do you mean as "void" but do not do infinite while loops in the game, that blocks the thread. Use the built-in timer to achieve your goal:
 

// Initialize the event
static LPEVENT YourEvent = NULL;
 
// Create the event information struct. You can pass values to the timer by adding them here.
EVENTINFO(this_is_your_event_information)
{
     // Just pass one value
     int value;
};
 
// Create the function of the event
EVENTFUNC(this_is_your_event)
{
    /* This is your event function, you can do anything here */

    // To reach your passed values, you have to do this
    this_is_your_event_information* info = dynamic_cast<this_is_your_event_information*>( event->info );
    // Get the value
    DoSomething(info->value);
 
    // The return value is the time of your re-execution
    return 5 * 25; // So this function will be called again in 5 seconds
}
 
/* To start your event */
 
// Allocate the event informations
this_is_your_event_information* info = AllocEventInfo<this_is_your_event_information>();
// Set a value of your variable
info->value = 3;
// Start the event
YourEvent = event_create(this_is_your_event, info, 5 * 25);
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.