Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Allow for refreshing the mod scripts currently active without a hotkey (Or at least document the hotkey in game) and stop them from being permanently loaded. #3795

Open
2 tasks done
Average-FNF-Modder opened this issue Oct 27, 2024 · 15 comments
Labels
status: pending triage The bug or PR has not been reviewed yet. type: enhancement Provides an enhancement or new feature.

Comments

@Average-FNF-Modder
Copy link

Average-FNF-Modder commented Oct 27, 2024

Issue Checklist

  • I have properly named my enhancement
  • I have checked the Issues/Discussions pages to see if my enhancement has already been suggested

What is your suggestion, and why should it be implemented?

       I know that there is a debug hotkey for refreshing scripts, but it's not well documented anywhere ingame, I don't believe it refreshes scripts for indivijual songs, and like with plenty of other hotkey'd functions, I believe it should still have it's own buttons for doing it without hotkey knowledge in game. So on top of adding in this hotkey to the help menu, I suggest having:

  1. A button in either the File or Edit dropdowns of chart editor that is a Refresh Song Script button, which, as the name implies, refreshes that charts script on it's own.
  2. Another button in chart editor "Refresh All Scripts" or whatnot, which fully refreshes all scripts.
  3. A button in the regular debug menu which also refreshes all scripts.

      In addition to this, scripts currently do not at all register when they have deleted. I couldn't tell if this was a bug or not, but it's very annoying. The only way to remove a scripts effects is to edit it to be blank, which I had to find out myself by floundering, as this is not intuitive at all. Removing from the folder and even straight up deleting a .hxc file does not remove it's effect on the game, I guess it somehow stays stored in the games memory until it sees an edit, and it doesn't count deleting as editing?- so I would also suggest that the game checks if a loaded script is even still there when loading in scripts.

@Average-FNF-Modder Average-FNF-Modder added status: pending triage The bug or PR has not been reviewed yet. type: enhancement Provides an enhancement or new feature. labels Oct 27, 2024
@NotHyper-474
Copy link
Contributor

NotHyper-474 commented Oct 27, 2024

Can't you just press F5 to reload the scripts?

@Average-FNF-Modder
Copy link
Author

Can't you just press F5 do reload the scripts?

That's... a thing? If it is it should really be in a hotkeys menu or explained like, somewhere right? Even still most things doable with hotkeys should also have their own buttons in a dropdown for people still learning at least, and the issue with deleted scripts staying loaded would still stand.

@AbnormalPoof
Copy link
Contributor

AbnormalPoof commented Oct 28, 2024

There’s a file that documents all the debug hotkeys for FNF.

@Keoiki
Copy link
Contributor

Keoiki commented Oct 28, 2024

I read the title of this issue in my head and said "F5" aloud to myself.

@Hundrec
Copy link
Contributor

Hundrec commented Oct 28, 2024

I think this issue is plenty resolved and can be closed now!

@Average-FNF-Modder
Copy link
Author

I think this issue is plenty resolved and can be closed now!

Nah cause there should still be interfaces for these imo + Plus my 2nd issue still stands... in fact lemme edit this a lil' rq.

@Average-FNF-Modder Average-FNF-Modder changed the title Enhancement: Allow for refreshing the mod scripts currently active and stop them from being permanently loaded. Enhancement: Allow for refreshing the mod scripts currently active without a hotkey (Or at least document the hotkey in game) and stop them from being permanently loaded. Oct 28, 2024
@Hundrec
Copy link
Contributor

Hundrec commented Oct 28, 2024

I think debug functions being hidden away isn't necessarily a bad thing, given that the general audience for the game will likely never interact with debug features.
It's not a bad idea to add some redundancy for the refresh function, but making it too accessible to people who might not be familiar with debug stuff could break the game more easily.

@Average-FNF-Modder
Copy link
Author

I think debug functions being hidden away isn't necessarily a bad thing, given that the general audience for the game will likely never interact with debug features. It's not a bad idea to add some redundancy for the refresh function, but making it too accessible to people who might not be familiar with debug stuff could break the game more easily.

I feel like if you're fucking around with chart editor you're already on the modding path + resetting script won't do anything bad unless you were actively making a mod and had some really specific thing set up at the moment.

@AbnormalPoof
Copy link
Contributor

AbnormalPoof commented Oct 28, 2024

