-
Notifications
You must be signed in to change notification settings - Fork 27
Functions
Most function names in OverPy follow these rules:
-
The function name is camelCased:
Create Effect
→createEffect
. -
Functions that take a player, or player array, as the first argument are member functions:
Teleport(Event Player, Vector(1,2,3))
→eventPlayer.teleport(vect(1,2,3))
. Exceptions are ̀`kill(), ̀`heal()
anddamage()
. -
Event-related variables are keywords:
Event Was Critical Hit
→eventWasCriticalHit
. They have a special color in the VS Code extension. -
Function names are sometimes modified to better reflect how they would be in an actual programming language:
Control Mode Scoring Percentage
→getControlScorePercentage()
,Count Of(array)
→len(array)
.
It is advised to rely on the VS Code autocompletion. If you cannot find a function name, decompile the workshop function to get the OverPy name.
Below are the functions that have a special syntax. The angled brackets < >
indicate arguments; these should be replaced by the appropriate arguments.
Workshop function | OverPy function
----------------- | ---------------
And(<op1>, <op2>)
| <op1> and <op2>
Or(<op1>, <op2>)
| <op1> or <op2>
Not(<op1>)
| not <op1>
Compare(<op1>, <operator>, <op2>)
| <op1> <operator> <op2>
Add(<op1>, <op2>)
| <op1> + <op2>
Subtract(<op1>, <op2>)
| <op1> - <op2>
Multiply(<op1>, <op2>)
| <op1> * <op2>
Divide(<op1>, <op2>)
| <op1> / <op2>
Modulo(<op1>, <op2>)
| <op1> % <op2>
^(1)
Note: the modulo operator has a higher precedence than the division or multiplication operator.
Set Global Variable(<variable>, <value>)
→ <variable> = <value>
Note: <variable>++
can be used if <value>
is 1.
Modify Global Variable(<variable>, Add, <value>)
→ <variable> += <value>
Modify Global Variable(<variable>, Append To Array, <value>)
→ <variable>.append(<value>)
Modify Global Variable(<variable>, Divide, <value>)
→ <variable> /= <value>
Modify Global Variable(<variable>, Max, <value>)
→ <variable> max= <value>
Modify Global Variable(<variable>, Min, <value>)
→ <variable> min= <value>
Modify Global Variable(<variable>, Modulo, <value>)
→ <variable> %= <value>
Modify Global Variable(<variable>, Raise To Power, <value>)
→ <variable> **= <value>
Modify Global Variable(<variable>, Remove From Array By Index, <value>)
→ del <variable>[<value>]
Note: unlike Python, this removes all occurrences of the value in the specified array.
Modify Global Variable(<variable>, Remove From Array By Value, <value>)
→ <variable>.remove(<value>)
Note: <variable>--
can be used if <value>
is 1.
Modify Global Variable(<variable>, Subtract, <value>)
→ <variable> -= <value>
OverPy:
- Overview
- General Usage
- General Syntax
- Rules and Events
- Functions
- Control Flow
- Strings
- Compiler Options
- Custom game settings
- Preprocessing
- Advanced Constructs
Various stuff:
Development:
- [Coming soon]