Workshop.codes
Create
Abort Abort If Abort If Condition Is False Abort If Condition Is True Add Health Pool To Player Allow Button Apply Impulse Attach Players Big Message Break Call Subroutine Cancel Primary Action Chase Global Variable At Rate Chase Global Variable Over Time Chase Player Variable At Rate Chase Player Variable Over Time Clear Status Communicate Continue Create Beam Effect Create Dummy Bot Create Effect Create HUD Text Create Homing Projectile Create Icon Create In-World Text Create Progress Bar HUD Text Create Progress Bar In-World Text Create Projectile Create Projectile Effect Damage Declare Match Draw Declare Player Victory Declare Round Draw Declare Round Victory Declare Team Victory Destroy All Dummy Bots Destroy All Effects Destroy All HUD Text Destroy All Icons Destroy All In-World Text Destroy All Progress Bar HUD Text Destroy All Progress Bar In-World Text Destroy Dummy Bot Destroy Effect Destroy HUD Text Destroy Icon Destroy In-World Text Destroy Progress Bar HUD Text Destroy Progress Bar In-World Text Detach Players Disable Built-In Game Mode Announcer Disable Built-In Game Mode Completion Disable Built-In Game Mode Music Disable Built-In Game Mode Respawning Disable Built-In Game Mode Scoring Disable Death Spectate All Players Disable Death Spectate Target HUD Disable Game Mode HUD Disable Game Mode In-World UI Disable Hero HUD Disable Inspector Recording Disable Kill Feed Disable Messages Disable Movement Collision With Environment Disable Movement Collision With Players Disable Nameplates Disable Scoreboard Disable Text Chat Disable Voice Chat Disallow Button Else Else If Enable Built-In Game Mode Announcer Enable Built-In Game Mode Completion Enable Built-In Game Mode Music Enable Built-In Game Mode Respawning Enable Built-In Game Mode Scoring Enable Death Spectate All Players Enable Death Spectate Target HUD Enable Game Mode HUD Enable Game Mode In-World UI Enable Hero HUD Enable Inspector Recording Enable Kill Feed Enable Messages Enable Movement Collision With Environment Enable Movement Collision With Players Enable Nameplates Enable Scoreboard Enable Text Chat Enable Voice Chat End For Global Variable For Player Variable Go To Assemble Heroes Heal If Kill Log To Inspector Loop Loop If Loop If Condition Is False Loop If Condition Is True Modify Global Variable Modify Global Variable At Index Modify Player Score Modify Player Variable Modify Player Variable At Index Modify Team Score Move Player To Team Pause Match Time Play Effect Preload Hero Press Button Remove All Health Pools From Player Remove Health Pool From Player Remove Player Reset Player Hero Availability Respawn Restart Match Resurrect Return To Lobby Set Ability 1 Enabled Set Ability 2 Enabled Set Ability Charge Set Ability Cooldown Set Ability Resource Set Aim Speed Set Ammo Set Crouch Enabled Set Damage Dealt Set Damage Received Set Environment Credit Player Set Facing Set Global Variable Set Global Variable At Index Set Gravity Set Healing Dealt Set Healing Received Set Invisible Set Jump Enabled Set Jump Vertical Speed Set Knockback Dealt Set Knockback Received Set Match Time Set Max Ammo Set Max Health Set Melee Enabled Set Move Speed Set Objective Description Set Player Allowed Heroes Set Player Health Set Player Score Set Player Variable Set Player Variable At Index Set Primary Fire Enabled Set Projectile Gravity Set Projectile Speed Set Reload Enabled Set Respawn Max Time Set Secondary Fire Enabled Set Slow Motion Set Status Set Team Score Set Ultimate Ability Enabled Set Ultimate Charge Set Weapon Skip Skip If Small Message Start Accelerating Start Assist Start Camera Start Damage Modification Start Damage Over Time Start Facing Start Forcing Dummy Bot Name Start Forcing Player Outlines Start Forcing Player Position Start Forcing Player To Be Hero Start Forcing Spawn Room Start Forcing Throttle Start Game Mode Start Heal Over Time Start Healing Modification Start Holding Button Start Modifying Hero Voice Lines Start Rule Start Scaling Barriers Start Scaling Player Start Throttle In Direction Start Transforming Throttle Stop Accelerating Stop All Assists Stop All Damage Modifications Stop All Damage Over Time Stop All Heal Over Time Stop All Healing Modifications Stop Assist Stop Camera Stop Chasing Global Variable Stop Chasing Player Variable Stop Damage Modification Stop Damage Over Time Stop Facing Stop Forcing Dummy Bot Name Stop Forcing Player Outlines Stop Forcing Player Position Stop Forcing Player To Be Hero Stop Forcing Spawn Room Stop Forcing Throttle Stop Heal Over Time Stop Healing Modification Stop Holding Button Stop Modifying Hero Voice Lines Stop Scaling Barriers Stop Scaling Player Stop Throttle In Direction Stop Transforming Throttle Teleport Unpause Match Time Wait Wait Until While
Ability Charge Ability Cooldown Ability Icon String Ability Resource Absolute Value Add All Damage Heroes All Dead Players All Heroes All Living Players All Players All Players Not On Objective All Players On Objective All Support Heroes All Tank Heroes Allowed Heroes Altitude Of Ammo And Angle Between Vectors Angle Difference Append To Array Arccosine In Degrees Arccosine In Radians Arcsine In Degrees Arcsine In Radians Arctangent In Degrees Arctangent In Radians Array Array Contains Array Slice Assist Count Attacker Backward Button Char In String Closest Player To Color Compare Control Mode Scoring Percentage Control Mode Scoring Team Cosine From Degrees Cosine From Radians Count Of Cross Product Current Array Element Current Array Index Current Game Mode Current Map Custom Color Custom String Damage Modification Count Damage Over Time Count Direction From Angles Direction Towards Distance Between Divide Dot Product Down Empty Array Entity Count Entity Exists Evaluate Once Event Ability Event Damage Event Direction Event Healing Event Player Event Was Critical Hit Event Was Environment Event Was Health Pack Eye Position Facing Direction Of False Farthest Player From Filtered Array First Of Flag Position Forward Game Mode Global Global Variable Has Spawned Has Status Heal Over Time Count Healee Healer Healing Modification Count Health Health Of Type Hero Hero Being Duplicated Hero Icon String Hero Of Horizontal Angle From Direction Horizontal Angle Towards Horizontal Facing Angle Of Horizontal Speed Of Host Player Icon String If-Then-Else Index Of Array Value Index Of String Char Input Binding String Is Alive Is Assembling Heroes Is Between Rounds Is Button Held Is CTF Mode In Sudden Death Is Communicating Is Communicating Any Is Communicating Any Emote Is Communicating Any Spray Is Communicating Any Voice line Is Control Mode Point Locked Is Crouching Is Dead Is Dummy Bot Is Duplicating Is Firing Primary Is Firing Secondary Is Flag At Base Is Flag Being Carried Is Game In Progress Is Hero Being Played Is In Air Is In Alternate Form Is In Line of Sight Is In Setup Is In Spawn Room Is In View Angle Is Jumping Is Match Complete Is Meleeing Is Moving Is Objective Complete Is On Ground Is On Objective Is On Wall Is Portrait On Fire Is Reloading Is Standing Is Team On Defense Is Team On Offense Is True For All Is True For Any Is Using Ability 1 Is Using Ability 2 Is Using Ultimate Is Waiting For Players Last Assist ID Last Created Entity Last Created Health Pool Last Damage Modification ID Last Damage Over Time ID Last Heal Over Time ID Last Healing Modification ID Last Of Last Text ID Left Local Player Local Vector Of Magnitude Of Map Mapped Array Match Round Match Time Max Max Ammo Max Health Max Health of Type Min Modulo Multiply Nearest Walkable Position Normalize Normalized Health Not Null Number of Dead Players Number of Deaths Number of Eliminations Number of Final Blows Number of Heroes Number of Living Players Number of Players Number of Players On Objective Number of Slots Objective Index Objective Position Opposite Team Of Or Payload Position Payload Progress Percentage Player Carrying Flag Player Closest To Reticle Player Hero Stat Player Stat Player Variable Players In Slot Players On Hero Players Within Radius Players in View Angle Point Capture Percentage Position Of Raise To Power Random Integer Random Real Random Value In Array Randomized Array Ray Cast Hit Normal Ray Cast Hit Player Ray Cast Hit Position Remove From Array Right Round To Integer Score Of Server Load Server Load Average Server Load Peak Sine From Degrees Sine From Radians Slot Of Sorted Array Spawn Points Speed Of Speed Of In Direction Square Root String String Contains String Length String Replace String Slice String Split Subtract Tangent From Degrees Tangent From Radians Team Of Team Score Text Count Throttle Of Total Time Elapsed True Ultimate Charge Percent Up Update Every Frame Value In Array Vector Vector Towards Velocity Of Vertical Angle From Direction Vertical Angle Towards Vertical Facing Angle Of Vertical Speed Of Victim Weapon Workshop Setting Combo Workshop Setting Hero Workshop Setting Integer Workshop Setting Real Workshop Setting Toggle World Vector Of X Component Of Y Component Of Z Component Of

