private void parseScript(GenericRoll bet) { try { bool Win = bet.data.status.Equals("WIN"); SetLuaVars(); Lua["win"] = Win; Lua["currentprofit"] = bet.data.profit; Lua["lastBet"] = bet; LuaRuntime.SetLua(Lua); LuaRuntime.Run("dobet()"); GetLuaVars(); } catch { } }
void ConsoleIn(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { SetLuaVars(); LCindex = 0; LastCommands.Add(txtConsoleIn.Text); if (LastCommands.Count > 26) { LastCommands.RemoveAt(0); } txtConsole.Text += (txtConsoleIn.Text) + "\r\n"; if (txtConsoleIn.Text.ToLower() == "start()") { LuaRuntime.SetLua(Lua); try { LuaRuntime.Run(txtScript.Text); Start(); } catch (Exception ex) { txtConsole.Text += ("LUA ERROR!!") + "\r\n"; txtConsole.Text += (ex.Message) + "\r\n"; } } else { try { LuaRuntime.SetLua(Lua); LuaRuntime.Run(txtConsoleIn.Text); } catch (Exception ex) { txtConsole.Text += ("LUA ERROR!!") + "\r\n"; txtConsole.Text += (ex.Message) + "\r\n"; } } txtConsoleIn.Text = ""; GetLuaVars(); } if (e.Key == Key.Up) { if (LCindex < LastCommands.Count) { LCindex++; } if (LastCommands.Count > 0) { txtConsoleIn.Text = LastCommands[LastCommands.Count - LCindex]; } } if (e.Key == Key.Down) { if (LCindex > 0) { LCindex--; } if (LCindex <= 0) { txtConsoleIn.Text = ""; } else if (LastCommands.Count > 0) { txtConsoleIn.Text = LastCommands[LastCommands.Count - LCindex]; } } }