Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
634
Reaction score
1,610
First Language
Norwegian
Primarily Uses
RMMZ
So using Visustella Main Core, I can choose which parameters to display.

Im very satisfied with how it looks in my status screen
STS.PNG
But if I have this many then it looks like this in main menu
MAN.PNG

This code governs how the parameters is shown on the main menu if there is space for it. My goal is for only 6 to be shown.


Code:
// Following Requires VisuStella MZ's Core Engine
// Draw Additional Parameter Data if Enough Room
sx3 = sx2 + 300;
sw = rect.width - sx3 - 2;
if (Imported.VisuMZ_0_CoreEngine && sw >= 300) {
    const params = VisuMZ.CoreEngine.Settings.Param.DisplayedParams;
    const pw = Math.floor(sw / 2) - 24;
    let px = sx3;
    let py = rect.y + Math.floor((rect.height - (Math.ceil(params.length / 2) * gaugeLineHeight)) / 2 - 12);
    let counter = 0;
    for (const param of params) {
        this.resetFontSettings();
        const maxItems = this.maxItems()
          return 6;
        this.drawParamText(px, py, pw, param, false);
        this.resetTextColor();
        this.contents.fontSize = 20;
        const paramValue = actor.paramValueByName(param, true);
        this.contents.drawText(paramValue, px +64, py +2, pw, gaugeLineHeight, 'center');
        counter++;
        if (counter % 2 === 0) {
            px = sx3;
            py += gaugeLineHeight + 4;
        } else {
            px += pw + 24;
        }
    }
}

I added the

const maxItems = this.maxItems()
return 6;

In hopes that it would limit the parameters shown in main menu to a max of 6 but it only removed them all xD Is something similar possible?

I can remove how many of the stats are shown, but then my status screen will be pretty empty. So it feels like I have to choose which screen will look good D:
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,546
Reaction score
5,311
First Language
English
Primarily Uses
RMMV
I added the

const maxItems = this.maxItems()
return 6;
Yeah, that's...pretty random. All you did was declare a variable and set it equal to a value (which doesn't do anything), then tell the function to stop and send back the value 6 (which the engine isn't using for anything, as it doesn't expect a return value from this function).

I'm not sure where you got those things to type for what you want to accomplish O__o
(or why the return is indented, but that's quite incidental).

There are a bunch of JavaScript tutorials available, it doesn't make a lot of sense to just type things if you don't know what they mean :wink: All it does it waste time you could spend doing a lesson or writing a post for help.

There are a few ways you could do what you want, and they're in limiting how many times the loop runs, instead of for the entire length of your params.

The easiest way is to take the line starting with for ( and change it to:
Code:
for (var i=0; i<6; i++) { var param=params[i];

All of the rest of the code should continue to function as it originally did.
 

Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
634
Reaction score
1,610
First Language
Norwegian
Primarily Uses
RMMZ
I have actually been looking at tutorials and stuff but I just can't seem to wrap my head around coding in general. I'm usually a pretty quick study in other areas :p

Might just have to ask for more help while I try to learn some more, although I already feel like I'm spamming tbh :p
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,546
Reaction score
5,311
First Language
English
Primarily Uses
RMMV
I have actually been looking at tutorials and stuff but I just can't seem to wrap my head around coding in general.
I like w3schools, starting with the Statements chapter (the first few have a lot of content specific to Web pages, which isn't what you're using JS for):

Writing code is just giving a list of instructions. All you have to internalize are what the specific words mean.
Code:
const maxItems = this.maxItems()
means make a variable named maxItems and set its value equal to this.maxItems().

So you just handed your friend a piece of paper labeled "maxItems" and it has some number written on it. You're not telling them to do anything with it, you just wrote that down. Clearly that's not helpful in your goal of getting them to list six parameters for you, right?

Code:
return 6;
means stop running this function and send the value 6 back to wherever it got called from.

So immediately after giving them that paper, you tell your friend to stop working and tell their boss "6!"

Again, clearly not helpful when you're trying to give them instructions on how to list six parameters.

So your friend's boss tells them, "Go to work!" expecting them to list parameters on the screen. Instead, they're turning around with a piece of paper shouting, "6!" and the boss is, like, "what the heck does that mean?"
 

Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
634
Reaction score
1,610
First Language
Norwegian
Primarily Uses
RMMZ
I like w3schools, starting with the Statements chapter (the first few have a lot of content specific to Web pages, which isn't what you're using JS for):

That is actually some of the reason why its difficult to learn, feels like I have to get through so much stuff that doesn't feel relevant to what I want to use it for. Bookmarked the page, need some sleep first :p

Writing code is just giving a list of instructions. All you have to internalize are what the specific words mean.
Code:
const maxItems = this.maxItems()
means make a variable named maxItems and set its value equal to this.maxItems().

So you just handed your friend a piece of paper labeled "maxItems" and it has some number written on it. You're not telling them to do anything with it, you just wrote that down. Clearly that's not helpful in your goal of getting them to list six parameters for you, right?

Code:
return 6;
means stop running this function and send the value 6 back to wherever it got called from.

So immediately after giving them that paper, you tell your friend to stop working and tell their boss "6!"

Again, clearly not helpful when you're trying to give them instructions on how to list six parameters.

So your friend's boss tells them, "Go to work!" expecting them to list parameters on the screen. Instead, they're turning around with a piece of paper shouting, "6!" and the boss is, like, "what the heck does that mean?"

ngl, I just assumed const meant it would be a constant value :3

I love your boss example because if someone who knew me read it they would prolly go ''That's actually something he would do'' xD

Confusing people amuses me :p
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,546
Reaction score
5,311
First Language
English
Primarily Uses
RMMV
ngl, I just assumed const meant it would be a constant value :3
That is exactly what it means, but you're not using that value anyplace. You declared the variable then never did anything with it. You wrote "maxItems" on a piece of paper then it just sat there.

There are millions of constant values all around us, but they don't do anything unless we make reference to them in some context.

 

Latest Threads

Latest Posts

Latest Profile Posts

I'm really sorry I haven't done any streams. I actually just got home from the hospital after a week and a half.
I'm not dead - I promise :stickytongue:

Anyway, some pokemon inspired art (dont ask me which one tho xD)
reali.png
Writing boss music for Pale Coins. This is the Goblin Mage's theme!

Caz
I've been trying to upload more video tutorials for RMMZ lately! Does anyone have a topic they'd like to see covered? :ehappy:

Forum statistics

Threads
129,716
Messages
1,204,586
Members
170,790
Latest member
ess_
Top