High-level languages Last updated November 26, 2024

Table of Contents

What is a High-Level Language?

A high-level language (HLL for short) is a programming language made from scratch to suit the Workshop. These languages have source code which is written in an external file and compiled via an external program. The resulting Workshop native code is then pasted into the Workshop via the clipboard. As such, these languages can only be used on PC, but the resulting modes are functionally identical to normal Workshop modes, and thus can be played on any platform.

Why use a High-Level Language?

Since source code is saved in an external file, and usually edited by external editors (usually Visual Studio Code), high-level languages gain a number of advantages over coding in-game (often referred to as UI coding). The advantages of working in external files include:

  • Offline editing
  • Much lower chance of overwriting work (looking at you, presets)
  • Find & Replace to easily mass edit certain snippets of code
  • Possibility of using version control systems such as Git
    • Version control systems allow developers to track changes, restore or retrieve previous versions of code, and manage working in teams.
  • Syntax highlighting (via code editing software)
  • Easier sub-expression manipulation
    • For example, if I put x + 5 in as the argument for an action, then I realize I want 2 * (x + 5), in UI, I would have to rewrite the entire expression. In a text file, I only have to add the parentheses and write what I want to add. This example is fairly easy to redo in UI, but for things like raycasts or deeply nested expressions, this ability becomes much more useful.

