anchor.diff:  
   
   procedure TKMScripting.Load(LoadStream: TKMemoryStream);
  -var
  -  I,K: Integer;
  +
  +  procedure LoadVar(Src: Pointer; aType: TPSTypeRec);
  +  var
  +    ArrayCount: Integer;
  +    I: Integer;
  +    Offset: Cardinal;
  +  begin
  +    //See uPSRuntime line 1630 for algo idea
  +    case aType.BaseType of
  +      btU8:  LoadStream.Read(tbtu8(Src^)); //Byte, Boolean
  +      btS32: LoadStream.Read(tbts32(Src^)); //Integer
  +      btSingle: LoadStream.Read(tbtsingle(Src^));
  +      btStaticArray:begin
  +                      LoadStream.Read(ArrayCount);
  +                      Assert(ArrayCount = TPSTypeRec_StaticArray(aType).Size, 'Script array element count mismatches saved count');
  +                      for I:=0 to ArrayCount-1 do
  +                      begin
  +                        Offset := TPSTypeRec_Array(aType).ArrayType.RealSize * I;
  +                        LoadVar(Pointer(IPointer(Src) + Offset), TPSTypeRec_Array(aType).ArrayType);
  +                      end;
  +                    end;
  +      btArray:      begin
  +                      LoadStream.Read(ArrayCount);
  +                      PSDynArraySetLength(Pointer(Src^), aType, ArrayCount);
  +                      for I:=0 to ArrayCount-1 do
  +                      begin
  +                        Offset := TPSTypeRec_Array(aType).ArrayType.RealSize * I;
  +                        LoadVar(Pointer(IPointer(Src^) + Offset), TPSTypeRec_Array(aType).ArrayType);
  +                      end;
  +                    end;
  +      //Already checked and reported as an error in LinkRuntime, no need to crash it here
  +      //else Assert(False);
  +    end;
  +  end;
  +
  +var
  +  I: Integer;
     V: PIFVariant;
  -  ArrayCount: Integer;
  -  ArrayType: TPSTypeRec;
  -  ArrayVar: TPSVariantIFC;
  -  TmpInt: Integer;
  -  TmpSingle: Single;
     //Do not save PS global variables strings
     //TmpString: AnsiString;
   begin
  
positive.code:     for I := 0 to fExec.GetVarCount - 1 do
      begin
        V := fExec.GetVarNo(I);
        Allowed := (V.FType.BaseType in [btU8, btS32, btSingle])
                   or ((V.FType.BaseType = btStaticArray) and (TPSTypeRec_StaticArray(V.FType).ArrayType.BaseType in [btU8, btS32, btSingle]))
                   or SameText(V.FType.ExportName, 'TKMScriptStates')
                   or SameText(V.FType.ExportName, 'TKMScriptActions');
        if not Allowed then
          fErrorString := fErrorString + 'Unsupported global variable type ' + IntToStr(V.FType.BaseType) + ': ' + V.FType.ExportName + '|';
      end;
  
      //Link script objects with objects
  
negative.code: 
  //Link the ByteCode with used functions and load it into Executioner
  procedure TKMScripting.LinkRuntime;
  
    function ValidateVarType(aType: TPSTypeRec): string;
    var
      ArrayCount: Integer;
      I: Integer;
      Offset: Cardinal;
    begin
      //See uPSRuntime line 1630 for algo idea
      case aType.BaseType of
        btU8,
        btS32,
        btSingle: ; //Valid types
        btArray,
        btStaticArray: Result := ValidateVarType(TPSTypeRec_Array(aType).ArrayType);
        else           Result := 'Unsupported global variable type ' + IntToStr(aType.BaseType) + ': ' + aType.ExportName + '|';
      end;
    end;
  
  var
    ClassImp: TPSRuntimeClassImporter;
    I: Integer;
  