OSTW v0.5
Pre-release-
Classes
Example
The example below will print 2 then 4. If myClass was changed into a struct, it would print 2 then 2.
rule: "Test"
{
myClass myVar = new myClass();
SmallMessage(AllPlayers(), myVar.classVar);
change(myVar);
SmallMessage(AllPlayers(), myVar.classVar);
}
method change(myClass myVar)
{
myVar.classVar = 4;
}
class myClass
{
public define classVar = 2;
}A maximum of 1000 classes can be allocated at a time. Use the delete() keyword to free up memory.
rule: "Clean Up"
{
delete(myVar);
}-
New methods
ClassMemory(): Gets the percentage of class memory remaining.
ClassMemoryRemaining(): Gets the number of classes that can be created.
ClassMemoryUsed(): Gets the number of classes that were created.
-
Type conversion
(<MyClass>myVar).methodInClass();-
Macros (#23)
Macros work in conditions and do not use any actions.
private macro NotOnTeam(define player): FilteredArray(AllPlayers(), ArrayElement().team != player.team && IsAlive(ArrayElement()));
private macro Normal(define start, define end): RayCastHitNormal(start, end, null, null, true);-
New keywords:
delete,macro,root.rootcan be used in classes/structs to get variables created at the rule level.
-
public/privateaccessors work now. Class/struct elements are now private by default. -
CreateTextMinimalis nowCreateText. OldCreateTextis nowCreateTextFancy.CreateText(oldCreateTextMinimal) creates even less effects now. -
ShowWireframeand theCreateTextmethods can now take a vector as a rotation parameter. If the vector is a constant (exVector(40, 10, 20)) it will create the effect with the model pre-rotated. -
Changed boolean operators
|and&to||and&&. -
Added variable invert (
-myVal==myVal * -1). -
Fixed invalid statements not showing an error.
-
Fixed structs in
foreach(#59). -
Fixed crash when using model variables as normal variables.
VSCode extension v0.1.2
Updated for new keywords.
v0.5.0.1 hotfix
Fixed crash if there are no constructors in a class or struct.