Пример #1
0
        public Bubble_Audio(string s)
        {
            var state  = SBubble.State(s).state;
            var script = QuickStream.StringFromEmbed("Audio.nil");

            state["Bubble_Audio"] = this;
            SBubble.DoNIL(s, script, "Audio init script");
        }
Пример #2
0
        private Bubble_Input(string state)
        {
            var script = QuickStream.StringFromEmbed("Input.lua");

            SBubble.State(state).state["Bubble_Input"] = this;
            SBubble.DoNIL(state, "#macro MouseLeft 1\n#macro MouseRight 2\n#macro MouseCenter 3", "Mouse Button macros");
            SBubble.State(state).DoString(script, "Input API header");
        }
Пример #3
0
 public void DoStateNIL(string s, string script, string chunk = "NIL:DOSTATE")
 {
     try {
         SBubble.DoNIL(s, script, chunk);
     } catch (Exception Uitzondering) {
         SBubble.MyError($"NILDoString(\"{s}\",\"{script}\",\"{chunk}\"):", Uitzondering.Message, "");
     }
 }
Пример #4
0
        static public void Init(string state)
        {
            me = new RPG_API();
            var script = QuickStream.StringFromEmbed("RPG_API.nil");

            SBubble.State(state).state["NALA_RPG"] = me;
            SBubble.DoNIL(state, script, "Link code RPG API");
            me.statename = state;
        }
Пример #5
0
        static public void API_Init(string namestate)
        {
            var ret    = new MapScriptAPI();
            var state  = SBubble.State(namestate).state;
            var script = QuickStream.StringFromEmbed("MapScriptAPI.nil");

            state["NALAMSAPI"] = ret;
            SBubble.DoNIL(namestate, script, "MapScript init script");
        }
Пример #6
0
        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");
        }
Пример #7
0
        private BubbleGraphics(Lua state, string id)
        {
            var bt     = QuickStream.OpenEmbedded("Graphics.nil");
            var script = bt.ReadString((int)bt.Size);

            vm = id;
            bt.Close();
            state["BubbleGraphics"] = this;
            SBubble.DoNIL(id, script, "Graphics init script");
            SBubble.State(id).DoString("Color = SetColor", "HACKING!"); // Prevent confusion since the console's not really accesible anyway
        }
Пример #8
0
        static public void Init(string astatename)
        {
            var Kth = new KthuraBubble();
            var S   = SBubble.State(astatename).state;

            S["BKTHURA"]  = Kth;
            Kth.statename = astatename;
            var bt = QuickStream.OpenEmbedded("KthuraBubble.nil");
            var l  = bt.ReadString((int)bt.Size);

            bt.Close();
            SBubble.DoNIL(astatename, l, "Kthura API Link Script");
        }
Пример #9
0
        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}");
            }
        }
Пример #10
0
        static public void StateInit(string vm)
        {
            api = new BubbleConsole();
            var s = SBubble.State(vm).state;

            s["Bubble_Console_Console"] = api;
            //*
            SBubble.DoNIL(vm, @"

            #accept Bubble_Console_Console

            global void CWriteLine(string msg,int r, int g, int b)
                assert(r>=0 and r<=255 and g>=0 and g<=255 and b>=0 and b<=255,'CWriteLine color setting invalid! ('..r..','..g..','..b..')')
                Bubble_Console_Console:WriteLine(msg,r,g,b)
            end

            global void CPrint(string msg,r,g,b)
                CWriteLine(msg,tonumber(r) or 255, tonumber(g) or 255, tonumber(b) or 255)
            end

            global void CSayColor(int r, int g, int b)
                assert(r>=0 and r<=255 and g>=0 and g<=255 and b>=0 and b<=255,'CWriteLine color setting invalid!')
                Bubble_Console_Console:SetCSayColor(r,g,b)
            end

            global void CSay(string msg)
                Bubble_Console_Console:CSay(msg)
            end

            global void GoConsole()
                Bubble_Console_Console:GoConsole()
            end

            // It's USELESS to use this in your script, as this will either be ignored or lead to conflicts
            // The Console Command manager needs this!
            global void ConsoleSuccess(bool succ)
                   Bubble_Console_Console.CommandSuccess = succ
            end


            ", "Console initizer");
        }
        public static void Init(string vm)
        {
            var api = new KthBlockAPI();
            var s   = SBubble.State(vm).state;

            s["KTHURA_BLOCK"] = api;
            //*
            SBubble.DoNIL(vm, @"

                global void ShowBlockMap(map,string Layer,int x, int y)
                    switch type(map)
                        case 'int'
                            KTHURA_BLOCK:ComeToMe(map,Layer,x,y)
                        case 'table'
                            KTHURA_BLOCK:ComeToMe(map.ID,Layer,x,y)
                        default
                            error('Blockmap request faulty!')
                    end
                end

            ", "Console initizer");
        }