What Is the Correct Way to Perform Action Periodically? menu

User Tag List

Results 1 to 2 of 2
  1. #1
    culater's Avatar Member
    Reputation
    10
    Join Date
    Dec 2021
    Posts
    14
    Thanks G/R
    0/9
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What Is the Correct Way to Perform Action Periodically?

    What would you say is the best way to perform an action periodically?
    For instance - write to log "message1" every 0.5 seconds and "message2" every 4 seconds.
    The obvious ways I could think of were:
    • Make a scheduler thread that times everything itself, but I'm afraid turbohud may be in an undefined state if not accessed from a callback.
    • Add my code to an existing callback that happens often, for instance "aftercollect", and check the times there, but I'm afraid it might be too inaccurate.

    Is there any elegant solution I'm not aware/thinking of?

    What Is the Correct Way to Perform Action Periodically?
  2. #2
    Razorfish's Avatar Contributor
    Reputation
    188
    Join Date
    Apr 2019
    Posts
    178
    Thanks G/R
    19/158
    Trade Feedback
    0 (0%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    That kind of programming is not really my forte (I just learn as I go), but I've seen other plugin writers go the route of using separate threads to execute timed commands. They usually bump into the issue of getting concurrency errors when inevitably their thread tries to access TH data that is in the process of being updated. If your timed command needs to evaluate the current state of the game, your actions really should wait until AfterCollect() to execute anyway. I can't think of anything that needs the kind of accuracy you're concerned about. What sort of scenario are you thinking of?

Similar Threads

  1. Replies: 11
    Last Post: 08-07-2008, 07:29 PM
  2. What is the best way to Glide?
    By Mask in forum World of Warcraft General
    Replies: 1
    Last Post: 07-11-2008, 01:20 PM
  3. What is the sinplest way to make a private server
    By Spitty305 in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 09-07-2007, 04:01 PM
  4. What is the best way to get gold
    By Dajoker in forum World of Warcraft General
    Replies: 7
    Last Post: 12-05-2006, 02:08 AM
All times are GMT -5. The time now is 03:51 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search