Difference between revisions of "Magic Effects"

Jump to navigation Jump to search
337 bytes added ,  08:30, 14 November 2011
m
→‎Using Magic Effects in Scripts: rewrote effect code calculation for clarity
imported>JRoush
m (Added TOC)
imported>JRoush
m (→‎Using Magic Effects in Scripts: rewrote effect code calculation for clarity)
 
Line 75: Line 75:


Now, the confusing part. The effect code for vanilla effects isn't just an arbitrary integer. It is the ASCII representation of the first four characters of the editorID, interpreted as an integer. For example:
Now, the confusing part. The effect code for vanilla effects isn't just an arbitrary integer. It is the ASCII representation of the first four characters of the editorID, interpreted as an integer. For example:
  editorID = "FIDG"
  1. The editorID of a vanilla effect is "FIDG"
  effect code = 70 + (73 * 256) + (68 * 256^2) + (71 * 256^3) = 1,195,657,542   ;; "F" = 70, "I" = 73, "D" = 68, "G" = 71
 
  2. The ASCII values of the (first) four characters are
      "F" = 70 = 46h
      "I" = 73 = 49h
      "D" = 68 = 44h
      "G" = 71 = 47h
 
3. Re-interpret these values as a 32-bit integer:
      70               46h
    + 73 * 256       + 49h * 100h
    + 68 * 256^2     + 44h * 10000h
    + 71 * 256^3     + 47h * 1000000h
    --------------  ----------------
    1,195,657,542 =     47444946h    = Effect Code
The devs probably did this for readability while debugging. It's handy, because it means that you can easily get the (vanilla) effect codes from their editorID strings. In fact, since the codes are not shown in the CS, this is the ''only'' way to get the effect code. OBSE provides commands to do this automatically:
The devs probably did this for readability while debugging. It's handy, because it means that you can easily get the (vanilla) effect codes from their editorID strings. In fact, since the codes are not shown in the CS, this is the ''only'' way to get the effect code. OBSE provides commands to do this automatically:
  let longvar := MagicEffectCodeFromChars "FIDG" ;; returns 1,195,657,542
  let longvar := MagicEffectCodeFromChars "FIDG" ;; returns 1,195,657,542
Anonymous user

Navigation menu