static public void StartInitFlow() { BubConsole.CSay("Looking for Init script!"); var mainfile = ""; foreach (string e in SBubble.ResFiles) { var ce = e.ToUpper(); if (ce == "INIT.LUA" || qstr.Suffixed(ce, "/INIT.LUA") || ce == "INIT.NIL" || qstr.Suffixed(ce, "/INIT.NIL")) { mainfile = e; } } if (mainfile == "") { Error.GoError("Startup error", "INIT.LUA or INIT.NIL required somewhere in any folder.", "None have been found"); } else { //mainfile = "Script/Viezelul.lua"; GoHardFlow(BubConsole.Flow); try { BubConsole.WriteLine($"Loading Init Script: {mainfile}"); SBubble.NewState("$INIT", mainfile); //SBubble.State("$INIT").state.DoString("local fc = ''\nfor k,v in pairs(_G) do\n fc=fc .. type(v) .. ' ' ..k..'\\n'\n end\n error(fc)"); // debug line SBubble.State("$INIT").state.DoString("assert(type(Bubble_Init)=='function','Function expected for Bubble_Init, got '..type(Bubble_Init))\nBubble_Init()"); } catch (Exception e) { Error.GoError("Init Error", e.Message, ""); } } }
public static void Init(string s) { var state = SBubble.State(s).state; var script = QuickStream.StringFromEmbed("Bubble_Conf.nil"); state["Bubble_Conf"] = new Bubble_Conf(); Debug.WriteLine($"Initiating state: {s}"); BubConsole.CSay($"State \"{s}\" being prepared for Bubble_Conf"); SBubble.DoNIL(s, script, "Message box init script"); }
public void FreeInstance(string buf) { try { if (!InstanceMap.ContainsKey(buf)) { BubConsole.CSay($"No instance key \"{buf}\" so NOT releasing!"); // debug only! return; } var i = InstanceMap[buf]; i.Stop(); // I don't want any sound to linger until the C# garbage collector picks this up. InstanceMap.Remove(buf); InstanceAudioMap.Remove(buf); BubConsole.CSay($"Releasing {buf}"); // debug only! } catch (Exception Error) { SBubble.MyError($"Error on audio instance {buf}", Error.Message, ""); } }
public void Bye() { BubConsole.CSay("Bye request initiated!"); FlowManager.TimeToDie = true; }