TomYoki Posted June 8, 2017 Report Posted June 8, 2017 (edited) Hello, I've been working on a function on my bot that requires the user to insert different user's steamID64 (through chat message). The problem is I need this to be an integer.I already tried parseInt(), parseFloat() & Math. Functions, but for some reason this changes last 2 numbers of the ID to 20. (I also tried adjusting the base values (parseInt(msg[1], 10)) Any help would be appreciated! Edited June 8, 2017 by TomYoki Quote
Dr. McKay Posted June 8, 2017 Report Posted June 8, 2017 JavaScript does not have integers. It only has double-precision floating-point numbers, which can only safely represent integers up to 2^53 - 1. Consequently, you can't have a SteamID as an integer, only as a string. Quote
TomYoki Posted June 8, 2017 Author Report Posted June 8, 2017 Huh, so what you're saying is there in no possible way to extract steamID as a number out of a chat message? Quote
Dr. McKay Posted June 8, 2017 Report Posted June 8, 2017 There is no way to represent a SteamID as a number in JavaScript, period. If you want to validate an individual SteamID from input, you can use regex: str.match(/^76561\d{12}$/) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.