Example #1
0
        public void Implode(ScriptThread thread)
        {
            int arrayMemoryIndex = thread.GetArrayParameter(0);
            int arrayLength = thread.GetArrayLength(arrayMemoryIndex);
            string implodedString = "";

            for (int i = 0; i < arrayLength; i++)
                implodedString += thread.GetStringArrayElement(arrayMemoryIndex, i);

            thread.SetReturnValue(implodedString);
        }
 public void CreateAnimationProcessC(ScriptThread thread)
 {
     EntityNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as EntityNode;
     int memoryIndex = thread.GetArrayParameter(3);
     if (entity == null || memoryIndex == 0)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CreateAnimationProcess with an invalid object.", LogAlertLevel.Error);
         return;
     }
     int arrayLength = thread.GetArrayLength(memoryIndex);
     int[] frames = new int[arrayLength];
     for (int i = 0; i < arrayLength; i++)
         frames[i] = thread.GetIntArrayElement(memoryIndex, i);
     thread.SetReturnValue(new ProcessScriptObject(new AnimationProcess(entity, (AnimationMode)thread.GetIntegerParameter(1), thread.GetIntegerParameter(2), frames, thread.GetIntegerParameter(4))));
 }
 public void LengthI(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetArrayLength(thread.GetArrayParameter(0)));
 }
Example #4
0
        public void SetEntityCollisionLayers(ScriptThread thread)
        {
            EntityNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as EntityNode;
            if (entity == null)
            {
                DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called SetEntityCollisionLayers with an invalid object.", LogAlertLevel.Error);
                return;
            }
            if (entity.CollisionPolygon == null) return;
            int arrayIndex = thread.GetArrayParameter(1);
            entity.CollisionPolygon.Layers = new int[thread.GetArrayLength(arrayIndex)];

            for (int i = 0; i < thread.GetArrayLength(arrayIndex); i++)
                entity.CollisionPolygon.Layers[i] = thread.GetIntArrayElement(arrayIndex, i);
        }