RubixYT1

My LNGI Textwall Script

Nov 28th, 2025
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.94 KB | None | 0 0
  1. (async () => {
  2. // --- Typing helpers ---
  3. // With 25ms cooldown per char (for status messages)
  4. async function typeStringSlow(str) {
  5. for (let i = 0; i < str.length; i++) {
  6. await w.typeChar(str[i], 1);
  7. await new Promise(r => setTimeout(r, 25));
  8. }
  9. }
  10.  
  11. // No cooldown (for val number output)
  12. async function typeStringFast(str) {
  13. for (let i = 0; i < str.length; i++) {
  14. await w.typeChar(str[i], 1);
  15. }
  16. }
  17.  
  18. // --- MODE & SOURCES ---
  19. let mode = 1; // 1 = Break Infinity (default), 2 = Break Eternity
  20.  
  21. const sources = {
  22. 1: [
  23. "https://unpkg.com/[email protected]/dist/break_infinity.min.js",
  24. "https://cdn.jsdelivr.net/npm/break_infinity.js/dist/break_infinity.min.js",
  25. "https://unpkg.com/[email protected]/dist/break_infinity.min.js"
  26. ],
  27. 2: [
  28. "https://unpkg.com/[email protected]/dist/break_eternity.min.js",
  29. "https://cdn.jsdelivr.net/npm/break_eternity.js/dist/break_eternity.min.js"
  30. ]
  31. };
  32.  
  33. // Fallback Decimal
  34. function createFallbackDecimal() {
  35. class FallbackDecimal {
  36. constructor(value) {
  37. if (value instanceof FallbackDecimal) {
  38. this.value = value.value;
  39. } else {
  40. const n = Number(value);
  41. if (!Number.isFinite(n)) throw new Error("Invalid Decimal value");
  42. this.value = n;
  43. }
  44. }
  45. times(other) {
  46. const o = other instanceof FallbackDecimal ? other.value : Number(other);
  47. return new FallbackDecimal(this.value * o);
  48. }
  49. lte(other) {
  50. const o = other instanceof FallbackDecimal ? other.value : Number(other);
  51. return this.value <= o;
  52. }
  53. lt(other) {
  54. const o = other instanceof FallbackDecimal ? other.value : Number(other);
  55. return this.value < o;
  56. }
  57. toString() {
  58. return String(this.value);
  59. }
  60. get e() {
  61. if (this.value === 0) return 0;
  62. return Math.floor(Math.log10(Math.abs(this.value)));
  63. }
  64. get mantissa() {
  65. if (this.value === 0) return 0;
  66. return this.value / Math.pow(10, this.e);
  67. }
  68. }
  69. return FallbackDecimal;
  70. }
  71.  
  72. // flag used to pause the main loop while status messages print
  73. let statusBusy = false;
  74.  
  75. async function printStatus(msg, x, y, width = 80) {
  76. statusBusy = true;
  77. await w.tp(x, y);
  78. await typeStringSlow(" ".repeat(width));
  79. await w.tp(x, y);
  80. await typeStringSlow(msg);
  81. statusBusy = false;
  82. }
  83.  
  84. async function ensureDecimalForMode(currentMode) {
  85. const statusX = -99;
  86. const statusY = 3;
  87.  
  88. if (typeof Decimal !== "undefined") return true;
  89.  
  90. const list = sources[currentMode] || [];
  91. for (let i = 0; i < list.length; i++) {
  92. const src = list[i];
  93.  
  94. await printStatus(`Loading: ${src}`, statusX, statusY);
  95.  
  96. try {
  97. await new Promise((resolve, reject) => {
  98. const s = document.createElement("script");
  99. s.src = src;
  100. s.async = true;
  101. s.onload = () => resolve();
  102. s.onerror = () => reject(new Error("Failed: " + src));
  103. document.head.appendChild(s);
  104. });
  105.  
  106. if (typeof Decimal !== "undefined") {
  107. w.chat.send(`Loaded from: ${src}`);
  108. return true;
  109. } else {
  110. console.warn("Script loaded but Decimal is undefined for", src);
  111. await printStatus("Link load failure, trying next one", statusX, statusY);
  112. }
  113. } catch (e) {
  114. console.warn(e);
  115. await printStatus("Link load failure, trying next one", statusX, statusY);
  116. }
  117. }
  118.  
  119. if (typeof Decimal === "undefined") {
  120. await printStatus("All links failure, using fallback.", statusX, statusY);
  121. console.warn("All links failed. Using fallback Decimal.");
  122. window.Decimal = createFallbackDecimal();
  123. return true;
  124. }
  125.  
  126. return false;
  127. }
  128.  
  129. const initialOk = await ensureDecimalForMode(mode);
  130. if (!initialOk) {
  131. w.chat.send("Initial library load failure; using fallback.");
  132. }
  133.  
  134. // --- CONFIG ---
  135. const startX = -99;
  136. const startY = 4;
  137. const endX = -81;
  138. const START_VAL_NUM = 2;
  139.  
  140. // --- STATE ---
  141. let val = new Decimal(START_VAL_NUM);
  142. let multiplier = new Decimal(1.2); // effective multiplier used by loop
  143. let baseMultiplier = new Decimal(1.2); // base multiplier (set via setM)
  144. let exMode = false; // setEX toggle: if ON, multiply by 1.5 each print
  145. let intervalMs = 450;
  146. let lastSendValTime = 0;
  147. let loopStarted = false;
  148. let ended = false;
  149.  
  150. const sleep = ms => new Promise(r => setTimeout(r, ms));
  151.  
  152. function parseFiniteNumber(input, contextName, paramName) {
  153. const n = Number(input);
  154. if (!Number.isFinite(n)) {
  155. console.error(
  156. `${contextName} error: ${paramName} must be a finite number (not Infinity, -Infinity, NaN, or invalid).`
  157. );
  158. return null;
  159. }
  160. return n;
  161. }
  162.  
  163. // Custom formatting (unchanged logic)
  164. function formatVal(d) {
  165. if (d.lte(999999)) return d.toString();
  166.  
  167. const e = d.e;
  168. const threshold1Exp = 999999;
  169. const threshold2ExpApprox = 1e7;
  170.  
  171. if (e <= threshold1Exp) {
  172. const m = d.mantissa;
  173. return `${m.toFixed(2)} * 10^${e}`;
  174. }
  175.  
  176. if (e > threshold1Exp && e <= threshold2ExpApprox) {
  177. const m = d.mantissa;
  178. const eStr = String(e);
  179. const splitIndex = Math.max(1, Math.floor(eStr.length / 2));
  180. const part1 = Number(eStr.slice(0, splitIndex));
  181. const part2 = Number(eStr.slice(splitIndex));
  182. const Y = isNaN(part1) ? e : part1;
  183. const Z = isNaN(part2) ? 0 : part2;
  184. return `${m.toFixed(2)} * 10^${Y.toFixed(2)} * 10^${Z}`;
  185. }
  186.  
  187. let heightEstimate;
  188. try {
  189. const log10 = d.log10 ? d.log10() : new Decimal(Math.log10(Number(d.toString())));
  190. const log10_2 = log10.log10 ? log10.log10() : new Decimal(Math.log10(Number(log10.toString())));
  191. heightEstimate = Number(log10_2.toString());
  192. } catch {
  193. heightEstimate = 10;
  194. }
  195. return `10^^${heightEstimate.toFixed(2)}`;
  196. }
  197.  
  198. async function printVal() {
  199. await w.tp(startX, startY);
  200. const spacesCount = Math.max(0, endX - startX);
  201. await typeStringFast(" ".repeat(spacesCount)); // clear fast
  202.  
  203. await w.tp(startX, startY);
  204. const text = formatVal(val);
  205. await typeStringFast(text); // print val fast (no cooldown)
  206. }
  207.  
  208. async function loop() {
  209. if (loopStarted) return;
  210. loopStarted = true;
  211.  
  212. while (!ended) {
  213. // Wait if a status message is printing
  214. while (statusBusy && !ended) {
  215. await sleep(25);
  216. }
  217. if (ended) break;
  218.  
  219. // main update
  220. val = val.times(multiplier);
  221. await printVal();
  222.  
  223. // multi2 behavior: if exMode is ON, multiply multiplier by 1.5
  224. if (exMode) {
  225. multiplier = multiplier.times(new Decimal(1.5));
  226. }
  227.  
  228. await sleep(intervalMs);
  229. }
  230. }
  231.  
  232. await w.tp(startX, startY);
  233. await printVal();
  234. loop();
  235.  
  236. w.chat.send("Number multiplier script started (mode 1: Break Infinity / fallback).");
  237.  
  238. // --- Console commands ---
  239.  
  240. // restart: reset value only
  241. window.restart = () => {
  242. try {
  243. val = new Decimal(START_VAL_NUM);
  244. console.log("Value restarted to:", val.toString());
  245. } catch (e) {
  246. console.error("restart error: could not set starting value.", e);
  247. }
  248. };
  249.  
  250. // end: stop main loop
  251. window.end = () => {
  252. ended = true;
  253. console.log("Script ended (loop stopped).");
  254. };
  255.  
  256. // setM(number, exponent?)
  257. window.setM = (number, exponent) => {
  258. const n = parseFiniteNumber(number, "setM", "number");
  259. if (n === null) return;
  260.  
  261. try {
  262. let dec = new Decimal(n);
  263.  
  264. if (typeof exponent !== "undefined") {
  265. const eNum = parseFiniteNumber(exponent, "setM", "exponent");
  266. if (eNum === null) return;
  267. const pow = new Decimal(10).pow(new Decimal(eNum)); // avoid JS Infinity
  268. dec = dec.times(pow);
  269. }
  270.  
  271. if (dec.lte(0)) {
  272. console.error("setM error: multiplier must be > 0.");
  273. return;
  274. }
  275.  
  276. baseMultiplier = dec;
  277. multiplier = new Decimal(baseMultiplier); // reset effective to base (multi2 will grow it)
  278. console.log("Base multiplier set to:", baseMultiplier.toString(), "| Effective:", multiplier.toString());
  279. } catch (e) {
  280. console.error("setM error: could not create Decimal.", e);
  281. }
  282. };
  283.  
  284. // setV(number, exponent?)
  285. window.setV = (number, exponent) => {
  286. const n = parseFiniteNumber(number, "setV", "number");
  287. if (n === null) return;
  288.  
  289. try {
  290. let dec = new Decimal(n);
  291.  
  292. if (typeof exponent !== "undefined") {
  293. const eNum = parseFiniteNumber(exponent, "setV", "exponent");
  294. if (eNum === null) return;
  295. const pow = new Decimal(10).pow(new Decimal(eNum)); // avoid JS Infinity
  296. dec = dec.times(pow);
  297. }
  298.  
  299. if (dec.lt(0)) {
  300. console.error("setV error: value must be >= 0.");
  301. return;
  302. }
  303.  
  304. val = dec;
  305. console.log("Value set to:", val.toString());
  306. } catch (e) {
  307. console.error("setV error: could not create Decimal.", e);
  308. }
  309. };
  310.  
  311. // setEX: toggle multi2 behavior
  312. // if true: multiplier multiplied by 1.5 after each val print
  313. // if false: multiplier stays as-is (no extra growth)
  314. window.setEX = on => {
  315. exMode = Boolean(on);
  316. console.log(
  317. `setEX: ${exMode ? "ON (multiplier grows x1.5 each print)" : "OFF (multiplier stays constant)"}`,
  318. "| Current effective multiplier:", multiplier.toString()
  319. );
  320. };
  321.  
  322. // sendval: send current value to chat (450ms cooldown)
  323. window.sendval = () => {
  324. const now = Date.now();
  325. if (now - lastSendValTime < 450) {
  326. console.warn("sendval is on cooldown (450ms).");
  327. return;
  328. }
  329. lastSendValTime = now;
  330. w.chat.send(`Current val: ${formatVal(val)}`);
  331. };
  332.  
  333. // setMode: switch between Break Infinity and Break Eternity
  334. window.setMode = async newMode => {
  335. const n = Number(newMode);
  336. if (n !== 1 && n !== 2) {
  337. console.error("setMode error: mode must be 1 (Break Infinity) or 2 (Break Eternity).");
  338. return;
  339. }
  340.  
  341. const modeName = n === 1 ? "Break Infinity" : "Break Eternity";
  342. w.chat.send(`Switching to ${modeName}...`);
  343.  
  344. try {
  345. delete window.Decimal;
  346. const ok = await ensureDecimalForMode(n);
  347.  
  348. if (ok && typeof Decimal !== "undefined") {
  349. mode = n;
  350. w.chat.send("Switched successfully.");
  351. } else {
  352. w.chat.send("Failure.");
  353. }
  354. } catch (e) {
  355. console.error("setMode error:", e);
  356. w.chat.send("Failure.");
  357. }
  358. };
  359.  
  360. // help: list commands
  361. window.help = () => {
  362. console.log("Available commands:");
  363. console.log(" restart() - set val back to 2 (starting number)");
  364. console.log(" end() - stop the script (no more updates)");
  365. console.log(" setM(n[, e]) - set base multiplier to n * 10^e (if e given) or n");
  366. console.log(" setV(n[, e]) - set val to n * 10^e (if e given) or n");
  367. console.log(" setEX(true/false) - toggle multi2: multiplier *= 1.5 after each print");
  368. console.log(" sendval() - send current val to chat (450ms cooldown)");
  369. console.log(" setMode(1 | 2) - 1: Break Infinity (default), 2: Break Eternity");
  370. console.log(" help() - show this command list");
  371. };
  372. })();
Advertisement
Add Comment
Please, Sign In to add comment