private static bool RepNum(Interpreter interpreter, Source source, Stringe tagname, Argument[] args) { if (interpreter.CurrentRepeater == null) { throw new RantException(source, tagname, "No active repeaters."); } interpreter.Print(interpreter.FormatNumber(interpreter.CurrentRepeater.Index + 1)); return(false); }
private static bool Number(Interpreter interpreter, Source source, Stringe tagName, Argument[] args) { int a, b; if (!Int32.TryParse(args[0].GetString(), out a) || !Int32.TryParse(args[1].GetString(), out b)) { throw new RantException(source, tagName, "Range values could not be parsed. They must be numbers."); } interpreter.Print(interpreter.FormatNumber(interpreter.RNG.Next(a, b + 1))); return(false); }