There is a part in my game where I would like to use the name the user gave to the computer. Is that possible?
Computer Name
RPG Maker MV Supportonly if the security settings of the computer are low enough.
MV creates HTML5-Games in a browser structure, and those are usually sandboxed. There are javascript commands that can give local data, but only if they are not blocked by the computers security settings.
MV creates HTML5-Games in a browser structure, and those are usually sandboxed. There are javascript commands that can give local data, but only if they are not blocked by the computers security settings.
Even so, how can I do that? And if it doesn't collect, how can I replace the code with "PLAYER"?
Actually, you can nab the computer name of the user. However, you can only do so while the game is being run as an executable. You will not be able to access the computer name of the user when the game is run within a web browser.
To access the computer name when running the game as an executable, you can use the following in a Script Command (or in a plugin) :
To access the computer name when running the game as an executable, you can use the following in a Script Command (or in a plugin) :
Code:
// Loads the OS module into variable 'os'
var os = require('os');
// The 'os.hostname()' function returns the name of the computer
console.log(os.hostname());
// You could store the name of the computer in a variable, if you want ...
$gameVariables.setValue(1, os.hostname());
// ... so you can retrieve it at a later time
console.log($gameVariables.value(1));
// You can also access the username of the user with the 'os.userInfo()' function
console.log(os.userInfo().username);
I never planned on it being an HTML game. Thanks, and where can I find it so I can use it in a show text? Or do I have to code it?
Edit: I am stupid.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/computer-name.112751/