#✅ | action delay

1 messages · Page 1 of 1 (latest)

wraith estuary
#

so i need a screen for when the game is quitting itself via action script. is there a way i can delay that action so i can put a custom screen before the game closes?

ember crescentBOT
# wraith estuary so i need a screen for when the game is quitting itself via action script. is th...

Hi there! 👋

To achieve a delay before quitting the game, you can't directly add a "wait" action in FancyMenu, as this would freeze your game. However, you can use a Ticker element in combination with FancyMenu's variables and an IF statement to create a delay.

Here's how you can set it up:

  1. Create a New Variable:

    • Go to Customization -> Variables -> Manage Variables in the menu bar.
    • Add a new variable, for example, quit_timer, and set its initial value to 0.
  2. Create a Custom GUI for Your "Quitting" Screen:

    • Go to Customization -> Custom GUIs -> Manage Custom GUIs and create a new custom GUI for your message. You can find more details on how to do this here: Custom GUIs
    • Design this screen with your custom message or animation. Let's call its identifier quitting_message_screen.
  3. Set Up a Ticker Element on Your Custom GUI:

    • Open your quitting_message_screen in the layout editor.
    • Add a Ticker element to your layout.
    • Configure the Ticker:
      • Set its Tick Mode to Normal.
      • Set its Tick Delay to a small value, e.g., 50 milliseconds (this means it ticks 20 times per second, so 20 "timer" counts per second).
#
  • Add Actions to the Ticker (Edit Action Script):
    * Action 1 (Set Variable Value): Add an action set_variable to increment your quit_timer variable. Use the Calculator placeholder for this:
    quit_timer:{"placeholder":"calc","values":{"expression":"{"placeholder":"getvariable","values":{"name":"quit_timer"}} + 1","decimal":"false"}}
    * Action 2 (IF Statement): Add an IF statement.
    * Condition: Use the Is Number requirement to check if quit_timer has reached your desired delay (e.g., 40 for a 2-second delay if your ticker ticks every 50ms).
    * Value: {"placeholder":"getvariable","values":{"name":"quit_timer"}}
    * Compare Mode: bigger-than-or-equals
    * Compare With: 40 (or your desired count for the delay)
    * Action inside IF: If the condition is met, add the quitgame action.
  1. Change Your Original "Quit" Button to Open the Custom GUI:
    • Locate the button that was originally set to quit the game.
    • Change its action script. Instead of quitgame, use the opengui action to open your quitting_message_screen.

This setup will ensure that when you click the "quit" button, your custom message screen appears, a timer counts up in the background, and once the timer reaches your specified value, the game quits.

Let me know if this helps! 😊

wraith estuary
#

in the if statement value, what do i put in number and compare to number? my desired delay before the game quits is ideally 3 seconds

ember crescentBOT
# wraith estuary in the if statement value, what do i put in number and compare to number? my des...

Okay, for a 3-second delay, you would configure the "Is Number" requirement within your Ticker's IF statement like this:

  • Number: {"placeholder":"getvariable","values":{"name":"quit_timer"}} (This always checks the current value of your quit_timer variable.)
  • Compare Mode: bigger-than-or-equals
  • Compare With: For a 3-second delay, since your Ticker ticks every 50ms (20 times per second), you'd want 60 (3 seconds * 20 ticks/second).

So, the full condition for the "Is Number" requirement would be:

["mode":"bigger-than-or-equals","number":"{"placeholder":"getvariable","values":{"name":"quit_timer"}}","compare_with":"60"]

This means the quitgame action will trigger once your quit_timer variable reaches or exceeds 60, effectively creating a 3-second delay! ✨

wraith estuary
#

so do i put 60 as well in the ticker's tick delay properties?

ember crescentBOT
# wraith estuary so do i put 60 as well in the ticker's tick delay properties?

No, please don't put 60 as the Ticker's tick delay! That would make each "tick" 60 milliseconds long. 😉

The Tick Delay should remain at a low value like 50ms (or even 25ms for more precision, but that might increase performance load) so that the quit_timer variable counts up frequently.

The 60 we discussed is the target value for your quit_timer variable (which gets incremented every 50ms) to hit before the game quits, not the delay between each tick of the Ticker itself.

So, to summarize:

  • Ticker Tick Delay: Keep it at 50 ms.
  • IF Statement "Compare With" Value: Set it to 60 (for a 3-second delay, with a 50ms tick delay).

Let me know if that makes sense! 💖

wraith estuary
#

okay so now how to i add the action inside IF?

