public string getPartyMember(int index) { if (index - 1 >= RPG.RPGParty.Length || index <= 0) { SBubble.MyError("RPG API Error", "Party Member index out of bounds", SBubble.TraceLua(statename)); return(""); } return(RPG.RPGParty[index - 1]); }
public void setPartyMember(int index, string tag) { if (index - 1 >= RPG.RPGParty.Length || index <= 0) { SBubble.MyError("RPG API Error", "Party Member index out of bounds", SBubble.TraceLua(statename)); return; } RPG.RPGParty[index - 1] = tag; }
public string GetValue(string k) { try { InitSwap(); return(SwapMap[k]); } catch (Exception E) { SBubble.MyError($"Swap.Data[\"{k}\"]:", E.Message, SBubble.TraceLua(statename)); return("ERROR"); } }
public override void Update(GameTime gameTime) { try { State.DoString($"(BUB_Update or {FlowManager.NOTHING})()", "Draw"); } catch (Exception err) { var trace = SBubble.TraceLua(FlowManager.CurrentFlow); //trace = State.GetDebugTraceback(); #if DEBUG trace += $"\n\n{err.StackTrace}"; #endif SBubble.MyError("Update Callback error", err.Message, trace); } }
static public void Init(string statename) { var me = new Bubble_Swap(); try { var script = QuickStream.StringFromEmbed("Bubble_Swap.nil"); me.statename = statename; me.State = SBubble.State(statename); me.LuaState = me.State.state; me.LuaState["Bubble_Swap"] = me; SBubble.DoNIL(statename, script, "BUBBLE_Swap Init"); } catch (Exception DoffeEllende) { SBubble.MyError("Init BUBBLE_Swap Error", DoffeEllende.Message, $"{SBubble.TraceLua(statename)}\n\n{DoffeEllende.StackTrace}"); } }
public int Height(string tag) { //BubConsole.CSay($"Trying to get: {tag}"); try { if (!Images.ContainsKey(tag)) { SBubble.MyError("Image.Height():", $"Unknown tag: {tag}", SBubble.TraceLua(vm)); return(0); } return(Images[tag].Height); } catch (Exception e) { SBubble.MyError(".NET error", e.Message, ""); return(0); } }
public override void Draw(GameTime gameTime) { var cmd = $"(BUB_Draw or {FlowManager.NOTHING})()"; try { //BubConsole.CSay("Draw Call"); //BubConsole.CSay(FlowManager.CurrentFlow); State.DoString(cmd, "Draw"); //BubConsole.CSay("End Draw Call"); } catch (Exception error) { #if CallBackTrack SBubble.MyError("Callback error", error.Message, cmd.ToString()); #else SBubble.MyError("Callback error", error.Message, SBubble.TraceLua(FlowManager.CurrentFlow)); #endif } }
public void GoToFlow(string flow) { flow = flow.ToUpper(); if (!qstr.Prefixed(flow, "FLOW_")) { flow = $"FLOW_{flow}"; } if (!SBubble.HaveState(flow)) { SBubble.MyError("Flow Management Error", $"GoToFlow: Flow {flow} doesn't exist!", SBubble.TraceLua(State)); } else { FlowManager.CurrentFlow = flow; BubConsole.WriteLine($"Flow set to: {flow}"); SBubble.State(flow).DoString("if BUB_Arrive then assert(type(BUB_Arrive)=='function','BUB_Arrive must be a function but it is a '..type(BUB_Arrive)) BUB_Arrive() end"); } }
void Crash(string msg, string addtrace = "") { var trace = $"\tState: {statename}\n\n{SBubble.TraceLua(statename)}\n\n{addtrace}"; SBubble.MyError("Bubble_Conf API error!", msg, trace); }
public void Draw(string tag, int x, int y, int frame) { if (!Images.ContainsKey(tag)) { SBubble.MyError("Bubble Graphics Error", $"There is no image tagged'{tag}'", SBubble.TraceLua(FlowManager.CurrentFlow)); } try { Images[tag].Draw(x, y, frame); } catch (Exception e) { SBubble.MyError($".NET: Draw(\"{tag}\",{x},{y},{frame}):", e.Message, $"FLOW:\n{SBubble.TraceLua(FlowManager.CurrentFlow)}"); } }
public void StretchDraw(string tag, int x, int y, int w, int h, int frame) { try { if (!Images.ContainsKey(tag)) { SBubble.MyError("Bubble Graphics Error", $"There is no image tagged'{tag}'", SBubble.TraceLua(FlowManager.CurrentFlow)); } Images[tag].StretchDraw(x, y, w, h, frame); } catch (Exception KakkieDeKakkerlak) { SBubble.MyError($"StretchDraw(\"{tag}\", {x}, {y}, {frame}):", KakkieDeKakkerlak.Message, SBubble.TraceLua(FlowManager.CurrentFlow)); } }
public string Load(string file, string assign = "") { try { var tag = assign; var at = 0; if (tag == "") { do { at++; tag = $"IMAGE:{at}"; } while (Images.ContainsKey(tag)); } if (qstr.Suffixed(file.ToLower(), ".jpbf")) { Images[tag] = TQMG.GetBundle(file); } else { Images[tag] = TQMG.GetImage(file); } if (Images[tag] == null) { throw new Exception($"Filed loading {file} at {tag}\n{UseJCR6.JCR6.JERROR}"); } return(tag); } catch (Exception Catastrophe) { #if DEBUG SBubble.MyError($"Bubble.Graphics.Images.Load(\"{file}\",\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}\n\n.NET Traceback:\n{Catastrophe.StackTrace}"); #else SBubble.MyError($"Bubble.Graphics.Images.Load(\"{file}\",\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}"); #endif return("Il ya une catastrophe"); } }
public override void Update(GameTime gameTime) { var cmd = new StringBuilder("(BUB_Update or "); cmd.Append(FlowManager.NOTHING); cmd.Append(")();\n"); // Please note, due to the odd syntax, Lua DOES require a semi-colon this time. var pressed = FlowManager.KB.GetPressedKeys(); var mousepos = $"{FlowManager.MS.X},{FlowManager.MS.Y}"; // keyboard foreach (Keys key in (Keys[])Enum.GetValues(typeof(Keys))) { if (FlowManager.KB.IsKeyDown(key) && !keyhit[key]) { cmd.Append("(BUB_KeyPressed or "); cmd.Append(FlowManager.NOTHING); cmd.Append(")(\""); cmd.Append(key.ToString()); cmd.Append("\", "); cmd.Append((int)key); cmd.Append(");\n"); } if ((!FlowManager.KB.IsKeyDown(key)) && keyhit[key]) { cmd.Append("(BUB_KeyReleased or "); cmd.Append(FlowManager.NOTHING); cmd.Append(")(\""); cmd.Append(key.ToString()); cmd.Append("\", "); cmd.Append((int)key); cmd.Append(");\n"); } keyhit[key] = FlowManager.KB.IsKeyDown(key); } // Mouse Left if (FlowManager.MS.LeftButton == ButtonState.Pressed && !MSLeft) { cmd.Append("(BUB_MousePressed or "); cmd.Append(FlowManager.NOTHING); cmd.Append(")(\"Left\", "); cmd.Append(mousepos); cmd.Append(");\n"); } if (FlowManager.MS.LeftButton == ButtonState.Released && MSLeft) { cmd.Append("(BUB_MouseReleased or "); cmd.Append(FlowManager.NOTHING); cmd.Append(")(\"Left\", "); cmd.Append(mousepos); cmd.Append(");\n"); } MSLeft = FlowManager.MS.LeftButton == ButtonState.Pressed; // Mouse Right if (FlowManager.MS.RightButton == ButtonState.Pressed && !MSRight) { cmd.Append("(BUB_MousePressed or "); cmd.Append(FlowManager.NOTHING); cmd.Append(")(\"Right\", "); cmd.Append(mousepos); cmd.Append(");\n"); } if (FlowManager.MS.RightButton == ButtonState.Released && MSRight) { cmd.Append("(BUB_MouseReleased or "); cmd.Append(FlowManager.NOTHING); cmd.Append(")(\"Right\", "); cmd.Append(mousepos); cmd.Append(";)\n"); } MSRight = FlowManager.MS.RightButton == ButtonState.Pressed; // Mouse Center if (FlowManager.MS.MiddleButton == ButtonState.Pressed && !MSCenter) { cmd.Append("(BUB_MousePressed or "); cmd.Append(FlowManager.NOTHING); cmd.Append(")(\"Center\", "); cmd.Append(mousepos); cmd.Append(");\n"); } if (FlowManager.MS.MiddleButton == ButtonState.Released && MSCenter) { cmd.Append("(BUB_MouseReleased or "); cmd.Append(FlowManager.NOTHING); cmd.Append(")(\"Center\", "); cmd.Append(mousepos); cmd.Append(");\n"); } MSCenter = FlowManager.MS.MiddleButton == ButtonState.Pressed; // Mouse Move if (mousepos != oldMS) { cmd.Append("(BUB_MouseMove or "); cmd.Append(FlowManager.NOTHING); cmd.Append(")("); cmd.Append(mousepos); cmd.Append(");\n"); oldMS = mousepos; } try { State.DoString(cmd.ToString(), "Update/Events"); } catch (Exception error) { #if CallBackTrack SBubble.MyError("Callback error", error.Message, cmd.ToString()); #else SBubble.MyError("Callback error", error.Message, SBubble.TraceLua(SBubble.TraceLua(FlowManager.CurrentFlow))); #endif } }
public void SetSwapFolder(string s) { if (SwapMap != null) { SBubble.MyError("Swap error", "The first swap call has already been done, and the folder cannot be changed after that anymore!", SBubble.TraceLua(statename)); } else { SwapFolderSet = s; } }
public bool ActorExists(int ID, string ActTag) { try { var ET = $"Actorexists({ID},\"{ActTag}\")"; if (!KMaps.ContainsKey(ID)) { Debug.WriteLine($"{ET}: WARNING! Map non-existent!"); return(false); } if (!Layers.ContainsKey(ID)) { Debug.WriteLine($"{ET}: WARNING! Layer for map not set!"); return(false); } if (!KMaps[ID].Layers.ContainsKey(Layers[ID])) { Debug.WriteLine($"{ET}: Referring to non-existent layer '{Layers[ID]}'!"); return(false); } var L = KMaps[ID].Layers[Layers[ID]]; var E = L.HasTag(ActTag); return(E && L.FromTag(ActTag).kind == "Actor"); } catch (Exception Tragedie) { SBubble.MyError($"Checking Actor exists on map #{ID}, tag {ActTag}", Tragedie.Message, SBubble.TraceLua(statename)); return(false); } }
public void Kill(int ID, string Tag) { try { KthuraObject Victim = null; foreach (KthuraObject Obj in KMaps[ID].Layers[Layers[ID]].Objects) { if (Obj.Tag == Tag) { Victim = Obj; } } if (Victim == null) { return; } KMaps[ID].Layers[Layers[ID]].Objects.Remove(Victim); if (AutoRemap[ID]) { TotalRemap(ID); } } catch (Exception Disasteriffic) { SBubble.MyError($"Kthura.Kill({ID},{Tag}):", Disasteriffic.Message, $"Layer: {Layers[ID]}\n\n{SBubble.TraceLua(statename)}"); } }
void Crash(string msg) => SBubble.MyError("Kthura Error", msg, SBubble.TraceLua(statename));
public string GrabScreen(string assign = "") { try { var tag = assign; var at = 0; if (tag == "") { do { at++; tag = $"IMAGE:{at}"; } while (Images.ContainsKey(tag)); } Images[tag] = TQMG.GrabImage(); if (Images[tag] == null) { throw new Exception("Grabbed image == null!"); } return(tag); } catch (Exception Catastrophe) { #if DEBUG SBubble.MyError($"Bubble.Graphics.Images.Grab(\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}\n\n.NET Traceback:\n{Catastrophe.StackTrace}"); #else SBubble.MyError($"Bubble.Graphics.Images.Grab(\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}"); #endif return("Il ya une catastrophe"); } }
public void KillFlow(string flow) { flow = flow.ToUpper(); if (!qstr.Prefixed(flow, "FLOW_")) { flow = $"FLOW_{flow}"; } if (SBubble.HaveState(flow)) { SBubble.MyError("Flow Management Error", $"KillFlow: Flow {flow} doesn't exist!", SBubble.TraceLua(State)); } SBubble.KillState(flow); }
public string GrabPart(int x, int y, int w, int h, string assign = "") { try { var tag = assign; var at = 0; if (tag == "") { do { at++; tag = $"IMAGE:{at}"; } while (Images.ContainsKey(tag)); } Images[tag] = TQMG.GrabImage(x, y, w, h); return(tag); } catch (Exception Catastrophe) { #if DEBUG SBubble.MyError($"Bubble.Graphics.Images.Grab(\"{assign}\",{x},{y},{w},{h})", Catastrophe.Message, $"{SBubble.TraceLua(vm)}\n\n.NET Traceback:\n{Catastrophe.StackTrace}"); #else SBubble.MyError($"Bubble.Graphics.Images.Grab(\"{assign}\",{x},{y},{w},{h})", Catastrophe.Message, $"{SBubble.TraceLua(vm)}"); #endif return("Il ya une catastrophe"); } }