Author Topic: Date/Time Variable and If Statements to activate or skip command  (Read 1024 times)

Usidor

  • Newbie
  • *
  • Posts: 10
1.   Goal one is to create a command that would
   a.   Activate a character ability by pressing a key
   b.   Pause for cast time
   c.   Create a variable for Recast time that can later be checked by a different command using If Statements

2.   Goal 2 is to create a command that will
   a.   Activate or skip a command depending on if its recast time has elapsed or not.

3.   The idea is that I can
   a.   Create 5 commands for each ability the character has that activates the ability, pauses for the ability to be finished and then records when in time the recast will be finished.
   b.   Create a All Abilities Command that will use Execute another command and IF Statements to cycle through those 5 Commands while skipping the abilities on cooldown and activating those abilities that are ready.

5 Abilities
1.   Strike
   a.   Activated by pressing the 1 key
   b.   Cast Time is Instant
   c.   Recast Time is 1.5 Seconds
2.   Whirling Wrath
   a.   Activated by pressing the 2 key
   b.   Cast Time is .75 Seconds
   c.   Recast Time is 6.5 Seconds
3.   Leap of Faith
   a.   Activated by pressing the 3 key
   b.   Cast Time is .5 seconds
   c.   Recast Time is 8 seconds
4.   Symbol of Resolution
   a.   Activated by pressing the 4 key
   b.   Cast Time is .25 seconds
   c.   Recast Time is 9.5 seconds
5.   Binding Blade
   a.   Stage 1
     i.   Activated by pressing the 5 key
    ii.   Cast Time is .75 seconds
   b.   Stage 2
    i.   Activated by pressing the 5 key
   ii.   Cast Time is .75 seconds
  c.   Recast Time is 20 Seconds

The Desired starting cast order is
3 Leap of Faith
4 Symbol of Resolution
5 Binding Blade
2 Whirling Wrath
1 Strike

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Date/Time Variable and If Statements to activate or skip command
« Reply #1 on: August 28, 2022, 02:30:40 PM »
What is your question, specifically?

It appears you've already achieved "Goal one" in the profile you attached.

If you want to prevent multiple ability commands from executing at the same time, make sure to uncheck the "Allow other commands to execute while this one is running" option for those commands.


For "Goal 2" it looks like the "Command that checks if ability is off cool down" command is already a good start as well; you just need to add additional conditions for the different abilities, and arrange them in the order you want them to be activated.

Usidor

  • Newbie
  • *
  • Posts: 10
Re: Date/Time Variable and If Statements to activate or skip command
« Reply #2 on: August 28, 2022, 02:56:02 PM »
This was the issue thanks! ----------->If you want to prevent multiple ability commands from executing at the same time, make sure to uncheck the "Allow other commands to execute while this one is running" option for those commands.



1.   Goal one is to create a command that would
   a.   Activate a character ability by pressing a key
   b.   Pause for cast time
   c.   Create a variable for Recast time that can later be checked by a different command using If Statements

2. Goal 2 is to Create a different command that

   a.   Using a If/else statement could check the date/time recast variable set by Goal one command and then either

          I. Execute Goal one Command and text speech say "Recast timer expired Command successful" if the ability is ready to execute.

          II. Or if the recast time for the ability has not expired then Not Execute the command and text to speech say "Ability still on Cooldown" if the ability is not ready to execute.

ATTACHED the Working Profile.

Thanks!



   

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Date/Time Variable and If Statements to activate or skip command
« Reply #3 on: August 28, 2022, 03:22:51 PM »
4. Do I need to initialize the date/time variable in some way before trying to use the Goal 2 command?
As long as you have the "Evaluate 'Not Set' as 1/1/0001" option enabled (checked) within the condition, which you do, no.

Logically, 0001-01-01 is always before the current date (I.E. it is very much in the past).



If the intent is to be able to activate individual abilities manually as well, what you could do is to check for the cooldown within each individual ability command (I.E. have it check for its own cooldown), and then have the command that activates all of the abilities one-by-one just contain "Execute Another Command" actions.

The latter command wouldn't need to check the cooldowns, as that would already be happening inside the individual commands anyway.


Otherwise, you'll need to clarify what "doesn't seems to be working as intended".

You have the individual ability commands set up correctly, assuming you only want to trigger them using the command that triggers them all in sequence.
All you should need to do is to duplicate the condition you already have for the other abilities (making sure to change the variable names, of course).
If you want TTS feedback, you can add a "Condition Else" action to them as well, and a "Say Something with Text-To-Speech" in each branch.

Usidor

  • Newbie
  • *
  • Posts: 10
Re: Date/Time Variable and If Statements to activate or skip command
« Reply #4 on: August 28, 2022, 03:43:03 PM »
Thank you for that insight.

I have attached another updated profile for anyone that may be curious in the future.