Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Suggestion: Library to collect Arguments

1725737079

Edited 1725761817
GiGs
Pro
Sheet Author
API Scripter
I haven't kept up on script developments, and I'm asking if anything has been created (or if Aaron has a spare teabreak and will create it). It's very common to supply a script with a set of arguments, but there's no standardised way (or wasnt last I looked) to collect those arguments into a single object variable. For example, let's say you have a script message like: !my_script this is my script, mine! --debug:0 --yes: no --boolean: 0 In the script you want to collect that into a series of arguments like final_args = {     text: "this is my script, mine!", debug: 0, yes: "no", boolean: 0 }; Then you can proceed with the script as normal. Things I see (after literally seconds of thinking about it) that would be handy: delimeter: '--', valid: [/* if there's a list of allowed or expected args, list them here and the script checks each arg against this list, and constructs a report if any valid args are missing or have typos */] Does anything like this exist, or do we have to handle our args uniquely with each script?
1725746807
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That would be a handy function. I have to write it all the time, and usually use parsing tricks to catch everything. Putting all of the arguments into an object sounds brilliant.
1725807355
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
There is scriptArgs (might have the name wrong)