forked from positively-charged/bcc
-
Notifications
You must be signed in to change notification settings - Fork 4
Scripts
TDRR edited this page Jan 17, 2023
·
4 revisions
When a script has no parameters, the void
keyword is not necessary. The
parentheses are not required either:
// These are all the same:
script "Test" ( void ) {}
script "Test" () {}
script "Test" {}
The name of a script parameter is optional. You still need to pass an argument for an unnamed parameter, but you won't be able to use such a parameter. An unnamed parameter can be used to indicate to the user that a parameter is no longer used.
script "Test" ( int used1, int, int used2 ) {
Print( d: used1 + used2 ); // Output: 400
}
script "Main" enter {
ACS_NamedExecute( "Test", 0, 100, 200, 300 );
}
A script cannot have optional parameters.
In a script, the magic identifier, __SCRIPT__
, is a string literal that
contains either the name or number of the current script:
script 123 enter {
Print( s: __SCRIPT__ ); // Output: 123
}
script "abc" enter {
Print( s: __SCRIPT__ ); // Output: abc
}