コード例 #1
0
 public static void SetInteger(NWN2ScriptVarTable variables, string name, int value)
 {
     try
     {
         variables.GetVariable(name).ValueInt = value;
         variables.GetVariable(name).VariableType = NWN2ScriptVariableType.Int;
     }
     catch
     {
         NWN2ScriptVariable var = new NWN2ScriptVariable(name, value);
         var.VariableType = NWN2ScriptVariableType.Int;
         variables.Add(var);
     }
 }
コード例 #2
0
 public static void SetFloat(NWN2ScriptVarTable variables, string name, float value)
 {
     try
     {
         variables.GetVariable(name).ValueFloat = value;
         variables.GetVariable(name).VariableType = NWN2ScriptVariableType.Float;
     }
     catch
     {
         NWN2ScriptVariable var = new NWN2ScriptVariable(name, value);
         var.VariableType = NWN2ScriptVariableType.Float;
         variables.Add(var);
     }
 }
コード例 #3
0
        //
        // Integer
        //

        #region Integer
        public static int GetInteger(NWN2ScriptVarTable variables, string name)
        {
            try
            {
                return variables.GetVariable(name).ValueInt;
            }
            catch
            {
                return 0;
            }
        }
コード例 #4
0
        //
        // Float
        //

        #region Float
        public static float GetFloat(NWN2ScriptVarTable variables, string name)
        {
            try
            {
                return variables.GetVariable(name).ValueFloat;
            }
            catch
            {
                return 0.0f;
            }
        }
コード例 #5
0
        //
        // String
        //

        #region String
        public static string GetString(NWN2ScriptVarTable variables, string name)
        {
            try
            {
                return variables.GetVariable(name).ValueString;
            }
            catch
            {
                return "";
            }
        }
コード例 #6
0
        public static void DeleteStringArray(NWN2ScriptVarTable variables, string name)
        {
            try
            {
                for (uint i = 1; i < uint.MaxValue; i++)
                {
                    NWN2ScriptVariable var = variables.GetVariable(name.Replace("*", i.ToString()));
                    if (var.VariableType == NWN2ScriptVariableType.None)
                        break;
                    variables.Remove(var);
                }
            }
            catch
            {

            }
        }
コード例 #7
0
 public static void SetString(NWN2ScriptVarTable variables, string name, string value)
 {
     try
     {
         variables.GetVariable(name).ValueString = value;
         variables.GetVariable(name).VariableType = NWN2ScriptVariableType.String;
     }
     catch
     {
         NWN2ScriptVariable var = new NWN2ScriptVariable(name, value);
         var.VariableType = NWN2ScriptVariableType.String;
         variables.Add(var);
     }
 }