Browsing Wiremod's section
← Back to ACE
🔁

Mirrored article

This page is synced automatically from the wiremod/wire GitHub wiki (last synced 1 hour ago). Edits made here will be overwritten on the next sync — contribute on the source wiki instead.

Expression 2 Self Aware

Expression 2 Self Aware

📄 WikiUpdated 1 hour ago•0 views
Expression 2: Self-Aware Functions With entity() you can use Entity-Support to get all the data from the expression-entity. With concmd() you can execute console commands. Also, the chip has the abili

Expression 2: Self-Aware Functions
With entity() you can use Entity-Support to get all the data from the expression-entity. With concmd() you can execute console commands.

Also, the chip has the ability to force itself. Forces aren't dispersed over a certain amount of time, all forces applied to an object within a tick are added up and then applied to the object. Force commands are best used with runOnTick( ) because you won't end up applying more than 1 force per tick and it is easier to do things like defy gravity.

This page lists all of the available functions used by the selfaware extension. To see examples, check Expression 2 Examples: Self Aware .

...............Function...............
Returns
Description

entity()

Gets the entity of the expression

concmd( )

Takes a string and executes it in the console. Returns 1 if it succeeded and 0 if it failed. The client must enable this in the console with wire_expression2_concmd 1 . The convar wire_expression2_concmd_whitelist allows you to choose which commands can be used.

applyForce( )

Applies force according to the vector given (Forces independently on each axis unlike a vector thruster)

applyOffsetForce( , )

Applies force to the expression according to the first vector from the location of the second

applyAngForce( )

Applies torque to the expression according to the given local angle

applyTorque( )

Applies torque to the expression according to the given local vector, representing the torque axis, magnitude and direction

selfDestruct()

Removes the expression

selfDestructAll()

Removes the expression and all constrained props

ioOutputEntities( )

Returns an array of all entities wired to the output .

ioInputEntity( )

Returns the entity the input is wired to.

ioSetOutput( , *)

Trigger the output of the E2 with the value *.

ioGetInput*( )
*
Get the value of the input of the E2 .

:getName()

Returns the name of the E2 .

setName( )

Returns 1 if the expression was duplicated

changed(*)

Checks if the current input is different from the last input. The last value is saved based on the position in the code, so you need to be careful when using it in loops. Note internal value gets initialized as 0/empty string/..., so calling changed for the first time will return 1 unless the input is 0/empty string/... . Also note that due to E2 skipping later parts of conditionals when the result is already determined (ie 0 & <whatever> is always 0, no need to execute <whatever> ), you usually want changed to be first, ie if(changed(A)&A) (not if(A&changed(A)) ), to ensure it never gets skipped in this way and just gets to "see" certain values, ie just 1, never 0

select( ,*,...)
*
Returns the -th value given after the index, *'s zero element otherwise. If you mix types, the behaviour is undefined.

hash()

Returns a numerical hash using the code of the E2 itself (Including comments).

hash( )

Returns a numerical hash using the string specified.

hashNoComments()

Returns a numerical hash using the code of the E2 itself (Excluding comments).

Was this article helpful?

See More

Discussion(0)

No comments yet. Be the first to ask a question!

Have a question? Sign in to join the discussion.