Script Variable Math

Post » Sun Feb 23, 2014 1:00 pm

I couldn't find anything at all on the subject anywhere on the internet, so I figured this would be the place to get the facts straight.

Script variables can be used and changed with a lot of different mathemathical symbols and so on. But I am very much in doubt how to use them.

Here's what I know about the meaning and use of various script symbols:

  • ; ; means "the following is not a part of the script", e.g.:
    KillerJoe.Kill() ; for example a description telling about the death of Killer Joe in details, or just something else not being a part of the script itself
  • == ; means "is the same as", e.g.:
    If TheMagicNumber == 3 ; if the magic number is 3;do stuffendif
  • < ; means "less than", e.g.:
    If TheMagicNumber < 10 ; if the magic number is less than 10;do stuffendif
  • > ; means "more than", e.g.:
    If TheMagicNumber > 7 ; if the magic number is more than seven;do stuffendif
  • <= ; means "same as or less than", e.g.:
    If TheMagicNumber <= 10 ; if the magic number is 10 or less than 10;do stuffendif
  • >= ; means "same as or more than"; e.g.:
    If TheMagicNumber >= 10 ; if the magic number is 10 or more than 10;do stuffendif
  • = ; means "becomes", e.g.:
    TheMagicNumber = 3 ; the magic number is changed to 3
  • && ; means "and", e.g.:
    If TheMagicNumber == 3 && KillerJoe == Guilty ; if the magic number is 3 and Killer Joe is guilty;do stuffendif
  • || ; I'm not sure, but I guess it means "or", e.g.:
    If TheMagicNumber == 3 || TheMagicNumber > 7 ; if the magic number is either 3 or more than 7;do stuffendif
  • + ; I'm not sure, but I guess it means "add the following to the current value", e.g.:
    int TheMagicNumber = 3TheMagicNumber + 20 ; we add 20 to the magic number which is currently 3; the new magic number is therefore 23
  • - ; I'm not sure, but I guess it means "subtract the following from the current value", e.g.:
    int TheMagicNumber = 23TheMagicNumber - 8 ; we subtract 8 from the magic number which is currently 23; the new magic number is therefore 15
  • * ; means "multiply the following with the current value", e.g.:
    int TheMagicNumber = 15TheMagicNumber * 2 ; we multiply the magic number which is currently 15 with 2; the new magic number is therefore 30
  • / ; I'm not sure, but I guess it means "divide the current value by the following", e.g.:
    int TheMagicNumber = 30TheMagicNumber / 10 ; we divide the magic number which is currently 3 by 10; the new magic number is therefore 3
  • ! ; Got no idea.
  • -= ; Got no idea.
  • += ; Got no idea.
  • != ; Got no idea.

Have a look at the above and tell me if I'm correct and what the four bottom lines means. And please tell me if there's more symbols than these.

User avatar
Calum Campbell
 
Posts: 3574
Joined: Tue Jul 10, 2007 7:55 am

Post » Sun Feb 23, 2014 6:47 am

Your assumptions looks pretty much all correct. Regarding the last four:

! is the logical NOT symbol (so, !true == false)

a -= b (a = a - b )

a += b (a = a + b )

!= is the symbol meaning "does not equal" (thus, the opposite of ==)

You may be interested in the Wiki's http://www.creationkit.com/Operator_Reference

User avatar
CArlos BArrera
 
Posts: 3470
Joined: Wed Nov 21, 2007 3:26 am


Return to V - Skyrim