Project Heartbeat

Project Heartbeat

Not enough ratings
How to Create Your First Script and Resources
By Genshin Impact
   
Award
Favorite
Favorited
Unfavorite
Basics
First of all, I would highly recommend starting the game through command prompt. The game will work as normal, but the command prompt window window will stay open and show game logs in real time.

To do this you can:
Go to the game's install location in the File Explorer, click on the URL bar at the top, type 'cmd' and press enter.
Then type "project heartbeat" including the double quotes.
Alternatively, if you know the exact file location where the game is stored, you can type it in the command prompt from anywhere.
Now press enter. The game should start normally but leave the command prompt window open. Depending on your graphics settings you might have to alt-tab or click the command prompt on your taskbar to make it come back up.

Now navigate to the editor. Tools -> Song Editor
Open a song. If you don't have one created already and don't know how you can follow this guide:
https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=2997068764
Click on the 'Scripts' tab. It's the fourth tab on the right toolbox.
This menu is quite simple. You can execute a script by pressing the button next to it, and open the script manager GUI by clicking the big button at the bottom.
Go ahead and click 'Manage Scripts'.
When you open this menu for the first time, it will probably be blank but I filled in an example script so you can see all the buttons.

Top-left Button Row:
  • Save: Saves the current script
  • Save as: Saves the current script as a new file
  • New Script: Creates a new script and empties the script body
  • Open Script Folder: Opens the script folder in the file explorer

Script List:
  • Script Name: Clicking this allows you to change the name, press enter to save
  • Open Script: Opens the script in the script body
  • Duplicate Script: Creates a copy of the script
  • Delete Script: Deletes the script (does not empty the script body)

Now to culminate your knowledge. Create a new script and make it the same as in the above image. You can copy-paste this if you want:
extends ScriptRunnerScript; func run_script(): print("Hello World!") return OK
Once your script is saved, close the script manager and click the 'Execute Script' button.
If you're running Project Heartbeat through command prompt you should see "Hello World!" show up in the command prompt window.

Congratulations! You've learned the basics of the script manager. Now experiment and use the information below to create your own scripts.
Resources
If you're new to programming or want to skim around and see how the syntax differs, this is a nice video:
GDScript Documentation:
https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html
Built-in GDScript things you can use:
https://docs.godotengine.org/en/stable/classes/class_@gdscript.html
Lino (guy who made the editor)'s script repo:
https://github.com/linobigatti/TAC
ScriptRunnerScript
WIP
Variables:
Name
Type
_editor
N/A
selected_timing_points
Array
_timing_point_changed_properties
dict
_clone_to_original_timing_point_map
dict
new_timing_points
Array
Functions:
Name
Argument(s)
Returns
init_script()
N/A
N/A
run_script()
N/A
N/A
get_selected_timing_points()
N/A
Array
set_timing_point_property()
HBTimingPoint, String, value
N/A
bsearch_time()
HBTimingPoint, HBTimingPoint
bool
get_points_at_time()
int
Array
get_timing_info_at_time()
int
HBTimingChange
get_bpm_at_time()
int
float
get_note_speed_at_time()
int
float
get_note_resolution()
N/A
float
get_timing_changes()
N/A
Array
get_timing_map()
N/A
Array
get_normalized_timing_map()
N/A
Array
get_signature_map()
N/A
Array
get_metronome_map()
N/A
Array
create_timing_point()
HBTimingPoint
N/A
bsearch_upper()
Array, int
int
bsearch_closest()
Array, int
int
bsearch_linear()
Array, int
int
get_time_as_eight()
int
float

Other Editor Functions
WIP

Technically, you can use any functions listed in Editor.gd
Do this at your own risk.

One useful thing someone pointed out is the playhead's position which you can get similar to the screenshot above using '_editor.playhead_position'
Classes
WIP

Here's a chart of all the classes you'd need when working with the editor.
Arrows originating from a box mean the class connected to the arrow inherits it.

Other classes that are highlighted in the editor but mainly contain methods:
HBChart
HBSong
HBEditor
ScriptRunnerScript