Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
534
Reaction score
1,355
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
4,523
Reaction score
2,883
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
534
Reaction score
1,355
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
4,523
Reaction score
2,883
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
534
Reaction score
1,355
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
4,523
Reaction score
2,883
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 Profile Posts

Not an RPG Maker Update but I'm happy to say that I finally passed my drivers written test. Which makes me a happy guy.
FWRu-cYXkAAAUbl
Have you ever been in such a luck streak you felt fear something was wrong?
I'm going to be adding in combat animations, revamping the UI and putting in a new cutscene this week, so this is your last chance to play the MC:RIS demo in its original form! Say you were there since the beginning! https://qos.itch.io/infinite-sadness
I added reflections and shadows. Though one of the party seems to have no reflection, is floating, with glowing eyes. I'm sure it's fine.
p7O1sjG.png
Well. *That* was an entertaining fustercluck — and that’s not meant nearly as sarcastically as it sounds. I just had to make four different versions of the same conversation:
1: Attained MacGuffin.
2: Have not attained MacGuffin, but know its location.
3: Do not know MacGuffin’s location, but have a good idea where to find it.
4: Do not know where to look for MacGuffin.
Yep, feels good to be back. ^.^

Forum statistics

Threads
123,118
Messages
1,154,096
Members
161,445
Latest member
caihong201814
Top