Skip to content

Releases: ItsDeltin/Overwatch-Script-To-Workshop

OSTW v1.3 - Lambdas!

05 Apr 05:24

Choose a tag to compare

The wiki has been updated, check it out!

  • Lambda support
    • Wiki page
    • Type arrays now have the functions FilteredArray, SortedArray, IsTrueForAny, IsTrueForAll which uses a lambda so you no longer need to cast ArrayElement.
  • Fixed bugs with subroutines, recursive, and virtual functions.
    • The subroutine, virtual, and recursive attributes can now all be used together without issues.
    • Subroutines now property support parameters.
    • Subroutines can now have an attribute to determine the context of the variables defined inside the subroutine, see the subroutine wiki.
    • Functions that override the same function can now call each other recursively properly now.
    • Variables defined in recursive functions now have a stack.
    • Virtual subroutines will put all overriders into the subroutine.
    • Functions overriding recursive functions are now also recursive.
  • Json support (Thanks @pielover928)
    • Import json files: import "myJsonFile.json" as myJson.
    • Properties can be accessed: myJson.property.
  • New functions:
    • All Tank Heroes
    • All Support Heroes
    • All Damage Heroes
    • DestroyDummyBot(dummy): Shorthand for DestroyDummyBot(TeamOf(dummy), SlotOf(dummy))
  • Renamed functions:
    • ResetHeroRoster -> ResetHeroAvailability
    • SetHeroRoster -> SetAllowedHeroes
  • Added DotProduct to the Vector type.
  • Improved localized string performance.
  • Reduced element count of creating pathmaps.
  • Fixed general settings output.
  • Fixed the Health setting being missing for all heroes.
  • Fixed calling this in expression trees. (#135)
  • Fixed pathfinding variables being assigned even is pathfinding isn't used in a project. (#112)
  • Fixed issue with the Hero, Team, Gamemode, and Map enums. (#121)

VSCode Extension

  • Element counter
  • Notification when a new OSTW verison releases.

OSTW v1.2 - Class inheritance!

10 Mar 04:15

Choose a tag to compare

OSTW v1.2

Syntax changes

Scripts will need to be updated to match the new syntax.

New Keywords

Variables or methods with these names will need to be changed.

  • void
  • protected
  • override
  • base
  • virtual
  • switch
  • case
  • default
  • is
  • continue
  • break
  • ref
  • async
  • abstract (currently unused)

These are no longer keywords:

  • method
  • macro

New method syntax

The method keyword is removed. Instead, use void, define, or the type of the value that is returned.

// Old:
method myMethod() ...

// New:
void myMethod() ... // void

define myMethod() ... // returns value

New macro syntax

// Old:
macro paramMacro(): ...
macro paramVar: ...

// New:
define paramMacro(): ...
define paramVar: ...

Modify Variable and Chase Variable

Methods that reference a variable and take a player as a parameter now have the variable and player parameter combined, keeping it consistent with variable setting.

// Old:
ModifyVariable(playerVar, player, Operation.AppendToArray, 1);

// New:
ModifyVariable(player.playerVar, Operation.AppendToArray, 1);

CreateHudText

Now uses the HudTextRev type instead of the StringRev type for the Reevaluation parameter.

Loops

for, foreach, and while no longer have a 16 millisecond delay between each iteration.

Class Inheritance

OSTW now supports extending classes. Child classes can extend or change parent class functions.

Class inheritance example

Parameters will accept child classes if the child class extends the parameter type.

Switch

A switch has sections of code, only one of which will be chosen based off of the condition and the section's case. Fallthrough will occur in OSTW, so be sure to use break statements to break out of the case.

Switch example

Continue and Break

continue can be used to restart at the beginning of the loop. break can be used to exit a loop.

Lobby Settings

Lobby settings can now be changed using a json file. Lobby, hero roster, hero, map, and mode settings can all be changed. The settings will output alongside the workshop code.

Files called customGameSettings.json will have the schema used to create the settings json. Import the json as you would with a script file.

ref attribute

By default, parameters are stored as another variable. Using the ref parameter, the input expression is used directly. This makes it possible for parameters to be strings!

Ref example

Workshop constant types like Color and Effect have the ref attribute by default. Depending on the scenario, this can reduce the number of elements in the output.

Vector type

The Vector struct gives an alternate syntax for doing vector operations.

Vector struct example

The vector struct has the following members:

  • X: The X component of the vector.
  • Y: The Y component of the vector.
  • Z: The Z component of the vector.
  • VerticalAngle: The vertical angle of the vector.
  • HorizontalAngle: The horizontal angle of the vector.
  • Normalized(): The unit-length normalization of the vector.
  • DistanceTo(other): The distance between 2 vectors.
  • CrossProduct(other): The cross product of the specified vector.
  • AsLocalVector(relativePlayer, transformation): The vector in local coordinates corresponding to the vector in world coordinates.
  • AsWorldVector(relativePlayer, transformation): The vector in world coordinates corresponding to the vector in local coordinates.
  • ClosestPlayer(team): The closest player to the vector, optionally restricted by team.
  • FarthestPlayer(team): The farthest player from the vector, optionally restricted by team.
  • DirectionTowards(other): The unit-length direction vector to another vector.
  • Towards(other): The displacement vector from the vector to another.
  • IsInLineOfSight(other, barriers) Whether the vector has line of sight with the specified vector.

Math operations work on the Vector struct as normal.

Auto-for

The new for variant uses the workshop's For() action rather than a while loop.

When the for runs, the variable will be set to the initial start expression. After each iteration, the step expression is added to the variable. Iteration will stop when the variable exceeds end.

It will have less output elements than a normal for.
However, this for variant requires an entire variable. Variables in the extended collection will not work. Additional conditions also do not work, you can only input a number
where the variable will stop counting.

// Creates a variable that can only be accessed inside the for.
for (define = start; end; step) { ... }

// Uses an already existing variable.
for (var = start; end; step) { ... }

Subroutines

Subroutines are created by adding a string after the parameters of a defined method. The string will be the rule name of the subroutine.

void MySubroutine() "My Subroutine!" { ... }

Rather than inserting the actions of the method into the caller's action set, it will call the subroutine. This can reduce the number of elements in the output since the method's actions won't need to be reimplemented every call. Multiple calls to the same subroutine at the same time may cause conflicts. This however will not be a problem if there are no waits inside the subroutine or any other subroutine that it calls.

Asynchronous subroutine calls can be done by prefixing the method call with the async keyword.

async MySubroutine(); // If the subroutine is already executing, it will be restarted.
async! MySubroutine(); // Adding ! will do nothing if it is already executing.

OSTW's implementation of subroutines is not final and is still being worked on. Planned features are class constructor subroutines and improved recursive capabilities.

New Workshop Elements

Actions

  • EnableInspectorRecording
  • DisableInspectorRecording
  • StartHealingModification
  • StopHealingModification

Values

  • EventWasHealthPack
  • LastHealingModificationID

Constants

  • HealingModificationRev
  • IfAlreadyExecuting
  • HudTextRev

New Custom Methods

  • LinePlaneIntersection: Gets the point where a line intersects with an infinite plane.
  • DoesLineIntersectSphere: Determines if a point intersects with a sphere.

Bug fixes and optimizations

  • Static methods and variables work properly now.
  • Fixed language server deadlock.
  • Fixed exception when variable count exceeds 128.
  • Updated the Pathmap class to work with the new class system.
  • Added a syntax error for non-static workshop-constant variables.
  • Fixed some bugs with renaming variables.
  • Fixed signature help closing while typing methods.
  • Fixed incorrect completion list after typing '.'.
  • Fixed signature and type resolving inside methods in classes.
  • Fixed type convert exception.
  • Fixed some optimization bugs.
  • Fixed new Class() syntax highlighting.
  • Fixed casting to type arrays not working.
  • Calling return inside rules will abort rather than skip.
  • Optimized recursion.
  • Optimized classes. Class components are no longer stored as multi-dimensional arrays.
  • Inverse now uses x*-1 instead of 0-x in order to support vectors.
  • Hid the following workshop methods.
    • Add
    • Subtract
    • Multiply
    • Divide
    • Modulo
    • RaiseToPower
    • And
    • Or
    • Compare
    • TeamVar
    • HeroVar
  • if, for, foreach, and while all use their respective workshop variants instead of skip and loop.
    • for and foreach will output using the While() action rather than For().
      Use the alternate for syntax to output using the workshop's For().

Modules

  • Split Debug Tools.del into Debug Tools.del and Debug Camera.del.
  • Debug Camera.del no longer spams the inspector using a single-action-freecam method.

VSCode extension

Codelens

View references or implementations of a method or class.

Codelens preview

New settings

  • ostw.codelens.references: Determines if the References code lens is visible.
  • ostw.codelens.implements: Determines if the Implements code lens is visible.

New command: ostw.virtualDocumentOutput "Create a panel for workshop code output."

Creates a virtual document for the workshop output. The document has syntax highlighting. The virtual document updates faster than vscode's output window, so use this if vscode's output has trouble updating.

Known Bugs

  • Calling base methods from a deriving class doesn't work properly.

v1.2.1

  • Fixed generating .pathmap files.
  • Fixed calling an object member directly from new when the class type does not exist throwing an exception. (new NonExistantClass().ClassMember)

v1.2.2

  • Subroutines now work outside of classes. (Thanks @derwangler!)
  • Fixed some pathfinding bugs.
  • The Pathfind module now shows nodes/segments dynamically so the effect limit shouldn't be an issue anymore. New editor code: SE2AG

v1.2 pre-release 1

06 Feb 00:44

Choose a tag to compare

v1.2 pre-release 1 Pre-release
Pre-release

Updated for the new workshop update.
NOTE: This release is potentially buggy, message my discord at Deltin#1624 if you have any questions.

New for variant.

for (variable = start; stop; step)
This for variant uses the new workshop method For Global/Player Variable.
The old for syntax still works as well.


Subroutines

method mySubroutine() "Rule Name"
{
}

Subroutines can be called like so:

mySubroutine();

// Calls mySubroutine in parallel. The subroutine will restart if it is already running.
async mySubroutine();

// Calls mySubroutine in parallel. The subroutine will do nothing if it is already running.
async! mySubroutine();

Added new values and actions.


while, for, and foreach no longer have a 0.016 second delay between each iteration.

Vastly improved classes.

  • Smaller workshop output and fixed numerous bugs.

Fixed Destroy Icon output.
Fixed some optimization issues (#101, #99)
Fixed ModifyVariable


Pre-release 2

  • Fixed variable renaming.
  • Fixed signature help.
  • Fixed foreach not resetting.
  • Switched to using the workshop's if instead of skip if.
  • Improved the debug camera module.

Pre-release 3

  • Added continue and break.
  • Fixed else if output.

OSTW v1.1

23 Jan 05:49

Choose a tag to compare

Methods can now be given the rule attribute to contain the method inside a rule.
Updated modules.
View References support.
Improved hovering over symbols.
Improved optimizing workshop output. (Thanks @TrueCP6!)
Added the ostw.optimizeOutput setting for the vscode extension.
Fixed .ostw and .workshop not working. (#93)
Fixed null reference if the wiki is down. (#95)
Fixed CompareMap. (#96)


v1.1.1

Fixed player variables in the extended collection.

v1.0 pre-release 1

30 Dec 19:27

Choose a tag to compare

v1.0 pre-release 1 Pre-release
Pre-release
  • Vastly improved the vscode extension. (#15), (#83)
    • Syntax highlighting works with types.
    • Added go to definition and rename symbol.
    • The vscode extension is now on the marketplace. (#74)
    • Reminder: change the ostw.deltintegerPath setting in vscode to the deltinteger.exe file.
  • Type arrays.
  • Custom enums.
  • I18n support.
    • The output language can be changed with the ostw.outputLanguage setting in vscode.
  • Parameter-less macros. (#79)
  • Fixed ControlMode* functions. (#89)
  • New custom methods.
    • ModifyVariable: Shorthand for Modify Global/Player Variable (at Index).
    • CompareMap: Compares the current map to all map variants.

The following changes may require updates in your script to work from previous versions.

  • Changed the syntax for defining variables on the rule-level.
    • Old: define globalvar myVar / MyClass globalvar myVar
    • New: globalvar define myVar / globalvar MyClass myVar
  • foreach can no longer modify the current variable, use for instead for these cases.
  • ShowWireframe, CreateText, CreateTextFancy, and CreateTextFont moved to the Asset class.

Pathfind changes

  • Pathfind, PathfindAll, GetPath, StopPathfind, IsPathfinding, IsPathfindStuck, FixPathfind, NextNode, and WalkPath were moved to the Pathmap class.
    • Pathfind, PathfindAll, and GetPath require an instance of the Pathmap class. (new Pathmap())

Some features have not yet been updated to the new system.

  • Structs: use classes instead (structs may be outright removed.)
  • Some built-in methods.

OSTW v0.7

06 Nov 04:45

Choose a tag to compare

OSTW v0.7 Pre-release
Pre-release
  • Switched from .net framework to .net core.
  • Updated for the workshop's new variable system.
    • Variables are no longer in the extended variable array by default.
    • Removed ChaseVariable() since now it's a better idea to use the workshop's Chase Variable Over Time/At Rate.
    • Removed variable overriding. (define myVar A) Variables defined at the rule level can use a specific ID by adding a number after the name. (define globalvar myGlobalVar 4)
    • If you are copying workshop code into an existing workshop, you can reserve variable names and IDs at the top of your script so the output won't use them. Numbers will reserve IDs, names will reserve variable names.:
globalvar {
    0,
    1,
    variableName
}
playervar {
    0,
    1,
    variableName
}
  • Removed GetMap(), replaced with the new workshop value CurrentMap(). Also updated the map enum.
  • Custom strings are now used by default. Localized strings are created like @"player: <0>".
  • Pick-and-choose parameters:
CreateHudText(
    Text     :"cool!",
    Location :Location.Right,
    TextColor:Color.Red
);
  • Added the Paris pathmap for pathfinding on Paris.

  • Improved performance of importing files. Doing one change will no longer re-parse all imported files. (#83)
  • Fixed constructors not being able to use parameter values.
  • Fixed setting player variables at an index. (#82)

v0.7.1

  • Fixed imports

v0.7.2

  • Fixed Map enum output (#84)
  • Fixed truncating long variable names (#85)

v0.7.3

  • Fixed crash when using root as an expression.
  • Fixed crash when some methods had incomplete parameters.
  • Fixed formatted localized strings.

OSTW v0.6

15 Oct 18:27

Choose a tag to compare

OSTW v0.6 Pre-release
Pre-release

Pathfind: Pathfinds a player.
PathfindAll: Pathfinds an array of players.
StopPathfinding: Stops pathfinding for the specified players.
IsPathfinding: Returns true if the target player is pathfinding.
IsPathfindStuck: Returns true if the time it takes to reach the next node takes longer than expected.
FixPathfind: Fix pathfinding by teleporting the player to the next node.
GetPath: Gets an array of vectors determining each node in a path.
WalkPath: Players will walk to each vector in the input vector array.
NextNode: Gets the location of the next node.


Fixed CreateInworldText parameters
Fixed this in classes.
Added some missing strings.
Fixed value methods not throwing error when used as an action.
Assignment operators will use Modify Global/Player Variable (At Index) when supported.
Fixed ternary conditional bug.
Fixed bug when calling methods in classes and structs.

OSTW v0.5

19 Sep 16:44

Choose a tag to compare

OSTW v0.5 Pre-release
Pre-release
  • Classes

Example

The example below will print 2 then 4. If myClass was changed into a struct, it would print 2 then 2.

rule: "Test"
{
    myClass myVar = new myClass();
    SmallMessage(AllPlayers(), myVar.classVar);
    change(myVar);
    SmallMessage(AllPlayers(), myVar.classVar);
}

method change(myClass myVar)
{
    myVar.classVar = 4;
}

class myClass
{
    public define classVar = 2;
}

A maximum of 1000 classes can be allocated at a time. Use the delete() keyword to free up memory.

rule: "Clean Up"
{
    delete(myVar);
}
  • New methods

ClassMemory(): Gets the percentage of class memory remaining.

ClassMemoryRemaining(): Gets the number of classes that can be created.

ClassMemoryUsed(): Gets the number of classes that were created.

  • Type conversion

(<MyClass>myVar).methodInClass();

Macros work in conditions and do not use any actions.

private macro NotOnTeam(define player): FilteredArray(AllPlayers(), ArrayElement().team != player.team && IsAlive(ArrayElement()));
private macro Normal(define start, define end): RayCastHitNormal(start, end, null, null, true);
  • New keywords: delete, macro, root.

    • root can be used in classes/structs to get variables created at the rule level.
  • public/private accessors work now. Class/struct elements are now private by default.

  • CreateTextMinimal is now CreateText. Old CreateText is now CreateTextFancy. CreateText (old CreateTextMinimal) creates even less effects now.

  • ShowWireframe and the CreateText methods can now take a vector as a rotation parameter. If the vector is a constant (ex Vector(40, 10, 20)) it will create the effect with the model pre-rotated.

  • Changed boolean operators | and & to || and &&.

  • Added variable invert (-myVal == myVal * -1).

  • Fixed invalid statements not showing an error.

  • Fixed structs in foreach (#59).

  • Fixed crash when using model variables as normal variables.

VSCode extension v0.1.2

Updated for new keywords.


v0.5.0.1 hotfix

Fixed crash if there are no constructors in a class or struct.

OSTW v0.4

28 Aug 19:35

Choose a tag to compare

OSTW v0.4 Pre-release
Pre-release

Text renderer (custom text!)

Create custom text using effects. There are 3 ways to make text:

  • CreateText(Text, Angle, Visible To, Location, Scale, Reevaluation, Get Effect IDs): Creates text using Overwatch's default font.
  • CreateTextMinimal(Text, Angle, Visible To, Location, Scale, Reevaluation, Get Effect IDs): Creates text using a small amount of effects.
  • CreateTextFont(Text, Font, Quality, Angle, VisibleTo, Location, Scale, Reevaluation, Get Effect IDs): Creates text using a custom font.

If Get Effect IDs is set to true, the method will return the effect IDs used to create the effect. They can be destroyed using the new method DestroyEffectArray(Effect Array, Destroy Per Loop =1).

Import models!

Create custom models using ShowWireframe(Model, Visible To, Location, Scale, Reevaluation, Get Effect IDs).

If Get Effect IDs is set to true, the method will return the effect IDs used to create the effect. They can be destroyed using the new method DestroyEffectArray(Effect Array, Destroy Per Loop =1).

import "C:\Users\HDdel\Desktop\myModel.obj" as pillar;

define playervar location;

rule:"Create pillar"
Event.OngoingPlayer
if (IsButtonHeld(EventPlayer(), Button.Interact)) 
{
    location = PositionOf(EventPlayer()); 
    ShowWireframe(pillar, AllPlayers(), location, 1, EffectRev.VisibleToPositionAndRadius, true);
}

Methods and constructors now support workshop enums as a parameter.

method createTeamMarker(define location, Color color)
{
    CreateEffect(AllPlayers(), Effect.Sphere, color, EyePosition() + Vector(0, 0.25, 0), 0.2, EffectRev.VisibleToPositionAndRadius);
}

VS Code extension v0.1.0

Only requires one port now.
New command to create a webview panel for the workshop output.


v0.4.0.1 hotfix

Fixed direct font loading.
Fixed some fonts having missing lines.


v0.4.0.2 hotfix

Fixed a certain syntax error causing a crash.

OSTW v0.3.15.1

19 Aug 15:49

Choose a tag to compare

OSTW v0.3.15.1 Pre-release
Pre-release

Fixed certain syntax errors causing crashes.
Fixed import not working with the language server if the file importing has any spaces in the path.