How do I get my game to data-mine the players name?

How do I get my game to data-mine the players name set on their computer and then name the first actor their name. (Similar to OneShot.)
like this?

in event:
Scriptcall: (code below)
than text with \v[10] (replace 10 with any variable you want, but change the 10 in the
setValue in the scriptcall as well)

JavaScript:
var os = require("os")
var actor = $gameActors.actor(1).name();
$gameVariables.setValue(10, os.hostname() + " " + actor)

var os = hostname of their system (can be Name_PC)
var actor = actor name (1 = first actor)
game variable (10) st the value of host name + actor)

output in this example (on my screen) = Name_PC ActorName

do you mean something like this?

if this isn't what you want, explain a bit more.
like this?

in event:
Scriptcall: (code below)
than text with \v[10] (replace 10 with any variable you want, but change the 10 in the
setValue in the scriptcall as well)

JavaScript:
var os = require("os")
var actor = $gameActors.actor(1).name();
$gameVariables.setValue(10, os.hostname() + " " + actor)

var os = hostname of their system (can be Name_PC)
var actor = actor name (1 = first actor)
game variable (10) st the value of host name + actor)

output in this example (on my screen) = Name_PC ActorName

do you mean something like this?

if this isn't what you want, explain a bit more.
Thanks for replying however this was not what I meant. I meant the name of the account in the settings of the computer.
Uh, that might be illegal... But, if you really want to do that, the script that @ShadowDragon provided seems to me like it would work for your purposes.
I know that when Dan Salvato did this in "Doki Doki Literature Club", it didn't read the name of the account in the computer, it read the name of the user's folder, which is usually an abbreviated form of the username.

This way is a lot less... uh, legally gray and inherently suspicious, and is what I suspect the creator of OneShot did as well.

Unfortunately, it didn't quite work for me, as my microsoft account (and therefore my user folder) are based on my email address, which is different from my name. It might not work for everyone, but it's certainly a little less likely to be felt as an invasion of privacy by your players.
I apologize if this came of as malicious, my intent is to have the "The game knows your name" thing. (Similar to games like OneShot, DDLC, ImScared, etc.) For me, the script that ShadowDragon found sets the name to LAPTOP and then some numbers that I don't know if are dangerous to share. This might be a second username set in the computer because other files from other programs on steam have the same username down to the same digits. I just hope this didn't come off as me trying to cause trouble. 🙂
I apologize if this came of as malicious, my intent is to have the "The game knows your name" thing. (Similar to games like OneShot, DDLC, ImScared, etc.) For me, the script that ShadowDragon found sets the name to LAPTOP and then some numbers that I don't know if are dangerous to share. This might be a second username set in the computer because other files from other programs on steam have the same username down to the same digits. I just hope this didn't come off as me trying to cause trouble. 🙂
No, not at all! I was just confused as to why you'd want to do that. I honestly don't know much JS, so I can't help you there, but you could ask the script maker and I bet he'd be more than happy to tweak it for you.
account is only visible to the play itself, but if its a different and from a site part,
a plugin must be made, and that wont be easy, especially if the player probably need
an account on the site you want to get the data from, so most players would be unable
to play the game.

you can tell in more details what you exacly want for a better and straight answer.
Can I suggest just...not doing that? People like their privacy, and if I saw a game that was like "HI AESICA HOW ARE YOU TODAY?" without me every having input my name, I'd 1) feel kind of creeped out and 2) would probably uninstall/refund/leave a bad review outlining this behavior.

Why? Because if it's digging up that information on me, what else is it mining behind the scenes without informing me?
account is only visible to the play itself, but if its a different and from a site part,
a plugin must be made, and that wont be easy, especially if the player probably need
an account on the site you want to get the data from, so most players would be unable
to play the game.

you can tell in more details what you exacly want for a better and straight answer.
Once again, I keep using OneShot as an example but this is what im thinking of.

If this is nearly impossible to do then I can always try to find a creative way around it.
if you want the hostname PC and than that name ingame, use the one I provide above?

than use:

var os = require("os")
$gameVariables.setValue(10, os.hostname() );

than use \v[10] ingame to show their name, but if you want a pop up first BEFORE
they start the game, than I dont know how to do that, but it wont be easy either.
Code:
const { username } = require('os').userInfo();
Code:
const { username } = require('os').userInfo();

Could you elaborate? I don't know how to set a variable to this.
I've also tried
var os = require("os").userInfo().username
$gameVariables.setValue(10, os.userInfo().username() );
and it's not a recognized command.

I don't have any knowledge of JavaScript.
username is the new variable holding the username
Based on previous answers, you can use Control Variables > Set > Script:
JavaScript:
require('os').userInfo().username
Then, like @ShadowDragon mentioned, you can display it in a Show Text command using the \v[x] escape sequence:
Code:
◆Control Variables:#0001 = require('os').userInfo().username
◆Text:Monster(5), Window, Bottom
:    :Welcome, \v[1].
This'll only work in a local deployment since web-deployed games are sandboxed for security reasons and therefore have no direct access to things like this. I would also echo others' concerns about privacy, maybe put a notice on the game download page if/when it gets released.

Technical documentation for the os module can be found here:
Based on previous answers, you can use Control Variables > Set > Script:
JavaScript:
require('os').userInfo().username
Then, like @ShadowDragon mentioned, you can display it in a Show Text command using the \v[x] escape sequence:
Code:
◆Control Variables:#0001 = require('os').userInfo().username[/INDENT]
[INDENT]◆Text:Monster(5), Window, Bottom[/INDENT]
[INDENT]:    :Welcome, \v[1].
This'll only work in a local deployment since web-deployed games are sandboxed for security reasons and therefore have no direct access to things like this. I would also echo others' concerns about privacy, maybe put a notice on the game download page if/when it gets released.

Technical documentation for the os module can be found here:
​
Thank you. I figured different platforms would have different permissions/ways to handle this, so it's not surprising.
I do intend to put on a notice about this if/when I release a demo (which, to be fair, is unlikely to happen in 2020 considering the amount of work that is left just for the first area) or a full game.

Thanks for the documentation too.
Nevermind! The script ShadowDragon provided works! its just something weird with my computer <😀 Sorry.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-get-my-game-to-data-mine-the-players-name.121394/