Git Product home page Git Product logo

overpy's Introduction

OverPy v2.0

High-level language for the Overwatch Workshop with support for compilation and decompilation.

The philosophy behind this language is "what would the workshop be like if it was coded in Python?" As such, this language aims to be as Python-like as reasonably possible.

Join the EloHell discord for feedback: https://discord.gg/zwF7KQm #highlevel-scripting

Languages supported: English, French, Korean

Installing the VS Code extension

Decompiling your code

Press Ctrl+Shift+P, then type "decompile". The "Decompile" command should pop up: https://i.imgur.com/jzfo2Bj.png

You will then be able to paste your workshop code, but also to specify names for global and player variables: owo

Once you click on "decompile", a save prompt will pop up; just select the location where you wish to create the file. owo

If everything goes well, you will be able to start coding in OverPy: owo

Coding

The extension includes syntax highlighting, autocompletion, and documentation:

owo

owo

Note that the extension is still in BETA; there can be a few bugs, and some documentation is missing. However it is still usable.

Also, big thanks to arxenix, who parsed the workshop documentation: https://github.com/arxenix/owws-documentation/blob/master/workshop.json

Compiling

Press the "Compile" button at the top right: owo

If everything goes right, you should get a success notification, and the content of the code is copied into your clipboard. Else, you will get an error: owo

Demo page

Try it out here!

owo

OverPy Syntax

The syntax is Python, except:

  • True/False/None have been replaced by true/false/null
  • The ++ and -- operators have been added (same effect as +=1 and -=1)
  • The modulo operator has higher precedence than the multiplication/division operator
  • The "while" loop has been replaced by "do: ... while x".

Rule metadata (name of the rule and event) is defined with annotations:

  • @Rule "name of the rule": the title of the rule.
  • @Event global: the event of the rule (here "global"). Events can be: global, eachPlayer, playerTookDamage, playerDealtDamage, playerDealtFinalBlow, playerDied, playerEarnedElimination, playerDealtHealing, playerReceivedHealing, playerJoined, playerLeft.
  • @Team all: the team targeted by this rule (can be omitted). Valid values are: all, 1, 2
  • @Slot 11: the slots targeted by this rule (can be omitted). Valid values are 0-11.
  • @Hero widowmaker: the heroes targeted by this rule (can be omitted).

Other than that, it's just plain old Python. I suggest to run the demo to get a better understanding of the syntax.

In most cases, the function names are just the english function names in camelCase, eg: Create Hud Text() -> createHudText(). Else, see the function reference "FUNCTIONS.md".

Macros

Macros are done with the preprocessor keyword "define". For example:

#!define currentSectionWalls A
#!define wasFirstZombieLastRound L

Function macros are supported as well:

#!define setUsefulVars(x)     hasFirstInfectionPassed = x\
    currentSection = x\
    firstInfectionLoopIndex = x\
    countdownProgress = x\
    roundWinners = x

Note the usage of the backslashed lines.

You can do script macros with the special __script__ function. For example:

#!define addFive(x) __script__("addfive.js")

The content of addfive.js is simply x+5 (no return!)

For the technical details:

  • Arguments are automatically inserted into the script (in this case, var x = 123; would be inserted at the top of the script)
  • A vect() function is automatically inserted, so that vect(1,2,3) returns an object with the correct x, y, and z properties and toString() function
  • The script is then evaluated using eval()

overpy's People

Contributors

zezombye avatar ayykamp avatar spoo-bar avatar tawling avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.