High-Level Languages themselves offer many advantages as well, including:

  • Multiple files
    • Code can be organized into logically separate files. For example, hero-specific logic could be separated into one file per hero.
  • Enums (click to expand) Enums are best explained with an example. Let's say I'm making a boss fight with three phases: normal, lava, and lasers, which I represent as a number stored in the global variable bossPhase. Whenever the boss reaches zero health, I can advance the phase just by adding 1 to bossPhase.

    However, this now presents an issue: I have to remember that 0 is the "normal phase," 1 is the "lava phase," and so on. On top of that, if I later decide to insert a phase before the lava phase, I have to remember to change all the times where I check if bossPhase == 1 or bossPhase == 2.

    One might be tempted to solve this problem by storing bossPhase as a string and using something like bossPhase = "normal". However, this presents another issue: typos. Even the most keen-eyed developers occasionally misspell something, and this can result in frustrating bugs where the main issue is that the code checks for if bossPhase = "lazers".

    Enums solve the clarity issue of using a number and the typo issue of strings by strictly defining a set of values (enums) which can be translated into normal Workshop objects (usually numbers). In my example, I would define an enum BOSS_PHASE which has members NORMAL, LAVA, and LASERS. It is very clear what I want now when I type bossPhase == BOSS_PHASE.NORMAL, and the compiler will throw an error if I make a typo like bossPhase == BOSS_PHASE.LAVVA, alerting me to the issue.
  • Macros and function macros (click to expand) Too often, a complicated expression is difficult to copy-paste into all the locations it is needed. For example, if I want to fire a raycast which hits every single person in its path (not stopping at the first hit), I would have to repeat the expression for my raycast many times.

    Macros and function macros enable Workshoppers to define a shorthand expression or pseudo-function which is easier to write multiple times, and as a bonus, the repeated code becomes much easier to read and understand the purpose of.
  • Switches

    • Switch statements enable different blocks of code to be run depending on the value of an expression. For example, depending on the hero a player is currently on, a switch could run different blocks of code. More information about switch statements, see this Wikipedia page.
  • Automatic string splitting

    • By default, only 3 parameters can be inserted into any given string. Adding more requires splitting the string into multiple strings stuck together. This is very error-prone in UI, as it can be hard to remember which level or section a string belongs in. High-level languages can handle this split automatically.
  • Automatic element count optimization

    • Many element-count-saving tricks, such as replacing 0 with False, unfortunately come at the cost of readability. High-level languages allow creators to utilize their element count as efficiently as possible while maintaining source-code readability.

List of High-Level Languages

Currently, only two HLLs are up to date: OverPy and OSTW.

Both HLLs have a decompiler, which instantly converts your existing UI modes into their respective languages.

OverPy

OverPy's philosophy is to be a "wrapper around the workshop": as a user, you should be able to do the compilation "in your head", meaning you know exactly which code OverPy will generate.

This is to ensure trust in the user (when there is a bug, you don't have to check if the bug comes from OverPy, as you already have to check if it's not a workshop bug and a bug from your code).

As such, OverPy focuses easily on user-defined macros and preprocessing, rather than runtime modifications.

The features OverPy has over OSTW are:

  • Javascript macros (write custom JS scripts to generate OverPy code) ;
  • Inline dictionaries ;
  • Special string modifiers ;
  • Aggressive element optimization ;
  • Stability ; there very rarely are mode-breaking bugs, and OverPy can even be used purely as an optimizer. It is common for users to decompile then compile without actually using OverPy, as it guarantees that decompiling then compiling results in the same effective gamemode.

Installation: https://github.com/Zezombye/overpy/wiki/General-usage

OSTW

OSTW aims to be a fully fledged programming language which is compiled into a Workshop script, similar to how Kotlin compiles into Java code. OSTW boasts many features, some of which might be familiar to programmers from other "real" programming languages, such as

  • Classes and Structs
  • Fully functional language server, which provides, among other things,
    • Real-time compilation and compile-time error feedback
    • Intelligent auto-complete
    • Symbols, enabling intelligent renaming and jumping to definitions
    • Using variables, macros, and functions before they are declared in the file
  • Built-in pathfinding utilities
  • Named and optional parameters
  • Ability to import animation data

Installation: https://github.com/ItsDeltin/Overwatch-Script-To-Workshop/wiki/Getting-Started

When Should I Use A High-Level Language, and Which One?

In general, the more complex and/or the more permanent your gamemode is, the more you should consider using a high-level language. As for which one, in general, OverPy tends to be more popular with people who have never programmed outside of the Workshop due to its structural similarity to the Workshop UI and general one-to-one mapping. OSTW tends to be the favorite among Workshop power users, who need more layers of abstraction and find the intelligent autocomplete to be more useful.

Workshop.codes
Join the Workshop.codes Discord