PC name in textboxx

Hellooo, I'm trying to do the same thing as this thread shown heree:

https://forums.rpgmakerweb.com/index.php?threads/pc-name-in-game.160809/

Buut every time I try to use the code providedd, I get numbers instead of the PC namee:
Screenshot 2024-02-25 192600.png


The other person who asked the question in the thread I provided had this same issuee, though they didn't really explain how to fix it welll (I've tried altering the code to what they altered it to in the end aand this still didn't workk)

Did I set up the variable wrongg? If someone could help me out with this that would be very nicee X'>

1708919614748.png
1708919732811.png
Hello! Change constant to script, and place
Code:
os.hostname();
in the text box.


EDIT: OH, right, i've noticed the entire issue.
In your event page, go to page 3, and choose script, and place this
Code:
var os = require('os');
$gameVariables.setValue(1, os.hostname()); //This saves the PC name, not the account name in variable 1
$gameVariables.setValue(1, os.userInfo().username); //This saves the Account name in variable 1,
Just leave the one you need and replace 1 with your desired variable value!
Hello! Change constant to script, and place
Code:
os.hostname();
in the text box.
If it doesn't work, remove the ; simply
Sooo, I tried thatt (along with removing the ; ), aand it partially workedd, it just changed the number to "Desktop" aand some numbers noww X"DD

1708920567336.png
If it doesn't work, remove the ; simply
Just so you know, that doesn't matter.

@Kevonica_ Did you read the thread you linked to? You're asking the exact same questions and getting the exact same results as the poster there.

The result he (and presumably you wanted) is in the instructions in Post #3, and he specifically posted the code that worked for him in Post #9.
Just so you know, that doesn't matter.
I redid my entire answer because i noticed, thank you!
@Kevonica_ the answer has been edited haha, sorry for the trouble!
@Erif That also isn't really great. You'll end up with the right result, but there's no reason to set variable 1 to two different things.

Just set it to the one thing that you want to use.
Just so you know, that doesn't matter.

@Kevonica_ Did you read the thread you linked to? You're asking the exact same questions and getting the exact same results as the poster there.

The result he (and presumably you wanted) is in the instructions in Post #3, and he specifically posted the code that worked for him in Post #9.
Thing iss, I tried what he did in post #9 aand it didn't seem to work for mee
@ATT_Turan the comments in the code do say to leave the one you want, either the account name, or the pc name haha.
@ATT_Turan the comments in the code do say to leave the one you want, either the account name, or the pc name haha.
Yes, but the OP can't read those same instructions from the third post of the other thread, so it doesn't seem less confusing to put them here 😉

Anyway, good luck with it all.
I redid my entire answer because i noticed, thank you!
@Kevonica_ the answer has been edited haha, sorry for the trouble!
Ahhh! The edited answer workedd, thank youu! X>
Happy to help!

Original thread: https://forums.rpgmakerweb.com/threads/pc-name-in-textboxx.166171/