This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
beyond:pangoscript [2020/05/26 16:20] Bob Varkevisser [IF operator] |
beyond:pangoscript [2020/05/27 16:17] Bob Varkevisser removed |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~DRAFT~~ | ||
+ | |||
====== PangoScript ====== | ====== PangoScript ====== | ||
Line 20: | Line 22: | ||
===== Special characters (separators) ===== | ===== Special characters (separators) ===== | ||
- | ' | + | . ; ' : ! � ^ + - * \ [ ] ( ) { } ? % | & = |
- | ' | + | |
===== Predefined constants ===== | ===== Predefined constants ===== | ||
Line 43: | Line 44: | ||
===== Math operations (expressions) ===== | ===== Math operations (expressions) ===== | ||
- | * Standard : + , - , / , * , % | + | * Standard : + - / * % |
* Inversion : ! | * Inversion : ! | ||
* bit OR : | | * bit OR : | | ||
Line 55: | Line 56: | ||
- | ==== IF operator | + | ==== IF ==== |
- | + | Syntax: if (expression) operator | |
- | Syntax: if ( expression ) operator | + | |
expression - covered with brackets. Must be an expression with | expression - covered with brackets. Must be an expression with | ||
numerical result that gives " | numerical result that gives " | ||
- | variable it's possible to write "if (variable) | + | variable it's possible to write |
+ | |||
+ | | ||
Compare operators are: >, >=, <, <=, =, <>. They produces numerical result 0 or 1. | Compare operators are: >, >=, <, <=, =, <>. They produces numerical result 0 or 1. | ||
- | You can combine comparing operations with "&" | + | You can combine comparing operations with "&" |
- | operator will be executed if condition gets non-zero result. If you want to place other operator after "if (condition) operator" | + | |
- | GOTO operator | + | operator |
+ | if (condition) operator | ||
+ | it must be divided with ; but it's better to place next operator on the next line. | ||
- | Syntax: | + | ==== GOTO ==== |
- | "label" is a name of position for a jump. The label can be placed before any operator and separated by ":" | + | Syntax: goto label |
- | mylabel: WaitForBeat 4 | + | " |
- | ... do something... | + | |
- | goto mylabel | + | |
+ | mylabel: WaitForBeat 4 | ||
+ | ... do something... | ||
+ | goto mylabel | ||
- | Operator GOTO can work with the labels inside the string variables. It means that you declare string variable, assign a label name to variable, and then you a variable in GOTO. | + | Operator GOTO can work with the labels inside the string variables. It means that you declare string variable, assign a label name to variable, and then you a variable in GOTO. Example: |
- | Example: | + | |
- | var s | + | |
- | s=" | + | s=" |
- | goto s | + | goto s |
+ | DisplayPopup "It does not work" | ||
+ | exit | ||
+ | |||
+ | mylabel: | ||
+ | DisplayPopup "It works" | ||
+ | |||
+ | ==== VAR ==== | ||
- | DisplayPopup "It does not work" | ||
- | exit | ||
- | mylabel: | + | PangoScript allow define local variables. The lifetime for the local variable defined by lifetime of the Scripter that execute PangoScript. As soon as the Scripter freed, all its local variables are removed as well. |
- | DisplayPopup "It works" | + | |
+ | All variables must be declared before the using. No need to specify the type of variable. The variable automatically adjust the type depending on value. Internally supported integer, float and string variables. | ||
+ | var MyVariable | ||
+ | var a,b,c | ||
+ | Before using the variable must be initialized by some value. Otherwise BEYOND will generate error and stop script execution. Example: | ||
- | VAR operator | + | var MyInteger, MyString |
+ | MyInteger = 10 | ||
+ | MyString = " | ||
- | PangoScript allow define local variables. The lifetime for the local variable defined by lifetime of the Scripter that execute PangoScript. As soon as the Scripter freed, all its local variables are removed as well. | + | All variables |
- | All variables must be declared before the using. No need to specify the type of variable. The variable automatically adjust the type depending on value. Internally supported integer, float and string variables. | + | ==== GLOBALVAR ==== |
- | The declaration start from VAR operation and the follow one or more variable names. As example: | + | |
- | var MyVariable | + | A variable can be declared as global. In this case, it visible in ALL scripts of BEYOND. |
- | var a,b,c | + | |
- | Before using the variable must be initialized by some value. Otherwise BEYOND will generate error and stop script execution. Example: | + | globalvar s |
- | var MyInteger, MyString | + | s=" |
- | MyInteger | + | goto s |
- | MyString = "Hello!" | + | DisplayPopup |
+ | exit | ||
+ | |||
+ | mylabel: | ||
+ | DisplayPopup "It works" | ||
+ | |||
+ | ===== General functions ===== | ||
- | All variables declared | + | ^ Function ^ description ^ value ^ |
+ | | **intstr**(value: | ||
+ | | **floatstr**(value: | ||
+ | | **abs**(value: | ||
+ | | **int**(value: | ||
+ | | **frac**(value: | ||
+ | | **round**(value: | ||
+ | | **sqr**(value: | ||
+ | | **sqrt**(value: | ||
+ | | **cos**(value: | ||
+ | | **sin**(value: | ||
+ | | **tan**(value: | ||
+ | | **arcsin**(value: | ||
+ | | **arccos**(value: | ||
+ | | **arctan**(value: | ||
+ | | **arctan2**(dx, | ||
+ | | **min**(a, | ||
+ | | **max**(a, | ||
+ | | **pi**: | ||
+ | | **invert**(value: | ||
+ | |||
+ | ===== Date and Time ===== | ||
+ | |||
+ | ^ Function ^ description ^ | ||
+ | | **now: | ||
+ | | **tickcount**: | ||
+ | | **hms**(hour, | ||
+ | | **GetYear**: | ||
+ | | **GetMonth**: | ||
+ | | **GetDay**: | ||
+ | | **timestr**(now: | ||
+ | | **timestrlong**(now: | ||
+ | |**datestr**(now: | ||
+ | |**datestrlong**(now: | ||
+ | | **dayofweek**(now: | ||
+ | | **dayofweeklong**(now: | ||
+ | |||
+ | ===== String functions ===== | ||
+ | |||
+ | ^ Function ^ description ^ | ||
+ | | **uppercase**(string): | ||
+ | | **lowercase**(string: | ||
+ | | **crlf**: | ||
+ | |||
+ | ===== Clock And Metronome ===== | ||
+ | |||
+ | ^ Function ^ description ^ | ||
+ | | **b2s**(beats) | transform beats to seconds | | ||
+ | | **b2ms**(beats) | transform beats to milliseconds | | ||
+ | | **s2b**(seconds) | transform seconds to beats | | ||
+ | | **b2s**(seconds) | transform beats to seconds | | ||
+ | ===== More to come ===== | ||
- | GLOBALVAR operator | ||
- | The variable can be declared as global. In this case, it visible in ALL scripts of BEYOND. |