What I want to do:
When cursor hovers on specific word in text object you get special variable of the text, and then you can create tooltip.
The possible solution that I have in my head, but will need to have change rich(bitmap maybe…) text code:
Add hover variable expression to this type of line: [text]{tooltip.info}
So, when we hover on “text” we can have tooltip expression string of hovered text.
Sorry for bad explaination, but I’m not quite good with terms and etc.
How large of a text are you talking about? A sentence, a paragraph or a full page?
I’m not aware of any events. I might be wrong. More details would help narrow down possible workarounds like using an object for each word or using the x, y to calculate the position.
I don’t know enough about your project. If it’s the same text and you can guarantee that the text will always display the exactly the same on every device then you could place objects at certain places, hide them and when touched they could add another text object as a popup. They would be like hit boxes. I just don’t know enough to guarantee consistent word wrap. I guess if it’s the same font or maybe a bitmap font, it would be exactly the same on any device as long as the bitmap text object was the same size.
Say the purple boxes were named hitbox and they had an object variable named text.
Cursor or touch is on hitbox
Left mouse button is pressed
Trigger once
Action:
Add text object at hitbox.X() , hitboxY() - 20
You would need to make sure only 1 popup could be added at a time.
The text and hit boxes could be create in the scene or as external layouts or as variables either in the app or a json file.
You could then delete the popup object either after a set time or when the mouse button was released or when the cursor was no longer over it if you don’t want to use a mouse click.
Honesty, that’s all I got. As mentioned earlier. You could calculate the position based on the cursor. I don’t know how that would be done.
Well, I had a go and failed. I tried to read the text where the mouse cursor was but it only was accurate in a couple of places. The orange box is where I click and then if the purple text displays the wrong thing I jiggled the cursor over the part it did read. There didn’t seem to be a consistent pattern with the read errors.
If it had worked well, then it could have been the starting point for raiguri’s interesting problem.
For example, I have a special document that describes creature, in this document player can find some special terms that are used practically in every document, so player can hover on that term and he will get a tooltip that will explain meaning of the term.
In nutshell it can be useful not only for often used terms, but also other extra text that player can read if he want to know more about specified thing, etc.