Ejemplo n.º 1
0
        public void CommandLineExists(ScriptThread thread)
        {
            string commandLine = thread.GetStringParameter(0);

            foreach (string arg in Engine.GlobalInstance.CommandLineArguments)
            {
                string[] value = new string[0];
                string command = arg;
                int colonIndex = arg.IndexOf(':');

                // Seperate values and command if a colon exists.
                if (colonIndex >= 0)
                {
                    value = new string[1];
                    value[0] = arg.Substring(colonIndex + 1, arg.Length - colonIndex - 1);
                    if (value[0].IndexOf(",") >= 0) value = value[0].Split(new char[1] { ',' });
                    command = arg.Substring(0, colonIndex);
                }

                if (command.ToLower() == commandLine.ToLower())
                {
                    thread.SetReturnValue(true);
                    return;
                }
            }

            thread.SetReturnValue(false);
        }
Ejemplo n.º 2
0
 public void DistanceToPoint(ScriptThread thread)
 {
     double vectorX = thread.GetDoubleParameter(0) - thread.GetDoubleParameter(2);
     double vectorY = thread.GetDoubleParameter(1) - thread.GetDoubleParameter(3);
     double distance = Math.Sqrt(vectorX * vectorX + vectorY * vectorY);
     thread.SetReturnValue(distance);
 }
Ejemplo n.º 3
0
 public void GameFlag(ScriptThread thread)
 {
     string key = thread.GetStringParameter(0).ToLower();
     if (!Fusion.GlobalInstance.GameFlags.Contains(key))
         return;
     thread.SetReturnValue((string)Fusion.GlobalInstance.GameFlags[key]);
 }
Ejemplo n.º 4
0
 public void CharacterCount(ScriptThread thread)
 {
     string haystack = thread.GetStringParameter(0);
     string needle = thread.GetStringParameter(1);
     int count = 0;
     for (int i = 0; i < haystack.Length; i++)
         if (haystack[i] == needle[0]) count++;
     thread.SetReturnValue(count);
 }
Ejemplo n.º 5
0
 public void CameraClearColor(ScriptThread thread)
 {
     CameraNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as CameraNode;
     if (entity == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CameraClearColor with an invalid object.", LogAlertLevel.Error);
         return;
     }
     thread.SetReturnValue(entity.ClearColor);
 }
Ejemplo n.º 6
0
 public void OpenStream(ScriptThread thread)
 {
     Stream stream = StreamFactory.RequestStream(thread.GetStringParameter(0), (StreamMode)thread.GetIntegerParameter(1));
     if (stream == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called OpenStream with an unreachable url.", LogAlertLevel.Error);
         return;
     }
     thread.SetReturnValue(new StreamScriptObject(new ScriptStream(stream)));
 }
Ejemplo n.º 7
0
 public void ChannelLength(ScriptThread thread)
 {
     ISampleBuffer sound = ((NativeObject)thread.GetObjectParameter(0)).Object as ISampleBuffer;
     if (sound == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called ChannelLength with an invalid object.", LogAlertLevel.Error);
         return;
     }
     thread.SetReturnValue(sound.Length);
 }
Ejemplo n.º 8
0
 public void CreateAnimationProcessB(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 CreateAnimationProcess with an invalid object.", LogAlertLevel.Error);
         return;
     }
     thread.SetReturnValue(new ProcessScriptObject(new AnimationProcess(entity, (AnimationMode)thread.GetIntegerParameter(1), thread.GetIntegerParameter(2), thread.GetIntegerParameter(3), thread.GetIntegerParameter(4))));
 }
Ejemplo n.º 9
0
 public void GameFlagValueAtIndex(ScriptThread thread)
 {
     int index = thread.GetIntegerParameter(0);
     int currentIndex = 0;
     foreach (string value in Fusion.GlobalInstance.GameFlags.Values)
     {
         if (index == currentIndex)
         {
             thread.SetReturnValue(value);
             return;
         }
         currentIndex++;
     }
 }
Ejemplo n.º 10
0
 public void KeyReleased(ScriptThread thread)
 {
     thread.SetReturnValue(InputManager.KeyReleased((KeyCodes)thread.GetIntegerParameter(0)));
 }
Ejemplo n.º 11
0
 public void MouseScroll(ScriptThread thread)
 {
     thread.SetReturnValue(InputManager.MouseScroll);
 }
Ejemplo n.º 12
0
 public void LanguagePackName(ScriptThread thread)
 {
     thread.SetReturnValue(LanguageManager.Name);
 }
Ejemplo n.º 13
0
 public void ExecutingThread(ScriptThread thread)
 {
     thread.SetReturnValue(new ThreadScriptObject(thread));
 }
Ejemplo n.º 14
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);
        }
Ejemplo n.º 15
0
 public void Contains(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).Contains(thread.GetStringParameter(1)));
 }
Ejemplo n.º 16
0
 public void PadLeftA(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).PadLeft(thread.GetIntegerParameter(1)));
 }
Ejemplo n.º 17
0
 public void Chr(ScriptThread thread)
 {
     thread.SetReturnValue(Convert.ToString((char)thread.GetIntegerParameter(0)));
 }
Ejemplo n.º 18
0
 public void PadRightB(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).PadRight(thread.GetIntegerParameter(1), thread.GetStringParameter(2)[0]));
 }
Ejemplo n.º 19
0
 public void EndsWith(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).EndsWith(thread.GetStringParameter(1)));
 }
Ejemplo n.º 20
0
 public void Replace(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).Replace(thread.GetStringParameter(1), thread.GetStringParameter(2)));
 }
Ejemplo n.º 21
0
 public void IndexOfA(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).IndexOf(thread.GetStringParameter(1)));
 }
Ejemplo n.º 22
0
 public void SubstringB(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).Substring(thread.GetIntegerParameter(1), thread.GetIntegerParameter(2)));
 }
Ejemplo n.º 23
0
 public void LanguageCaptionExists(ScriptThread thread)
 {
     thread.SetReturnValue(LanguageManager.CaptionExists(thread.GetStringParameter(0)));
 }
Ejemplo n.º 24
0
 public void ToUpperCase(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).ToUpper());
 }
Ejemplo n.º 25
0
 public void MouseDesktopY(ScriptThread thread)
 {
     thread.SetReturnValue(InputManager.MouseY);
 }
Ejemplo n.º 26
0
 public void TrimStart(ScriptThread thread)
 {
     thread.SetReturnValue(thread.GetStringParameter(0).TrimStart());
 }
Ejemplo n.º 27
0
 public void BindedKeyReleased(ScriptThread thread)
 {
     thread.SetReturnValue(InputManager.BindedKeyReleased(thread.GetStringParameter(0)));
 }
Ejemplo n.º 28
0
 public void WordWrap(ScriptThread thread)
 {
     thread.SetReturnValue(StringMethods.WordWrap(thread.GetStringParameter(0), thread.GetIntegerParameter(1)));
 }
Ejemplo n.º 29
0
 public void MouseDeltaX(ScriptThread thread)
 {
     thread.SetReturnValue(InputManager.MouseDeltaX);
 }
Ejemplo n.º 30
0
 public void Asc(ScriptThread thread)
 {
     thread.SetReturnValue((int)thread.GetStringParameter(0)[0]);
 }