Icon Captions

BlueMage

Slime Lv99
Veteran
Joined
Apr 13, 2019
Messages
116
Reaction score
149
First Language
English
Primarily Uses
RMVX
This is one of my most favorite plugin!
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
713
Reaction score
564
First Language
French
Primarily Uses
Alright, this is probably the final update, unless bugs are reported:
I've added the ability to set individual conditions for each icon caption.
These must be set inside the plugin using the following template:
Code:
313: "Gold \nMultiple lines",
cond313: "$gameParty.gold() > 0",
//template: iconId: "Text",
//you can use all text codes, but have to make them with two \ instead of one. \\c[1] for example
//cond[iconId] : "Text",
//The text must be a valid javascript statement. If it evals to true the caption will show.
//In the given example, the gold caption will only show if party gold is > 0.
I've also added the possiblity to modify the caption in game and the individual condition too using these commands, from a script call:
Code:
You can add or modifiy a caption in game with:
IconCaptions.setCaption(iconNumber,text)

You can modifiy a caption condition in game with:
IconCaptions.setCond(iconNumber,text)
The text must be a valid javascript statement, which will be evaled when hovering
the caption. If it evals to true, the caption will show.
I will not be providing support for writing your own javascript code, sorry!
You can find a ton of examples in the "javascript equivalent of event commands" thread pinned in the MV subforum, or ask in the forums if you need something specific though.

Have a nice day everyone, and thanks for the nice words!
 

BlueMage

Slime Lv99
Veteran
Joined
Apr 13, 2019
Messages
116
Reaction score
149
First Language
English
Primarily Uses
RMVX
Awesome! What better than a caption? It's a caption with showing condition!
 

Iqus

inVictor
Member
Joined
Oct 17, 2013
Messages
28
Reaction score
11
First Language
Spanish
Primarily Uses
RMMV
Salut!

Excellent plugin! And great addition, now with conditions! One question though, are conditions compulsory? I was using your previous version and I downloaded the new one, copy-pasting all the icon captions and now they do not appear. I don't know if it's a compatibility issue arisen with the newer version or the fact that they do not have a condition specified.

Also, I am using a custom Battle UI and I noticed through the code that a refresh option is added to the default windows. The captions are not working in my custom windows so maybe I need to alias the refresh function for each of my custom windows?

Merci d'avance!
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
713
Reaction score
564
First Language
French
Primarily Uses
Conditions aren't compulsory.
They shouldn't affect existing captions at all unless you've set them.
Do any caption show up at all?
Does an error show up in the console? You may have omitted a bracket or something while copy pasting which would cause the plugin to break.
Captions show up just fine in my version of the plugin, both with and without conditions. Are you sure the formatting of your icon captions hasn't been modified during the copy pasting process?
If you think the formatting is right, please show me the caption list. Via PM is fine if you'd rather not show it publicly.

Do any of you people using the plugin also have this problem with captions no longer showing after the last update?

And yes, you need to reset icon captions when your windows are modified, otherwise you'll get the errors mentioned in the beginning of the thread: captions showing even after switching windows or not updating. I did it for all base windows that needed it, but if you have custom windows you'll have to do it yourself.
Sprites using the state icon sprite template will also update automatically, no further modification needed.
 

Hisao Shou

Veteran
Veteran
Joined
Jan 8, 2015
Messages
145
Reaction score
21
Primarily Uses
Hello @Astfgl66 , I'm using your plugin and it is doing a great job so far! Thank you for making it.
Yet recently I have tried to add some icons in a custom hud with Orange's Hud Line plugin, and they don't have captions when I hover the icons from the custom hud.
I have tried to look into both scripts but I couldn't figure out what was the cause.
Is there any way to make the captions also be displayed for custom huds?
 

EseQueL

Veteran
Veteran
Joined
Oct 10, 2016
Messages
68
Reaction score
25
First Language
English
Primarily Uses
Finally a tooltip plugin. Anyone tried if it works on mobile? I bet not cuz in mobile you must long press not hover. If so, can you make it work on mobile via long press instead?
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
713
Reaction score
564
First Language
French
Primarily Uses
I have not tried it on mobile and have no easy way to.
It should work if the touch screen sets the mouse position correctly though.

The issue with the hud plugin is most likely that every window must be added for the plugin to work. I have no time right now to look into it, sorry.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
@Astfgl66 I just tried using your plugin, I've made sure to create a switch and set the plugin option to that switch. For now, I'm just trying to get it to work at all, as in nothing is edited, I'm just want to get the "gold" icon to show as you have in the screenshots. But when I hover over the gold icon...nothing. Please help? I've even created a new project just to see if it was something interfering w/ this plugin, but still nothing. :/

Edit: Lol I'm a derp, I didn't realize I had to put something in the default text setting for anything to show, I thought it would just show the tooltip for gold exactly like you had it in the screenshot.
 
Last edited:

Pootscooter

Veteran
Veteran
Joined
Jun 7, 2020
Messages
41
Reaction score
10
First Language
Mandarin
Primarily Uses
RMMV
Is there a way to change the font size of the tooltip?
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
713
Reaction score
564
First Language
French
Primarily Uses
You can use all available message codes but must use "\\" instead of "\".
I can't from the top of my head remember if such a text code is standard, but if it is you can use it.
 