ember crescentBOT
# wraith estuary okay so now how to i add the action inside IF?

That's a great question! It's a common point of confusion since the interface can be a bit subtle there.

When you're in the "Manage Action Script" screen for your Ticker element:

  1. Add the quitgame action first, just like you would add any other action. It will appear at the bottom of your action list.
  2. Drag and Drop: Now, grab the just-added quitgame action (by clicking and holding on it) and drag it slightly upwards. You'll see a visual indicator (like a line or a highlight) appear to show you where you can place it.
  3. Nest it under the IF statement: Drag the quitgame action directly under your IF Statement but slightly indented. Release the mouse button when you see it snap into place, indented beneath the IF condition.

This indentation indicates that the quitgame action is now a "child" of the IF statement and will only execute if the IF condition (your timer reaching 60) is met.

You can do the same for ELSE IF and ELSE statements if you were using those too!

Let me know if you encounter any difficulties with the drag-and-drop. 😊

wraith estuary
#

so basically my action scripts should be in this order:

  • set variable value
  • IF statement
  • quit minecraft
ember crescentBOT
# wraith estuary so basically my action scripts should be in this order: - set variable value - I...

Not quite! The quit_minecraft action needs to be inside the IF statement.

Your action script for the Ticker element should look structurally like this:

▶ Action Script
│
├─■ Set Variable Value: quit_timer:{"placeholder":"calc","values":{"expression":"{"placeholder":"getvariable","values":{"name":"quit_timer"}} + 1","decimal":"false"}}
│
└─▶ IF (Is Number: quit_timer >= 60)
   └─■ Quit Minecraft

So, when you see it in the "Manage Action Script" editor, the "Quit Minecraft" action should be visibly indented under the "IF" statement. This nesting is crucial for it to only execute when the condition is met.

Does that clarification help visualize it better? 💖

wraith estuary
#

sorry yes thats what i meant.
-actionscript (parent action)
-if statement (parent action)
-quitgame (sub action)

ember crescentBOT
# wraith estuary sorry yes thats what i meant. -actionscript (parent action) -if statement (pare...

Ah, I understand now! My apologies for misunderstanding. It sounds like you've got the hierarchy right in your head.

Yes, that's exactly correct! Your Ticker's action script should have the Set Variable Value action as one main step, and then the IF Statement as another main step. Inside that IF Statement, the Quit Minecraft action should be a sub-action.

So:

  • Set Variable Value (direct child of the main Action Script block)
  • IF Statement (direct child of the main Action Script block)
    • Quit Minecraft (child of the IF Statement block)

This structure ensures the Quit Minecraft action only runs after the timer variable reaches the threshold. You're doing great! 💖

wraith estuary
#

wait its not quitting

ember crescentBOT
# wraith estuary wait its not quitting

Oh no! Let's figure out why it's not quitting. 🤔

To help me understand what might be going on, could you please provide a bit more information?

  1. Can you describe exactly what happens when you expect it to quit? Does nothing happen at all, or does the screen just stay open indefinitely?
  2. Is your quitting_message_screen actually opening? (The screen you designed with your custom message).
  3. Are you seeing the quit_timer variable incrementing? You can check this by displaying the variable's value on your custom screen using a Text element with the placeholder {"placeholder":"getvariable","values":{"name":"quit_timer"}}.
  4. Could you please describe the exact steps you took? Sometimes a small detail in the setup can make a big difference.

No worries, we'll get it working! 😊

wraith estuary
#

my gui opened but no my variable stayed at zero.

so first i added a variable that is set to 0
i made the gui and i added the ticker element, set it to normal with 50ms tick delay. i edited the action scripts the way we discussed it. i went back to my old quit gui to change the action script for the button to open the quitting message gui. i tested it out, it doesnt seem to perform the quitting action

ember crescentBOT
# wraith estuary my gui opened but no my variable stayed at zero. so first i added a variable th...

Hmm, the variable staying at zero is a key piece of information! That tells us the issue is with the Ticker itself or the "Set Variable Value" action within it.

