Skip to content

Scripting Language examples

inidibininging edited this page Nov 14, 2020 · 2 revisions

: and !

You can create functions with the ":" symbol and call it via "!".

Example:

:myfunction ( someArg )
!CallSomeFunction ( someTagArg )

:CallSomeFunction ( someTagArg )
Wait +666 Seconds

@> and <@

the "@>" calls a factory and creates an instance. the entity made with the the factory made by the factory gets an alias as assignment. In the example below is ".weakEnemy"

:MakeAWeakEnemy ( someTag )
@>AliasOfEntityFactoryOnlyInAlphaNumeric .weakEnemy
Mod Stats someTag +123 Health
Mod Stats someTag +10 Speed
Mod Scale someTag +1 X
Mod Scale someTag +1 Y

the "<@" deletes the assignment

You CAN delete the assignment if you want or you can leave it and use the assignment later on in another function.

:MakeAWeakEnemy ( args )
@>AliasOfEntityFactoryOnlyInAlphaNumeric .weakEnemy
Mod Stats .weakEnemy +123 Health
Mod Stats .weakEnemy +10 Speed
Mod Scale .weakEnemy +1 X
Mod Scale .weakEnemy +1 Y
<@ .weakEnemy

:UseWeakEnemyLater ( args )
@>AliasOfEntityFactoryOnlyInAlphaCharacter .weakEnemy
Mod Stats .weakEnemy +123 Health
Mod Stats .weakEnemy +10 Speed
Mod Scale .weakEnemy +1 X
Mod Scale .weakEnemy +1 Y

:IAmUsingWeakEnemyAndRemovingItLater ( args )
Mod Stats .weakEnemy +1 Health
<@ .weakEnemy

Wait

You can wait for a specific amount of time. It can be Seconds, Miliseconds or Minutes.

:DoALittleDance ( args )
Wait +2 Minutes

:DoAnotherDance ( args )
Wait +10 Seconds

:Salsa ( args )
Wait +1 Miliseconds

The code below puts the play in position x: 512, y: 512 every 5 seconds.

:Start ( args )
Wait +5 Seconds
!CenterPlayers

:CenterPlayers ( args )
Mod Position .Players +512 X
Mod Position .Players +512 Y
!Start

Mod

Mod modifies a value of a game entity (specifically a CharacterEntity)

For more examples you can look into "apocalypse.echse"

Variables

For now, tags can be assigned to a variable and later passed on through a function to a "Mod" instruction. I'm trying to implement more capabilities in the future. If you are looking for an example, see below.

Arguments

For now it's only possible to pass variables to functions (The ones starting with ":" ex. ":myFunction"), execution (The ones starting with "!" ex. "!executeThis") and "Mod" instructions.

:almostKillEnemy ( myTag )
Mod Stats myTag +1 Health

:Main ( args )
Set characterEntitiesToKill = .weakEnemy
!almostKillEnemy ( characterEntitiesToKill )

If Clause

There is now a possibility to make If clauses and compare via "Is". For now it's very limited, but it will change in the future

:Main ( args )
    Set Tag something = .something
    Set Tag somethingElse = .somethingLolA
    If something Is .something
        Set Tag something = .lolCHANGED
        If somethingElse Is .somethingLol
            Set Tag somethingElse = .abcd
            If somethingElse Is .somethingLolA
                Set Tag something = .hahaha
            EndIf

            If somethingElse Is .somethingLolA
                Set Tag something = .hiohiohio
            EndIf            
        EndIf
    EndIf

:And ( a, b, r )
    Set Tag r = .t
    If a Is .f
        Set Tag r = .f
    EndIf
    If b Is .f
        Set Tag r = .f
    EndIf

:Or ( a, b, r)    
    Set Tag r = .f
    If a Is .t
        Set Tag r = .t
    EndIf
    If b Is .t
        Set Tag r = .t
    EndIf
     
:Not ( a, r )
    If a Is .t
        Set Tag r = .f
    EndIf
    If a Is .f
        Set Tag r = .t
    EndIf
     
:test ( x )
    Set Tag a = .t
    Set Tag b = .f
    Set Tag r = .NA
    :And ( a, b, r )
    :Not ( r, r )

Scripting Language Limitations

  • there is no possibility now for writing comments
  • names are only limited to letters WithoutSpaceInBetween
  • some stuff is broken
  • numbers must be written, either with a "+" or "-" prefix.