Exemple #1
0
    /* ~~~~ RUN CODE ON MACHINE ~~~~ */

    public void RunOnMachine(string script)
    {
        if (focus == null)
        {
            Debug.Log("No machine focused!"); return;
        }

        Terminal.terminal.Print("<" + focus.MachineName + "> " + script);
        string[] commands = ScriptParser.ParseCommandStrings(script);
        focus.RunCommands(commands);
    }
Exemple #2
0
    // Run subscript on subMemory, and remove changes to anything that wasn't defined in the outer scope's memory
    public static (Dictionary <string, object>, object) RunSubscript(Dictionary <string, Method> methods,
                                                                     Dictionary <string, object> memory, Dictionary <string, object> subMemory, string subscript)
    {
        string[] subCommands = ScriptParser.ParseCommandStrings(subscript);

        // We ignore whatever the runtime equates to,
        // and instead specifically look for the value of the "return" variable
        (subMemory, _) = Run(methods, subMemory, subCommands);
        object result = ParseReturn(subMemory);

        return(ResolveSubScope(memory, subMemory), result);
    }
Exemple #3
0
 public void SetScript(string script)
 {
     this.Script = script;
     commands    = ScriptParser.ParseCommandStrings(script);
 }