<RetVar/IF><Expression>

This forum serves as MSCI Reference at EGOSOFT. It's Read-Only for non MSCI Group members.

Moderators: Scripting / Modding Moderators, MSCI Moderators

Locked
mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

<RetVar/IF><Expression>

Post by mark_a_condren » Tue, 7. Sep 10, 13:40

[skip|else] if [not]|while [not]| <RetVar/IF> = [<Variable> | <Constant> | <Operator> | <Value>] [...]


[skip|else] if [not]|while [not]| = The possible 'Conditional' statements that can be used with this command.
<RetVar/IF> = Variable name to save information to or one of the 'conditional' statements.
<Variable> = Another variable that this one is to have the same value as.
<Constant> = One of the available built in SE constants.
<Operator> = See below for available 'Operators'.
<Value> = Another 'value' that this variable is to be equal to.


The general purpose expression instruction.

This instruction is capable of setting variables, and creating general if, skip if, and while statements. This is the instruction that must be used to create any conditional statement that tests for a condition other than null.
An entire loop can be created using nothing but variations of this statement and end:

Example:
  • $Loop = 0
    while $Loop < 10
    | $Loop = $Loop + 1
    end


The following lists gives all the supported operators in order of their evaluation precedence:
  1. Primary: ( and ) precedence override to explicitly give the order of operator evaluation
  2. Unary: ~ arithmetic negation (bitwise complement), ! logical negation
  3. Multiplicative: * arithmetic multiplication, / arithmetic division, mod arithmetic modulo
  4. Additive: + arithmetic addition, - arithmetic subtraction
  5. Relational: < less than, > greater than, <= less than or equal to, >= greater than or equal to
  6. Equality: == equal to, != not equal to
  7. & bitwise AND
  8. ^ bitwise exclusive OR
  9. | bitwise inclusive OR
  10. AND logical AND (0 and null are FALSE, any other value is TRUE)
  11. OR logical OR
There is also mod and Bracketry: ( and ), however, i do not know where they fit into the order of evaluation precedence:
  1. mod See this link for an explanation of modulo.
  2. Bracketry: ( and ) Primary inclusive, do this before what is outside them.

Command Location:
Last edited by mark_a_condren on Tue, 28. Sep 10, 15:28, edited 4 times in total.

Locked

Return to “MSCI Reference”