In addition to the debug hotkey documentation in docs/, Hot Reloading is already documented in the Modding Documentation. There doesn’t really need to be an interface in-game to hot reload since pressing F5 is faster than switching to whatever state the button is in and pressing it.

@MAZ12211
Copy link

In addition to the debug hotkey documentation in docs/, Hot Reloading is already documented in the Modding Documentation. There doesn’t really need to be an interface in-game to hot reload since pressing F5 is faster than switching to whatever state the button is in and pressing it.

I agree

@Average-FNF-Modder
Copy link
Author

In addition to the debug hotkey documentation in docs/, Hot Reloading is already documented in the Modding Documentation. There doesn’t really need to be an interface in-game to hot reload since pressing F5 is faster than switching to whatever state the button is in and pressing it.

Ok, but it's faster to do things that way for a lot of things. It's faster to press ctrl+s to save, press F1 to bring up the user guide, or ctrl+F to flip around selected notes, yet there are still buttons for those. I don't see why their shouldn't be, especially if there is going to not be documentation in the in-game help guide that these hotkeys exist.

@Keoiki
Copy link
Contributor

Keoiki commented Oct 28, 2024

Alright well where do you suppose this button should be located, it should be accessible from ANYWHERE in the game, so have fun slotting such a button somewhere.

@AbnormalPoof
Copy link
Contributor

In addition to the debug hotkey documentation in docs/, Hot Reloading is already documented in the Modding Documentation. There doesn’t really need to be an interface in-game to hot reload since pressing F5 is faster than switching to whatever state the button is in and pressing it.

Ok, but it's faster to do things that way for a lot of things. It's faster to press ctrl+s to save, press F1 to bring up the user guide, or ctrl+F to flip around selected notes, yet there are still buttons for those. I don't see why their shouldn't be, especially if there is going to not be documentation in the in-game help guide that these hotkeys exist.

It's important to note that F5 is part of a group of hotkeys that can be used in any state, not just the Chart Editor. By that logic, there would need to be an interface for these other hotkeys.
Screenshot 2024-10-28 at 6 20 34 PM

Adding on to this, the function that is called when pressing F5 does a lot more than just reloading song scripts:

/**
 * Clear and reload from disk all data assets.
 * Useful for "hot reloading" for fast iteration!
 */
public static function forceReloadAssets():Void
{
  // Forcibly clear scripts so that scripts can be edited.
  ModuleHandler.clearModuleCache();
  Polymod.clearScripts();

  // Forcibly reload Polymod so it finds any new files.
  // TODO: Replace this with loadEnabledMods().
  funkin.modding.PolymodHandler.loadAllMods();

  // Reload scripted classes so stages and modules will update.
  Polymod.registerAllScriptClasses();

  // Reload everything that is cached.
  // Currently this freezes the game for a second but I guess that's tolerable?

  // TODO: Reload event callbacks

  // These MUST be imported at the top of the file and not referred to by fully qualified name,
  // to ensure build macros work properly.
  SongEventRegistry.loadEventCache();

  SongRegistry.instance.loadEntries();
  LevelRegistry.instance.loadEntries();
  NoteStyleRegistry.instance.loadEntries();
  PlayerRegistry.instance.loadEntries();
  ConversationRegistry.instance.loadEntries();
  DialogueBoxRegistry.instance.loadEntries();
  SpeakerRegistry.instance.loadEntries();
  AlbumRegistry.instance.loadEntries();
  StageRegistry.instance.loadEntries();

  CharacterDataParser.loadCharacterCache(); // TODO: Migrate characters to BaseRegistry.
  NoteKindManager.loadScripts();
  ModuleHandler.loadModuleCache();
}

@Hundrec
Copy link
Contributor

Hundrec commented Oct 28, 2024

In the interest of making vital functions accessible without hotkeys, buttons should be added for redundancy.

The question is whether this debug function in particular should be made accessible. That's for Funkin' Crew to decide!

@Average-FNF-Modder
Copy link
Author

Average-FNF-Modder commented Oct 28, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pending triage The bug or PR has not been reviewed yet. type: enhancement Provides an enhancement or new feature.
Projects
None yet
Development

No branches or pull requests

7 participants
@NotHyper-474 @Keoiki @MAZ12211 @AbnormalPoof @Average-FNF-Modder @Hundrec and others