adapap / OWScript

Python-like scripting language which transpiles into Overwatch Workshop script rulesets.
MIT License
37 stars 2 forks source link

When using Hero names, not defaulting to Hero() #12

Closed MatthewSH closed 4 years ago

MatthewSH commented 5 years ago

When tinkering with a new gamemode, I need to set a variable to a Hero. So by default you'd think it could be done like this: gvar hero = Winston...this compiles like:

Set Global Variable At Index(A, 1, Winston);

This is invalid. Every reference to a specific hero is wrapped in Hero(). To set the above, the following code is valid:

Set Global Variable At Index(A, 1, Hero(Winston));
adapap commented 5 years ago

I remember running into this issue. I can't remember if there were some occurrences where writing just the hero name was required (maybe Hero Of(...)), but I could alias each of the heroes into Hero(hero_name) as long as there are no conflicts. This will render the Hero() function obsolete.

MatthewSH commented 5 years ago

Maybe if it's not preceded by another function that wouldn't require the Hero call, then we can alias it? Or at least add a warning or error when trying to compile your code about it.

adapap commented 4 years ago

The implementation I went with is that Hero(...) with a hero name is optional. The following produce the same result:

Set Hero(Everyone, Doomfist)
Set Hero(Everyone, Hero(Doomfist))