This is one of my most favorite plugin!
Icon Captions
● ARCHIVED · READ-ONLY
-
-
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! -
Awesome! What better than a caption? It's a caption with showing condition!
-
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! -
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. -
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? -
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?
-
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. -
@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. -
Is there a way to change the font size of the tooltip?
-
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. -
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?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 \\.
I'd prefer to edit the .js file to make ALL tooltips have a smaller font. (including the line height) -
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 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. -
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. -
I'd also like to make the font size smaller. Could I just addWindow_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.
Window_IconCaption.lineHeight() -= 8;orWindow_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; }In that case, do I just writeAliasing 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.var thingymahjigger = Window_IconCaption();?
Edit: I also tried changing every instance ofwin.lineHeight()to(win.lineHeight() - 8)but as you can imagine, it didn't work lol. -
It'd beCode:
var thingymahjigger = Window_IconCaption.prototype.initialize;
Then when you wanted to call the original, you'd doCode:thingymahjigger.call(this); -
Wait, I just realized...what's the point of aliasing
Window_IconCaption.prototype.initializeif 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 maybethis.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 addthis.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: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.Window_Base.prototype.standardFontSize = function() { return 21; }; -
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.