ItsDeltin / Overwatch-Script-To-Workshop

Converts scripts to Overwatch workshops.
209 stars 26 forks source link

Feature request for 2.x - Erroring out when not enough arguments provided to Overwatch functions #216

Closed TimeBomb closed 3 years ago

TimeBomb commented 3 years ago

Sliightly interestingly, this compiles successfully:

SmallMessage(EventPlayer(), <"Player ability1 cooldown is <0> ability2 is <1>", AbilityCooldown(EventPlayer(), Button.Ability1), AbilityCooldown(Button.Ability2)>);

compiles to:

Small Message(Event Player, Custom String("Player ability1 cooldown is {0} ability2 is {1}", Ability Cooldown(Event Player, Button(Ability 1)), Ability Cooldown(Button(Ability 2), Button(Primary Fire)), Null));

What the OSTW code instead should look like is:

SmallMessage(EventPlayer(), <"Player ability1 cooldown is <0> ability2 is <1>", AbilityCooldown(EventPlayer(), Button.Ability1), AbilityCooldown(EventPlayer(), Button.Ability2)>);

Note the second AbilityCooldown now has the appropriate EventPlayer argument passed to it. I didn't get any errors that told me this though.

This ticket is essentially a feature request for errors when not enough arguments are passed. Maybe a big ask so feel free to close / leave on backburner, but would be nice :).

Protowalker commented 3 years ago

This'll be fixed with the explicit branch as an error would occur upon passing the wrong type to AbilityCooldown.

The reason that it doesn't throw an error when there aren't enough arguments because it tries as often as possible to assume defaults; I can look into that more.