Allow opening an .ink file to a specific line
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 340
- PR merge metrics
- No merged PRs in 30d
Description
I think it would be a nice addition to be able to open a story to a specific line - especially for engines integration.
A use-case example - working with Unity, I allow designers to select a **knot** to associate with a dialogue component (so upon player interaction we play that specific knot).
I would like to add an "open knot" button in the Unity Inspector, as the story file can get quite long.
Unity provides opening an asset with a specific line number and column: https://docs.unity3d.com/ScriptReference/AssetDatabase.OpenAsset.html
I'm not entirely sure _how_ they pass these, but I would think it's just additional command line arguments, e.g. "story.ink 21 9"
--
I've taken the liberty to peruse the Inky source code a bit! (hopefully that's not out of place, apologies if it is)
I believe the required changes would be:
1. **main.js : 197** - check if after a file has been set to open, there's also a numerical argument
2. save that to something like "pendingPathToOpenLine"
3. pass it to **ProjectWindow.open** in line 209
4. in **projectWindow.js : 37** - add a constructor overload that takes a line number and jumps to that on open
5. _do some magic that makes Electron scroll to the correct line_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.