Skip to content

Expression 2 Directives

Vurv edited this page Jul 18, 2022 · 8 revisions

To declare wiremod inputs, outputs and persistent variables, you use directives.
You can also use them to say the name of the E2, change the model, tell it when to trigger and autoupdate and finally tell it to be a little more strict.

@name

Define the name of the E2 chip to show when hovering over it.

@name My E2 Chip

@inputs

Define an input to use with the wire system alongside its type.

@inputs X Y:string [Z W]:number

@outputs

Define an output to use with the wire system alongside its type.

@outputs X Y:string [Z W]:number

@persist

Define a variable to persist across multiple executions.
Otherwise variables will reset to their default values.

@persist X Y:string [Z W]:number

@trigger

The trigger directive can selectively enable or disable inputs from triggering executions. Possible values are all/none, but also a list of inputs. You usually will not need to worry about this.

@trigger all
# or
@trigger X Y

@model

Sets the model of the E2 chip.

@model path/to/prop/model

@autoupdate

Using the autoupdate directive will enable auto updating. What this means is that whenever you paste a duplication of an E2 with autoupdate enabled, the E2 will check your files for a new version of that E2 and upload it. Note:

  • Only works on saved E2s.
  • To disable autoupdate, simply don't write @autoupdate
  • If you for some reason need to get an old version of your E2 from a dupe, you will have to temporarily change the name of your E2 so that the autoupdate feature doesn't find the file. Then it'll silently fail and leave you with the old code.
@autoupdate

@strict

The strict directive tells the E2 whether to report undefined or incorrect behavior in E2. For example if you try to applyForce a NULL / Invalid Entity / Prop that does not exist, it will warn you rather than do nothing. This is useful for debugging and generally to keep your E2 efficient and safe. It is not enabled by default as to keep backwards compatibility with old E2s.

@strict

Expression 2 ⚙️

Getting Started 🕊

Guides 🎓

Tools 🛠️

Click To Expand

Advanced

Beacon 💡

Control 🎛️

Data 💿

Detection 👀

Display 💻

Render 🖌

I/O 🔌

Physics 🚀

Utilities 🛠️

RFID 💳

Wireless 🛜

Gates 🚥

Click To Expand

TBD

Extras 🔭

Clone this wiki locally