Adding tooltips

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
57
Reaction score
22
First Language
Greek
Primarily Uses
RMMV
So i'm trying to add tooltips for some stuff in my game. Basically, when you open the menu you can see the states of the character, positive or negative. So i want to add tooltips to those states.

First of all i know Olivia has already created a plugin about tooltips on states but a) it does this for the battle scene and b) it costs about $10. Now, if it did what i wanted it to, i would happily pay for it, but it doesn't, so i decided to look at the problem myself.

Now, realistically i could add a tooltip by setting a property in the <div> where the icon is located, and then setting up a script that property will be governed by. So i opened up the console while my game was open and i used jQuery to find the screen of the game, which, by the way, is found by $(#GameCanvas) for anyone interested (sorry if that was common knowledge, i only found this out just now). Anyway, i thought that, probably, the state icons could be in some <div> in there, so i could simply add a tooltip property and then control it via a function. What i found is that things aren't that simple.

I couldn't even add a property as .prop and .attr result in errors (there's no such function) and setProperty(name,value) from __proto__ doesn't seem to *add* but change properties' values. However, even if i could add a property, i have no idea where it should be since the states' icons aren't in there.

My thoughts were that, since i draw the icons, i know their x,y values, so i could, perhaps, create new properties with tooltips inside the div containing #GameCanvas, with those x, y values, and then check whether the mouse is hovering or not through scripts. This could work in theory, but i have no idea if it would *actually* work.

So my main question to you guys is whether i'm looking at it from the right direction, or whether i'm in the complete opposite one. My secondary questions (if the answer to the main one is 'yes'), are i) how do i add a property? ii) has anyone else thought about this and come to some conclusion, willing to share?

Obviously, doing this without having to change anything in the html is much much better, since i don't want to risk messing everything up. But if it's script alone, i have no idea how to do it.

Note that i'm still a newbie when it comes to js, so i might have made some mistakes in my train of thoughts up there.
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
394
Reaction score
212
First Language
English
Primarily Uses
RMMV
As far as I'm aware html is only used to actually create the space within the game window that the game is drawn (GameCanvas, GameVideo, UpperCanvas and the ErrorPrinter), along with bringing in js and other things (css maybe, not sure). I'm not saying that your train of thought is wrong, because admittedly I'm about as good with html as I am at juggling fire, but I don't think it's the conventional means of doing things.

What you'll probably be looking to do is create a plugin that alters the scene to add a window (or the window to add a sprite) that you can toggle the position and visibility of based on where the player's mouse is.
 
  • Like
Reactions: MiD

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

Latest Posts

Latest Profile Posts

Anyone have advice for recruiting friends to bugtest with you? I had some buddies volunteer without me asking, and we agreed on dates and times... and they all just flaked...
A mousefolk sprite I made, I think I did good.
Discovering math. functions for damage formulas was one of the greatest things for me.
It's very useful for balancing skills to work in a variety of possible circumstances.
For example if you have a skill that is supposed to work for both mages and warriors:
Code:
Math.max(a.atk * 2 - b.def, a.mat * 2 - b.mdf)
SpaceX: First-ever successful (manned) commercial spaceflight!! In these terrible and self-sabotaging times for the world, that's a ray of excitement and hope I needed badly.

Forum statistics

Threads
98,019
Messages
948,579
Members
129,276
Latest member
abhikhurana
Top