public void StartSequence(string sequenceName, HybrasylWorldObject associateOverride = null) { DialogSequence sequence; VisibleObject associate; Logger.DebugFormat("{0} starting sequence {1}", User.Name, sequenceName); // If we're using a new associate, we will consult that to find our sequence associate = associateOverride == null ? User.DialogState.Associate as VisibleObject : associateOverride.Obj as VisibleObject; // Use the local catalog for sequences first, then consult the global catalog if (!associate.SequenceCatalog.TryGetValue(sequenceName, out sequence)) { if (!User.World.GlobalSequencesCatalog.TryGetValue(sequenceName, out sequence)) { Logger.ErrorFormat("called from {0}: sequence name {1} cannot be found!", associate.Name, sequenceName); // To be safe, end all dialogs and basically abort User.DialogState.EndDialog(); return; } } // sequence should now be our target sequence, let's end the current state and start a new one User.DialogState.EndDialog(); User.DialogState.StartDialog(associate, sequence); User.DialogState.ActiveDialog.ShowTo(User, associate); }
public void StartDialogSequence(string sequenceName, HybrasylWorldObject associate) { DialogSequence newSequence; if (User.World.GlobalSequencesCatalog.TryGetValue(sequenceName, out newSequence)) { newSequence.ShowTo(User, (VisibleObject)associate.Obj); // End previous sequence User.DialogState.EndDialog(); User.DialogState.StartDialog(associate.Obj as VisibleObject, newSequence); } }
/// <summary> /// Execute the script in the passed scope. /// </summary> /// <param name="scope">The ScriptScope the script will execute in.</param> public void ExecuteScript(WorldObject caller = null) { dynamic resolvedCaller; if (caller != null) { if (caller is User) { resolvedCaller = new HybrasylUser(caller as User); } else { resolvedCaller = new HybrasylWorldObject(caller); } Scope.SetVariable("npc", resolvedCaller); } Scope.SetVariable("world", Processor.World); Compiled.Execute(Scope); }
public void StartSequence(String sequenceName, HybrasylWorldObject associateOverride = null) { DialogSequence sequence; VisibleObject associate; Logger.DebugFormat("{0} starting sequence {1}", User.Name, sequenceName); // If we're using a new associate, we will consult that to find our sequence associate = associateOverride == null ? User.DialogState.Associate as VisibleObject : associateOverride.Obj as VisibleObject; // Use the local catalog for sequences first, then consult the global catalog if (!associate.SequenceCatalog.TryGetValue(sequenceName, out sequence)) { if (!User.World.GlobalSequencesCatalog.TryGetValue(sequenceName, out sequence)) { Logger.ErrorFormat("called from {0}: sequence name {1} cannot be found!", associate.Name, sequenceName); // To be safe, end all dialogs and basically abort User.DialogState.EndDialog(); return; } } // sequence should now be our target sequence, let's end the current state and start a new one User.DialogState.EndDialog(); User.DialogState.StartDialog(associate, sequence); User.DialogState.ActiveDialog.ShowTo(User, associate); }
public void StartDialogSequence(String sequenceName, HybrasylWorldObject associate) { DialogSequence newSequence; if (User.World.GlobalSequencesCatalog.TryGetValue(sequenceName, out newSequence)) { newSequence.ShowTo(User, (VisibleObject)associate.Obj); // End previous sequence User.DialogState.EndDialog(); User.DialogState.StartDialog(associate.Obj as VisibleObject, newSequence); } }
/// <summary> /// Execute the script in the passed scope. /// </summary> /// <param name="scope">The ScriptScope the script will execute in.</param> public void ExecuteScript(WorldObject caller = null) { dynamic resolvedCaller; if (caller != null) { if (caller is User) resolvedCaller = new HybrasylUser(caller as User); else resolvedCaller = new HybrasylWorldObject(caller); Scope.SetVariable("npc", resolvedCaller); } Scope.SetVariable("world", Processor.World); Compiled.Execute(Scope); }
/// <summary> /// Attach a Scriptable to an in game NPC. /// </summary> /// <returns></returns> public bool AttachScriptable(WorldObject obj) { Associate = new HybrasylWorldObject(obj); Logger.InfoFormat("Scriptable name: {0}", Instance.name); return true; }
public void AssociateScriptWithObject(WorldObject obj) { Associate = new HybrasylWorldObject(obj); obj.Script = this; }
/// <summary> /// Attach a Scriptable to an in game NPC. /// </summary> /// <returns></returns> public bool AttachScriptable(WorldObject obj) { Associate = new HybrasylWorldObject(obj); Logger.InfoFormat("Scriptable name: {0}", Instance.name); return(true); }