inkle / ink-unity-integration

Unity integration for the open source ink narrative scripting language.
http://www.inklestudios.com/ink
Other
578 stars 101 forks source link

If a translation unit has more than one "-> END", then the logic breaks #155

Closed Ratstail91 closed 2 years ago

Ratstail91 commented 3 years ago

I solved this by placing === Scene_End === just above the -> END in the main file. The logic breaks at the INCLUDE statement.

It should be noted that my project actually uses multiple translation units, by storing them in a stack/dictionary. When the player clicks on a "clickable" object, the other translation unit is loaded, executed and the previous translation unit is returned to. I'm in a game jam right now, but I'll upload the full project once it's finished. I don't think my stack system is causing the issue though (GetVariable and SetVariable are used to move vars between translation units).

Here are my ink files ATM (sorry for the morbid topic):

//Main.ink
INCLUDE Scene_1.ink

=== Scene_End ===

Game End

-> END
//Scene_1.ink
EXTERNAL SetVariable(key, value)
EXTERNAL GetVariable(key)
EXTERNAL SetBackground(fname, seconds)
EXTERNAL SetMusic(fname, fadeOut, fadeIn)
EXTERNAL PlaySound(fname)
EXTERNAL AddClickable(fname, ink, x, y)
EXTERNAL RemoveClickable(fname)

~SetMusic("battlefield_1", 0, 2)

~SetBackground("battlefield_1", 0)

War never ends, not really.

You're trudging through a wet trench. This was once the bulwark of the front line, the only thing that separated you from the enemy guns was about 300ft of no man's land.

Your squad members are gone now. Some of them were lucky enough to make it home. You'll be returning home too, though you don't know what kind of world you'll be going back to. You wonder if someone like you would be welcome there.

~AddClickable("photograph", "photograph", 0, 2.5)

The occasional packet of empty rations, or personal belongings can still be found hidden in the trench walls. A black and white photograph lies abandoned in the mud, content faces smiling at the stained sky.

~RemoveClickable("photograph")

You move on, like you have somewhere to go.

...

The air is getting colder. The rain begins again.

...

You can't hear much besides the wind.

...

* "Fuck off rain."
  The rain just ignores you.
  -> WeatherContinue
* "Fuck off wind."
  The wind just ignores you.
  -> WeatherContinue

=== WeatherContinue ===

~SetBackground("battlefield_2", 3)

You nearly trip over a body buried in the mud. It's not one of your men.

You stop to take a closer look, to see if there's still some kind of ID on him.

~AddClickable("dogtag", "dogtag", 0, 2.5)

His face still shows the shock of having his guts pierced by a round of ammo, followed by whatever slow death followed. Since the armistice was signed, you don't know what will happen to these men, the ones left out to rot.

You suppose the grave registers would be by soon to bury him properly.

...

He looks about sixteen.

~RemoveClickable("dogtag")

-> Scene_End
tomkail commented 2 years ago

Sorry not to get back at the time! This is an ink issue, not Unity, so I'm closing it.