HScript IDs - SlightlySimple/FNF-Restructure-Engine GitHub Wiki

Every script loaded during a game has it's own string ID, and knowing these IDs can be useful to allow scripts to interact with each other.

  • Global scripts have the ID of AUTORUN_ followed by the script's file name. For example, the script file script.hscript would have the ID AUTORUN_script
  • Song-specific scripts have the ID of SONG_ followed by the script's file name. If the song is in a subfolder inside the songs folder, scripts inside that subfolder have the ID of WEEK_ followed by the script's file name.
  • Character scripts have the ID of player followed by the character's position in the character list. For example, Boyfriend has the ID player1, the opponent has the ID player2, etc.
  • This excludes the character in the Girlfriend slot, whose script has the ID gf
  • The stage script has the ID stage
  • The noteskin script has the ID NOTESKIN
  • Note type scripts have the ID of NOTETYPE_ followed by the note type's name. If the note type is in a subfolder, all slashes in the note type's name will be replaced with underscores.
  • Event scripts have the ID of EVENT_ followed by the event's name. If the event is in a subfolder, all slashes in the event's name will be replaced with underscores.

Script Functions

If you want to set something on a specific script, the following functions can be used to do so, using the above IDs:

  • game.hscriptIdSet(id, variable, value) will set a certain variable on a certain script to a certain value.
  • game.hscriptIdGet(id, variable) will return the value of a certain variable on a certain script.
  • game.hscriptIdExec(id, function, arguments) will run a certain function on a certain script. arguments should be an array of arguments to use in the function, and can be omitted if no arguments are necessary.
  • game.hscriptRemove(id) will remove a certain script from the game's list of scripts, causing it to no longer run.

Script ID

The variable scriptId can be used to get the ID of the current script. This can, for example, be used to remove the current script under certain conditions with the code game.hscriptRemove(scriptId)