yarnspinnertool / yarnspinner-console Goto Github PK
View Code? Open in Web Editor NEWThe command line tool for working with Yarn Spinner.
Home Page: https://yarnspinner.dev
License: MIT License
The command line tool for working with Yarn Spinner.
Home Page: https://yarnspinner.dev
License: MIT License
ysc
version 1 correctly inferred the name of the output files from the input .yarn
file when running ysc compile
. For example, ysc compile file.yarn
would output file.yarnc
and file.csv
.
ysc
version 2 adds the ability to provide the name of the output files as command line flags (--output-name
and --output-string-table-name
) which is great, but defaults to a less descriptive name (Output.yarnc
and Output.csv
respectively.) The default output name should be determined from the name of the .yarn
file.
The file name is correctly based on what the CLI passes, but the actual name within the protobuf packet of the output is just an empty string from my own tests.
This is using:
ysc version 2.3.1.0
YarnSpinner.dll version 2.3.0.0
YarnSpinner.Compiler.dll version 2.3.0.0
The exact command passed was:
https://github.com/sanbox-irl/yarn-spinner/blob/main/compile.sh
Builds for macOS are not currently notarised, which means that users need to reduce the security of their system in order to use it. We should be signing release builds; Secret Lab can sponsor the signing, using our existing Apple Developer account.
The --start-node
option is pretty useful for testing parts of a conversation. It would be even more useful if it was also possible to set variables.
I.e. something like
ysc run main.yarn --start-node some_deep_node --set-variable met_sally=true --set-variable money=123
running ysc tag does not work on a yarn file that compiles and runs successfully.
Given the following start.yarn file:
<<declare $value = "" as string>>
<<declare $parameter = "" as string>>
<<declare $component = "" as string>>
<<declare $type = "" as string>>
<<declare $diagnosisId = "" as string>>
<<declare $bodyTextOverride = "" as string>>
<<declare $noDiys = false as bool>>
<<declare $createWorkOrder = false as bool>>
<<declare $target = "" as string>>
<<declare $confirmSuccess = false as bool>>
<<declare $currentContent = "" as string>>
<<declare $ghostNode = "" as string>>
<<declare $stringRecord = "" as string>>
<<declare $assetTag = "" as string>>
<<declare $targetOverrides = "" as string>>
<<declare $tempFlowLoop = "" as string>>
<>
===
Running ysc tag start.yarn
produces this:
<<declare $value=""asstring>>
<<declare $parameter=""asstring>>
<<declare $component=""asstring>>
<<declare $type=""asstring>>
<<declare $diagnosisId=""asstring>>
<<declare $bodyTextOverride=""asstring>>
<<declare $noDiys=falseasbool>>
<<declare $createWorkOrder=falseasbool>>
<<declare $target=""asstring>>
<<declare $confirmSuccess=falseasbool>>
<<declare $currentContent=""asstring>>
<<declare $ghostNode=""asstring>>
<<declare $stringRecord=""asstring>>
<<declare $assetTag=""asstring>>
<<declare $targetOverrides=""asstring>>
<<declare $tempFlowLoop=""asstring>>
<indent to 3>
<dedent from 3><>
===
Hello there. I'm collaborating with YarnRunner-Python and I was wondering how would be the best approach to support initializing/declaring variables as the language server suggests.
I see at the moment of compiling, CompilationResult
has a Declarations
enumerable that doesn't get serialized, and the class Program
has a InitialValues
property. AFAIK the Program
class gets serialized with Google's Protobuf, but I don't understand/know how to retrieve those values. It's possible from a compiled .yarnc
file get those back?
Right now, ysc
always returns 0
, even on error. This makes piloting ysc with other tools much harder, since we must devolve into checking if the stdout
is empty or not. (Fwiw, I'm not sure what the politics of stdout or stderr are! The name would suggest stderr is better, but I've never really seen a pattern in other code).
Running the following command in Windows 11 terminal
./ysc.exe tag --output-directory output game.yarn
Expected behaviour is to output a file game.yarn
in a subfolder named output
of the current directory.
Instead what happens is a file called outputgame.yarn
is created in the current directory.
Interestingly, the output will still fail with "Directory does not exist", if subfolder output
does not exist. But it just doesn't get used.
To achieve the expected behaviour, I must run the following command
./ysc.exe tag --output-directory output/ game.yarn
This may be related to ticket #2, but that ticket has no description so I can't tell for sure.
I downloaded the most recent version of YS-Console: ysc-win-2.2.0-6526114, extracted the zip but upon running the exe a command prompt flashes briefly with the message:
Required Command Was Not Provided
Furthermore, when I try to run ysc upgrade myFile.yarn
in the folder containing myFile.yarn, I get the following error:
ysc : The term 'ysc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ysc upgrade myFile.yarn
+ ~~~
+ CategoryInfo : ObjectNotFound: (ysc:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I'm about to download an older version to see if that gives me the same result (maybe the most recent exe is broken?) but in the meantime - is there a solution for this error?
EDIT: 2.1.0 and 2.0.2 are giving me the same error.
EDIT 2: Here's my current environment, if that helps.
Version: 5.0.412
Commit: 805c28eb1f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.412\
global.json file:
Not found
Host:
Version: 6.0.9
Architecture: x64
Commit: 163a63591c
.NET SDKs installed:
3.1.423 [C:\Program Files\dotnet\sdk]
5.0.104 [C:\Program Files\dotnet\sdk]
5.0.303 [C:\Program Files\dotnet\sdk]
5.0.412 [C:\Program Files\dotnet\sdk]
Thanks!
This might be out of scope for the upgrade tool, but upgrading this yarn file:
title: Start
---
<<set $value_string to "string">>
<<set $value_float to 1.25>>
<<set $value_bool to true>>
<<set $value_null to null>>
===
produced the message No upgrades required.
, which isn't correct. I didn't realize it at the time, but variables are no longer permitted to be null in Yarn Spinner 2.0, which could theoretically be caught by the upgrade tool.
For future users encountering this problem, the error I saw in Yarn Spinner Console looked like this, which was challenging to debug:
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.NullReferenceException: Object reference not set to an instance of an object.
at YarnSpinnerConsole.YarnSpinnerConsole.CompileFiles(FileInfo[] inputs, DirectoryInfo outputDirectory, String outputName, String outputStringTableName)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseErrorReporting>b__20_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass24_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__21_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__11_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseExceptionHandler>b__0>d.MoveNext()
The error message displayed in #9 doesn't seem to be very descriptive, or related to the problem. It turns out, ysc
surfaces this error message in multiple places, including during compilation (instead of providing descriptive compilation errors.)
I'm using ysc
@2.0.1-a2eff4c.
For an example, try to compile this simple file, which features a node name with period characters (which are now invalid as of YS2.)
title: Start
---
This is a start node.
<<jump invalid.node.name>>
===
You'll encounter the same error message as in #9.
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.NullReferenceException: Object reference not set to an instance of an object.
at YarnSpinnerConsole.YarnSpinnerConsole.CompileFiles(FileInfo[] inputs, DirectoryInfo outputDirectory, String outputName, String outputStringTableName)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseErrorReporting>b__20_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass24_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__21_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__11_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseExceptionHandler>b__0>d.MoveNext()
If I'm setting up a CI workflow for Yarn files, I'd love to be able to convert a .yarn
file to a .json
file similar to how YarnEditor allows users to export those.
Running anything via ysc run <file.yarn>
will give:
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ArgumentException: An item with the same key has already been added. Key: visited
at System.Collections.Generic.Dictionary`2.TryInsert(TKey , TValue , InsertionBehavior )
at YarnSpinnerConsole.RunCommand.RunFiles(FileInfo[] inputs, String startNode, Boolean autoAdvance)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object , Span`1& , Signature , Boolean , Boolean )
at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo )
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseErrorReporting>b__20_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass24_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__21_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__11_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseExceptionHandler>b__0>d.MoveNext()
Suggested usage:
ysc tag-lines <input files>
This will add a unique #line:
hashtag to each piece of user-visible text (lines, options, shortcut options), modifying the files in place.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.