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
Divert targets allow knots to be called as functions #296
Comments
Additional infoIn Inky ( v0.10.0 ; ink v0.8.2 ; inkjs v1.7.1 with hotfix ), choices appear.
|
This crash trace looks like an incorrect number of parameters being passed
somewhere?
On Thu, 30 May 2019 at 5:01 pm, Clément Busschaert ***@***.***> wrote:
Additional info
In Inky ( v0.10.0 ; ink v0.8.2 ; inkjs v1.7.1 with hotfix ), choices
appear.
When choosing any one, crash happens, with this stacktrace:
System.Exception: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index (Internal story path: 0.4.9) ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Ink.Runtime.StoryState.PopEvaluationStack()
at Ink.Runtime.Story.ProcessChoice(ChoicePoint choicePoint)
at Ink.Runtime.Story.Step()
at Ink.Runtime.Story.ContinueSingleStep()
at Ink.Runtime.Story.ContinueInternal(Single millisecsLimitAsync)
at Ink.Runtime.Story.ContinueAsync(Single millisecsLimitAsync)
at Ink.Runtime.Story.Continue()
at Ink.CommandLinePlayer.EvaluateStory()
at Ink.CommandLinePlayer.Begin()
at Ink.CommandLineTool..ctor(String[] args)
--- End of inner exception stack trace ---
at Ink.CommandLineTool..ctor(String[] args)
at Ink.CommandLineTool.Main(String[] args)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#296?email_source=notifications&email_token=AAHDJI6RKXA4DCENERBW4OLPX725NA5CNFSM4DF53GR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWSXOZQ#issuecomment-497383270>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHDJIYZLAU7UC7CYRLOR5DPX725NANCNFSM4DF53GRQ>
.
--
Jazz, in Three-Four Time: A Novel
http://www.amazon.co.uk/dp/B004K1EYIE
|
I'll have a look at the generated runtime json tree once I get home. Looks to me that the function call "pops" a value that is never pushed (no "void" is pushed on the stack in Do you want to allow calling divert targets as functions? It'd be nice if you want dynamic delegate switching, but in that case maybe there should be an explicit check at runtime that the target points to a function and not any "gotoable" point. |
Divert targets as functions was something we found the engine could handle
almost "accidentally", but it's extremely useful. A runtime check that a
function really is a function would be a good idea, except I think the
"function" information is removed entirely when the ink is compiled.
|
indeed there is no static way to know that a container corresponds to a function, right now. The runtime assumes that the compiler did its thing and that a function call means the target is a function. The least effort fix doable right now would be to check if the stack is poppable before popping, to avoid an exception and throw a custom runtime error with a message that would like "tried to get a non-existing value, have you called a function that was actually not a function?" or something like that, but it would be better anyway to be able to make sure that a function call points to an actual function, directly or indirectly. Adding a flag in the |
I looked at the JSON, and indeed, this choice
Generates the following json object (minus all the text evaluation)
which sets it to check for a condition before doing anything (flag 1 is set), |
If this is a pull request you could do we would gratefully accept it, I
think! (Caveat: @joethephish manages the ink codebase not me)
…--
Jazz, in Three-Four Time: A Novel
http://www.amazon.co.uk/dp/B004K1EYIE
|
... and hell breaks loose if you do. (Well, the game crashes)
The text was updated successfully, but these errors were encountered: