This Week on "N00b Makes a Dialogue GUI"... Timer Troubles

Started by Custerly, Fri 05/01/2024 19:41:55

Previous topic - Next topic

Custerly

Hi all,

So I've got my Dialogue GUI doing everything it needs to do functionally. It's formatting and displaying multiple dialogue options and NPC responses just as desired, and it all looks great.

My next item to address is to implement a timer for a slight delay betweem when a dialogue option is selected and when that text is reflected in the main convo label. At first, I imagined this to be a simple few lines of code and Bob's my uncle, however, what I immediately realized is that implementing a 250 millisecond timer in the middle of a chain of functions that rely on the data in that timer (ie. the dialogue text being displayed) totally breaks my dialogue system.

Is there a way to tell the game to pause everything until the code in the RepEx for the timer has been executed? (other than dumping all of my dialogue system code into the RepEx or ortherwise calling it from there)

Bonus question:
Is there a way to tell when a timer is in use? I know I can check when a timer has expired, but I understand that state only lasts for 1 game cycle before the timer is dormant. If I want to use 1 of 4 timers dynamically based on which one is available, I don't see a way to do that.

Crimson Wizard

Quote from: Custerly on Fri 05/01/2024 19:41:55Bonus question:
Is there a way to tell when a timer is in use? I know I can check when a timer has expired, but I understand that state only lasts for 1 game cycle before the timer is dormant. If I want to use 1 of 4 timers dynamically based on which one is available, I don't see a way to do that.

Not with AGS timers, they are primitive.
I might suggest a timer module where you create timers and save them in variables:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-timer-0-9-0-alternate-variant/

Custerly

Thanks @Crimson Wizard for the module suggestion. I may look into that, though I think I can get by without it since I don't need a tonne of timers.

Regarding the first part of my post, is it so that I will need to essentially place the remainder of my dialogue GUI code after [ if (IsTimerExpired(1)) ] in order to ensure it does not run until the timer expires?

EDIT:
No worries, I figured out a solution to the question posed in the first part of my original post.

SMF spam blocked by CleanTalk