RMMV Cool JS function for hacker games or games that get meta

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
71
Reaction score
39
First Language
English
Primarily Uses
RMMV
I haven't had a ton of time to make stuff in RPGMaker lately, but I still wanted to get better at code for when school is done and I have a little more time, so I've been taking these 5 minute JS coding lessons off an app recently. Anyhow, today I ran into this cool function that I hadn't seen before, and I though most other people probably wouldn't have seen it either, but it could be really cool.

The function is
console.log("your string goes here")

What it does is prints the string to your debug console (which you can see in-game by pressing F12 or Ctrl+Shift+I or clicking "Inspect" off the right-click button, where it pops open another window for you to see your console).

There's probably a whole host of other methods you could use with config to do interesting things with, but this is the one the lesson was about, so it's all I've run into

Anyhow, I thought this cool be really cool for a game that involved hacking or that wanted to get really meta or something, with the game giving "secret" instructions or messages to the player as they play through various parts of the game. The game I'm working on doesn't really make use of that, so I thought I'd share here so somebody else could use it.

I did a quick sort of mockup of what a game that uses this could maybe look like.
1618212080212.png
1618212174498.png
Of course, I have found that the console won't show the results of console.log() unless the F12 screen was open before the script was run, so that could cause some potential challenges.

I just thought this was potentially a cool idea. Thank you for coming to my BREDtalk.
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
550
Reaction score
530
First Language
german
Primarily Uses
RMMZ
Cool idea! Reminds me of the Literature Club where you open the Game's directory to delete characters from the disk and then they are wiped from the story line.

In the Dev Tools, you have a Tab called "Source" that lets you inspect the Source Code, including Core Scripts and Plugins. So you can leave secret Messages in your Plugin. What you can also do, as an extended step, is bringing the Player to put Break Points somewhere, this halts your game and lets the Player inspect all the Variables (not only RPG Maker Variables, I mean ALL Variables). Just giving you some inspiration, prompting the Player with all this information could be too much though.
 

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
71
Reaction score
39
First Language
English
Primarily Uses
RMMV
print() and console.log() are different functions, although they do serve similar purposes.

I just checked it just now to be sure, and although console.log() will appear in the console, using print() actually tries to print a screenshot as a .pdf, despite the fact that I entered a string as an argument.
1618265229505.png

1618265197128.png
1618265709238.png
 

Mike-Turtle

Veteran
Veteran
Joined
Apr 17, 2021
Messages
32
Reaction score
57
First Language
English
Primarily Uses
RMMV
Just so you know: you can also write code straight into the log and it will show in the game. Type - $gameParty.gainGold(100); - for example, and see what happens. There is a spreadsheet with a lot of script calls you can use:
 

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
71
Reaction score
39
First Language
English
Primarily Uses
RMMV
Ah yes, this spreadsheet is fantastic! Everybody should have a copy of it saved somewhere for reference, it's helped me out so often! I also recommend they also use the documentation at https://kinoar.github.io/rmmv-doc-web/index.html, which really complements that spreadsheet nicely to give the best possible overview of how to make use of MV.
Just so you know: you can also write code straight into the log and it will show in the game. Type - $gameParty.gainGold(100); - for example, and see what happens. There is a spreadsheet with a lot of script calls you can use:
 

Latest Threads

Latest Profile Posts

Took a small break by playing VR. Latest update of these glasses unfortunately caused a little of trouble but it can be fixed with a manual operation.

Until You Fall is freaking awesome.
I am SO HYPED to share this trailer with everyone when its done. I almost want to tear up i had no idea how far i came along with Fallen Feather in these last 3 years.
how it looks from the top
Hike was successful guys! I made it to the top!
Add Film-like Visual Effects During Test-Play, Deploy Games with Electron | RPG Maker News #69

Forum statistics

Threads
112,187
Messages
1,066,455
Members
145,787
Latest member
LaVeyan
Top