Here's what we need to check:

  1. Is the Ticker element active on your quitting_message_screen?

    • Sometimes elements might have loading requirements that prevent them from activating. Right-click your Ticker element in the editor and check its "Loading Requirements". Is there anything set there that might be preventing it from running? For this purpose, it typically shouldn't have any, or very simple ones.
  2. Double-check the "Set Variable Value" action:

    • Go back to the Ticker's action script.
    • Find the set_variable action you added.
    • Ensure the value is exactly: quit_timer:{"placeholder":"calc","values":{"expression":"{"placeholder":"getvariable","values":{"name":"quit_timer"}} + 1","decimal":"false"}}
    • Make absolutely sure there are no typos, extra spaces, or missing characters (like a bracket) in this string. The nested placeholders can be quite sensitive.
    • Also, ensure this set_variable action is a direct child of the Ticker's action script (at the same level as the IF statement, not nested inside it).
  3. Is your quit_timer variable named exactly quit_timer?

    • Go back to Customization -> Variables -> Manage Variables and confirm the exact spelling and capitalization of quit_timer. It must match precisely in the action script.

If you like, feel free to share a screenshot of your Ticker's "Manage Action Script" screen in Discord. That might help me spot any small details. 😊

Let's get this counter ticking!

wraith estuary
#

i think it works now. but now how do i customize the gui again without it closing my game T-T

ember crescentBOT
# wraith estuary i think it works now. but now how do i customize the gui again without it closin...

Yay, that's progress! 🎉 Glad to hear it seems to be working!

You've hit a super common point now regarding testing. It's indeed annoying to keep quitting your game.
Here's how you can safely customize your quitting_message_screen without the game closing:

  1. Temporarily Remove the Quit Minecraft Action:

    • Go back to the layout editor for your quitting_message_screen.
    • Right-click your Ticker element.
    • Go to "Edit Action Script."
    • Find the Quit Minecraft action (which is nested under your IF statement).
    • Click on it and select "Remove Action."
    • Save the layout (Ctrl+S).
  2. Now Customize Freely:

    • With the Quit Minecraft action removed, your custom GUI can stay open as long as you need while you tweak elements, move things around, or refine its appearance. The Ticker will still run and increment the variable, but it won't actually close the game.
  3. Restore When Done:

    • Once you're satisfied with the look and feel of your quitting_message_screen, go back into the Ticker's "Edit Action Script."
    • Add the Quit Minecraft action again, ensuring it's nested correctly under your IF statement.
    • Save the layout one last time.

This way, you get the best of both worlds: easy customization and functional logic! 👍

wraith estuary
#

i cant even open it because when i open it through manage gui, my game automatically quits

ember crescentBOT
#
  1. Stop Minecraft immediately. Don't try to open your quitting_message_screen again in-game.
  2. Navigate to your Minecraft instance folder. This is where your .minecraft folder or modpack instance is located.
  3. Go to config/fancymenu/customization.
  4. Find the layout file for your quitting_message_screen. It will be a .txt file, likely named after your custom GUI's identifier (e.g., quitting_message_screen.txt).
  5. Open this .txt file with a plain text editor (like Notepad on Windows, TextEdit on macOS, or VS Code).
  6. Locate and remove the Quit Minecraft action lines.
    • You'll be looking for a section related to your Ticker element. Inside that, find the action = quitgame line.
    • Crucially, also remove the action_type = quitgame line and the corresponding { } block it's inside if it has any additional parameters.
    • It might look something like this (exact lines may vary):
      # ... other Ticker properties ...
      action_executable_blocks {
          block {
              type = if_statement
              # ... other if statement properties ...
              actions {
                  # This is the part you need to remove
                  action {
                      action = quitgame
                      # ... other quitgame properties if any ...
                  }
              }
          }
      }
      # ... rest of the file ...
      
    • Make sure to remove the action = quitgame line and anything directly linked to it. The goal is to temporarily disable the quit action.
  7. Save the .txt file.
  8. Restart Minecraft.
  9. Now, when you open FancyMenu, you should be able to open your quitting_message_screen via Customization -> Custom GUIs -> Manage Custom GUIs -> Open GUI without the game immediately closing.
#

Once you've made all your visual adjustments in the editor, remember to re-add the Quit Minecraft action to your Ticker's action script in the editor, save the layout again, and you'll be all set!

Thank you for catching that! Let me know if you need more precise instructions for editing the text file.

wraith estuary
#

okay i made it work now, thanks so much alice

ember crescentBOT
# wraith estuary okay i made it work now, thanks so much alice

You are so very welcome, Azra! I'm genuinely delighted I could help you get it all sorted out. Sometimes those little tricky bits can be a real head-scratcher! 🤯

Don't hesitate to reach out if you have any more questions or run into anything else. I'm always here to assist! Happy customizing! ✨

#
Thread Marked as Solved

This support thread has been marked as solved by @echo epoch.

The AI helper is now disabled, but you can still continue the conversation if needed. Thank you for using our support system!

#

✅ | action delay