inkle / ink

inkle's open source scripting language for writing interactive narrative.
http://www.inklestudios.com/ink
MIT License
4.14k stars 494 forks source link

Optional parameters? #771

Open btarg opened 2 years ago

btarg commented 2 years ago

Are you able to create functions which have optional parameters? My external function for playing sounds has only the clip required, but it also has options for volume, pitch etc. that I might not need/want to change.

IFcoltransG commented 1 year ago

There aren't optional parameters. If all your optional parameters can be list elements, you could have a single list parameter that combines all those list elements together into one list. Otherwise you could create global variables and use those to pass in your optional parameters; you'd need to reset those variables inside the function, but it would let you set whichever of those parameter variables you want before calling the function.