Example #1
0
        public override void Execute(Context c)
        {
            object         options           = m_options.Execute(c);
            IList <string> stringListOptions = options as IList <string>;
            IDictionary <string, string> stringDictionaryOptions = options as IDictionary <string, string>;

            if (stringListOptions != null)
            {
                if (stringListOptions.Count == 0)
                {
                    throw new Exception("No menu options specified");
                }
                m_worldModel.DisplayMenuAsync(m_caption.Execute(c), stringListOptions, m_allowCancel.Execute(c), m_callbackScript, c);
            }
            else if (stringDictionaryOptions != null)
            {
                if (stringDictionaryOptions.Count == 0)
                {
                    throw new Exception("No menu options specified");
                }
                m_worldModel.DisplayMenuAsync(m_caption.Execute(c), stringDictionaryOptions, m_allowCancel.Execute(c), m_callbackScript, c);
            }
            else
            {
                throw new Exception("Unknown menu options type");
            }
        }
Example #2
0
 public override void Execute(Context c)
 {
     c.ReturnValue = m_returnValue.Execute(c);
     if (m_worldModel.Version >= WorldModelVersion.v550)
     {
         c.IsReturned = true;
     }
 }
Example #3
0
 public override void Execute(Context c)
 {
     c.ReturnValue = m_returnValue.Execute(c);
     // Leaving this set to v550 for backwards compatibility
     // Some things do not work in 550 games when this is changed to 580
     if (m_worldModel.Version >= WorldModelVersion.v550)
     {
         c.IsReturned = true;
     }
 }
Example #4
0
        public override void Execute(Context c)
        {
            IQuestList result = m_list.Execute(c) as IQuestList;

            if (result != null)
            {
                result.Add(m_value.Execute(c));
            }
            else
            {
                throw new Exception("Unrecognised list type");
            }
        }
        public override void Execute(Context c)
        {
            IDictionary result = m_dictionary.Execute(c) as IDictionary;

            if (result != null)
            {
                result.Add(m_key.Execute(c), m_value.Execute(c));
            }
            else
            {
                throw new Exception("Unrecognised dictionary type");
            }
        }
Example #6
0
            public bool Execute(Context c, string result)
            {
                foreach (var switchCase in m_cases)
                {
                    IFunctionGeneric expr = m_compiledExpressions[switchCase.Key];

                    if (result == expr.Execute(c).ToString())
                    {
                        switchCase.Value.Execute(c);
                        return(true);
                    }
                }
                return(false);
            }
Example #7
0
        public override void Execute(Context c)
        {
            object      result     = m_list.Execute(c);
            IEnumerable resultList = null;

            // Cannot foreach over strings as of Quest 5.3, as the Char data type is not supported (retained functionality
            // for pre-5.3 to prevent breaking existing scripts)

            if (m_scriptContext.WorldModel.Version < WorldModelVersion.v530 || !(result is string))
            {
                var resultDictionary = result as IDictionary;
                if (resultDictionary != null)
                {
                    resultList = resultDictionary.Keys;
                }
                else
                {
                    resultList = result as IEnumerable;
                }
            }

            if (resultList == null)
            {
                throw new Exception(string.Format("Cannot foreach over '{0}' as it is not a list", result));
            }

            foreach (object variable in resultList)
            {
                c.Parameters[m_variable] = variable;
                m_loopScript.Execute(c);
                if (c.IsReturned)
                {
                    break;
                }
            }
        }
Example #8
0
        public override void Execute(Context c)
        {
            object result = m_function.Execute(c);

            m_worldModel.PlayerUI.Speak(result.ToString());
        }
Example #9
0
        public override void Execute(Context c)
        {
            object result = m_function.Execute(c);

            throw new Exception(result.ToString());
        }