Like bgillisp said, might be flagged by anti-virus programs (your mileage may vary etc. etc.), but Node.js/nwjs is designed to be able to interact with your operating system. I tried it and it worked fine for me in a test play of a game (I did not try in a deployed version).
However, the only way you'll know is if you try it yourself.
How to get the host name:
Inside an event, use a Script Call with the following:
Code:
var os = require('os');
$gameActors.actor(X).setName(os.hostname());
Where X is the ID# of the actor.
The host name is the name of the computer, but not the name of the user. To get the name of the user it is more complicated. Try it on a test project first.
How to get the user name (Windows instructions. May be slightly different for Mac/Linux):
1. Install Node.js on your computer. RPG Maker MV already uses 'nwjs' which is a framework that combines Node.js and Chromium to be able to run HTML/CSS/JS through an application window. A feature of this is that it also allows interaction with the OS (operating system).
https://nodejs.org/en/download/
Why download Node.js if it's already incorporated into the 'nwjs' in RPG Maker MV? The version of Node.js in RPG Maker MV is old and doesn't have access to the functions needed here. Technically, it is not required to download Node.js for this step, what you really need is the 'npm' package manager. But npm comes installed already with the Node.js download so it's easiest to download together. If you want to just download npm you can do that too.
Take note of where these files are downloaded to in case you need to move it later.
2. Open the Command Prompt on your computer (on windows it is 'cmd' from the start menu)
3. Type into the Command Prompt and press enter:
Code:
cd [path to your project's js folder]
The path is the entire path to your project's js folder. For example mine looks like this:
cd C:/Users/me/Documents/RPGMakerMV/Games/TestProject/js
Make sure that the text in front of your command now reflects the full path to the js folder.
4. Type into the Command Prompt and press enter:
npm install --save user-info
(source:
https://github.com/sindresorhus/user-info)
5. Check your files. If this is all done right, your project's js folder should contain 3 sub-folders: libs, plugins, and node_modules (NEW)
Inside the node_modules folder should be a folder called "user-info" which contains some files.
6. Inside an event, use a Script Call with the following:
Code:
var userInfo = require('./js/node_modules/user-info/index.js');
$gameActors.actor(X).setName(userInfo().username);
Where X is the ID# of the actor.