[Request] Handling Wait/Sleep Within Pulse/EndScene menu

Shout-Out

User Tag List

Results 1 to 11 of 11
  1. #1
    Shadowhunter12's Avatar Member
    Reputation
    1
    Join Date
    Sep 2012
    Posts
    44
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Request] Handling Wait/Sleep Within Pulse/EndScene

    Good Morning Everyone,

    I was wondering how people handle this scenario. I am currently using Apoc's FSM to execute logic which is triggered during my Pulse from my EndScene hook. The issue I am trying to work through now is how people handle adding in "Wait" or "Sleep" logic between statements?

    For example, say I want to cast a spell and then sleep for 2 seconds and then cast another spell. Since my logic is being executed on the EndScene thread, sleeping the thread isn't the way to go.

    If anyone has a moment to share how they dealt with this issue I would greatly appreciate it.

    Thanks in advance!

    -Shadow

    [Request] Handling Wait/Sleep Within Pulse/EndScene
  2. #2
    ccKep's Avatar Member
    Reputation
    11
    Join Date
    Jan 2010
    Posts
    33
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let's say you want to add a delay between states A and B.

    - Add a new state between A and B (let's call it X)
    - In state A: Set a counter variable to some value (let's call it fDelay) of ms you want state B to delay by.
    - in state X: decrease fDelay by the amount of time elapsed since the last call of endscene.
    - If fDelay < 0 transistion to state B, otherwise remain in X.

  3. #3
    Shadowhunter12's Avatar Member
    Reputation
    1
    Join Date
    Sep 2012
    Posts
    44
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by ccKep View Post
    Let's say you want to add a delay between states A and B.

    - Add a new state between A and B (let's call it X)
    - In state A: Set a counter variable to some value (let's call it fDelay) of ms you want state B to delay by.
    - in state X: decrease fDelay by the amount of time elapsed since the last call of endscene.
    - If fDelay < 0 transistion to state B, otherwise remain in X.
    ccKep,

    Thanks for the quick response. I understand what you are saying, however, what if the delay needs to be in a single state? For example, say your state is "InCombat" and part of your logic is:

    (Disregard the fact that these are heals)
    CastSpell("Rejuvenation")
    Wait(2000)
    CastSpell("Greater Healing")

    Is that even possible to do?

    -Shadow

  4. #4
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No that's not possible that way.

    In general is it a bad idea to call your logic in endscene since it will drop the FPS very very badly. Instead should you execute your logic in another thread and let injected code wait for the next endscene-pulse, execute its code, release the frame and continue as usual.

  5. #5
    Shadowhunter12's Avatar Member
    Reputation
    1
    Join Date
    Sep 2012
    Posts
    44
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Frosttall View Post
    No that's not possible that way.

    In general is it a bad idea to call your logic in endscene since it will drop the FPS very very badly. Instead should you execute your logic in another thread and let injected code wait for the next endscene-pulse, execute its code, release the frame and continue as usual.
    Ahh ok gotcha, so more of a RunInFrameOnce delegate approach mostly for executing scripts, targeting, and CTM movement?

    Makes sense.. Thank you again!

    -Shadow

  6. #6
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, something like that.

  7. #7
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or simply don't sleep. Train conductors aren't sleeping either inbetween stations (hopefully), although they just keep driving at the same speed without changing the direction. They constantly check for changes in the environment to avoid accidents or w/e. What if you channel a 10 sec cast and get interrupted in second 2? Waiting the remaining 8 seconds would be worse a makeshift.

    And if you really want to wait (for whatever reason), just save a timestamp and do nothing until the time elapsed...

  8. #8
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Bananenbrot View Post
    Or simply don't sleep. Train conductors aren't sleeping either inbetween stations (hopefully), although they just keep driving at the same speed without changing the direction. They constantly check for changes in the environment to avoid accidents or w/e. What if you channel a 10 sec cast and get interrupted in second 2? Waiting the remaining 8 seconds would be worse a makeshift.

    And if you really want to wait (for whatever reason), just save a timestamp and do nothing until the time elapsed...
    Exactly.. A FSM should never ever have a sleep. A little article to read: Thread.Sleep is a sign of a poorly designed program. - Peter Ritchie&#39;s MVP Blog

    Using a Pause-State which is able to get passed a condition in which it will constantly check the condition is okay, but not a simple Thread.Sleep since it will slow down everything.



    But one thing I don't get: Why the hell does Apoc recomment to call the FSM in endscene? That's a timecritical part and the completly wrong position for a big FSM.

  9. #9
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think that AI is hamstringing performance (at least it didn't for me), but you definitely should roll out expensive operations to a different thread).
    A single agent AI should never be slow enough to bog down your fps. If it does, you are having serious performance bottlenecks or more likely a bad algorithm for something.

  10. #10
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well depends on what kind of project you're think about: A simple fish-bot which is written within 2 hours or a whole bot with big logics.

  11. #11
    Shadowhunter12's Avatar Member
    Reputation
    1
    Join Date
    Sep 2012
    Posts
    44
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All great responses, thanks again I appreciate it!!

Similar Threads

  1. Joana Mancow Leveling Video Request Thread
    By Matt in forum World of Warcraft General
    Replies: 31
    Last Post: 11-19-2006, 02:54 PM
  2. Never Wait In Que Twice
    By =sinister= in forum World of Warcraft Exploits
    Replies: 3
    Last Post: 06-09-2006, 07:26 AM
  3. [Request] Fishing Bot Guide
    By Cush in forum World of Warcraft General
    Replies: 7
    Last Post: 06-01-2006, 08:26 AM
  4. [Program Request] 1.9.0 hack
    By lopolop in forum World of Warcraft General
    Replies: 1
    Last Post: 05-17-2006, 09:41 PM
  5. Cuergo's Treasure Map No wait Timer!
    By Matt in forum World of Warcraft Exploits
    Replies: 1
    Last Post: 05-03-2006, 01:59 AM
All times are GMT -5. The time now is 12:22 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search