Last edited:

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
474
Reaction score
206
First Language
English
Primarily Uses
RMMV
There is a default text code for that - \{bigger text\} or \}smaller text\{ (the trailing \{ or \} only matters if there's more text after that). When writing it in the plugin file you also need to double the \\.
 

Pootscooter

Veteran
Veteran
Joined
Jun 7, 2020
Messages
41
Reaction score
10
First Language
Mandarin
Primarily Uses
RMMV
There is a default text code for that - \{bigger text\} or \}smaller text\{ (the trailing \{ or \} only matters if there's more text after that). When writing it in the plugin file you also need to double the \\.
Ok, I just tried it. While it does make the font smaller, the window is still the same size as if the font size hadn't changed at all, which was my goal in the 1st place... Any solutions?

I'd prefer to edit the .js file to make ALL tooltips have a smaller font. (including the line height)
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
713
Reaction score
564
First Language
French
Primarily Uses
Window_IconCaption is an instance of Window_Base. You can alias the initialize method to change lineheight and text formatting if you want to. You'll have to do that on your own however.
 

Pootscooter

Veteran
Veteran
Joined
Jun 7, 2020
Messages
41
Reaction score
10
First Language
Mandarin
Primarily Uses
RMMV
I have no idea where to begin. @.@
Alias? Is that something to do with antialiasing? That's like the only time I've ever heard the word used lol.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,369
Reaction score
1,535
First Language
English
Primarily Uses
RMMV
I have no idea where to begin. @.@
Alias? Is that something to do with antialiasing? That's like the only time I've ever heard the word used lol.
Aliasing a function is storing it in your own variable (a function can be assigned to a variable just like any other value) and then rewriting it. You only need to alias if you intend to use the original form of it.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
Window_IconCaption is an instance of Window_Base. You can alias the initialize method to change lineheight and text formatting if you want to. You'll have to do that on your own however.
I'd also like to make the font size smaller. Could I just add Window_IconCaption.lineHeight() -= 8; or Window_IconCaption.lineHeight() = 28; somewhere? If so, where would I place it? I'd do the alias thing you mentioned, but I'm a total noob at JS. From what I can tell, you're referring to this:
JavaScript:
    Window_IconCaption.prototype.initialize = function(x,y,width,height) {
        Window_Base.prototype.initialize.call(this,x,y,width,height);
        this._index = 0;
        this.isHovered = false;
    }
Aliasing a function is storing it in your own variable (a function can be assigned to a variable just like any other value) and then rewriting it. You only need to alias if you intend to use the original form of it.
In that case, do I just write var thingymahjigger = Window_IconCaption();?

Edit: I also tried changing every instance of win.lineHeight() to (win.lineHeight() - 8) but as you can imagine, it didn't work lol.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,369
Reaction score
1,535
First Language
English
Primarily Uses
RMMV
It'd be
Code:
var thingymahjigger = Window_IconCaption.prototype.initialize;
Then when you wanted to call the original, you'd do
Code:
thingymahjigger.call(this);
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
Wait, I just realized...what's the point of aliasing Window_IconCaption.prototype.initialize if my goal is to set line height and font size to a certain value? Wouldn't creating a var of that function mean I'd have to change every instance where Window_IconCaption is used to the alias/var? If so, y not just change line height and font size in the Window_IconCaption function directly? Or am I missing the point?

Idk if these are even correct:
this.lineHeight() = 28;
this.contents.fontSize = 21;
or maybe this.standardFontSize() = 21;

If they are correct, I have no idea where to put it. Let's say I made the alias function...
var smaller = Window_IconCaption.prototype.initialize;
Now what?

Edit:
I'm probably going about this the wrong way since when I add this.lineHeight() = 28; to Window_IconCaption function I get "Invalid left-hand side in assignment".
JavaScript:
    Window_IconCaption.prototype.initialize = function(x,y,width,height) {
        Window_Base.prototype.initialize.call(this,x,y,width,height);
        this._index = 0;
        this.isHovered = false;
        this.lineHeight() = 28;
    }
Edit2: Ok, I think the correct way to change font size is this...
JavaScript:
Window_Base.prototype.standardFontSize = function() {
    return 21;
};
However, I'm not sure where to place it. If I place it at the top of the plugin, the entire game's font size changes (which makes sense). But if I place it both at the top AND at the bottom of the plugin (but using 27 instead of 21) the game font size is at my game's usual size 27, except the icon captions aren't at 21 as I'd hoped.
 
Last edited:

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
713
Reaction score
564
First Language
French
Primarily Uses
lineHeight is a function of window base, thus is extended to all its instances. This is why there is no defined lineHeight function for the iconCaption window. It's in the parent class window base. Change the lineheight by changing the window icon caption lineHeight function.

You can just add this snippet to the plugin file.
Code:
Window_IconCaption.prototype.lineHeight = function() {
    return 36; //or whatever number you want it to be
};
It's the same thing for font size. Look into window base, find the fontsize function and change it for window iconCaption.

Also look at trihan's post for an explanation as to why you're getting an error message.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

An actual dwarf with an actual axe is not so fascinating as the fantasy counterpart...
I'm so back and forth on pre-ording MZ. I can totally wait for a better deal down the road (since I don't need the extras and waiting to see how YEP plugins turn out) but there's something about the fun in playing with "a new toy".
:rheh:
Who knew a adding menu commands would be so hard for something that should be a basic feature.
When you discover great tileset resources that you completely forgot that you had. :kaomad3::kaopride:
Just got a better look at the MZ RTP. I'm very happy with it, especially the sci-fi tiles and sprites. Glad I pre-ordered.

Forum statistics

Threads
100,603
Messages
977,675
Members
132,209
Latest member
Frostybox
Top