Merlandese's Forum Posts

  • No worries! It all worked and I got good practice. The opacity trick is a good one, thanks!

  • EDIT:

    I figured it out! I'll write what the problem was and leave the previous post below here for posterity.

    My system used a lot of invisible text objects at first, then pulled data from those. This works out for a lot of things, but for some strange reason if an object has an invisible property it hides the TextHeight from the engine. So even if you have 30 lines of 12 point text in there, if you try to draw out the TextHeight you'll end up with a funky value based on the object's Line Height.

    Not sure if this is an actual feature of the engine or not, but if anyone has trouble finding TextHeight, try making the object visible!

    (Another problem is that if the object is off-screen it might not work. This is creating more problems for me than I had hoped...)

    Thanks for all the help, you guys.

    -------PREVIOUS POST--------

    Turn the negative into a positive with the expression abs, abs(x) Absolute value of x e.g. abs(-5) = 5, might work

    Thanks for the suggestion.

    The absolute value would be a good way to craft the final equation, but the issue isn't what number is being pulled out so much as that it doesn't correlate to the amount of text shown within the object. If I have nothing written in the text object, or if I have 500 characters, I still retrieve the same value when I call TextHeight. A static value won't help me dynamically alter the size of the box.

    This is extremely weird because as I keep trying to troubleshoot the problem it looks like I'm having it only within my own project. When I try to retrieve the TextHeight value in the example Korbaach gave, the return is exactly what I'd expect. Yet in my own project, the return is definitely based on the Line Height of the object rather than the content within the rectangle.

    Searching around the forum hasn't lead me to any answers so far. If anyone recalls a thread dealing with this issue I'd love to check it out.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Awesome, thanks a lot for this!

    I was avoiding using any height methods at first because I wasn't sure what font sizes I'd need, and I didn't want a system that would need some re-coding every time I altered my formats. But it's the next best thing.

    I'm having an issue, though. I've troubleshooted it as best I could with a friend for the last few hours and it seems to me that when I ask for the value TextHeight I get a negative version of the "Line Height" property of the Text Object.

    For example, if I have Variable=Text.TextHeight, no matter how much text is in the Text object, I'll get Variable=(-1 * "Line Height of Text"). If my Line Height for the Text Object is manually set to 12, TextHeight will return the number -12. If my Line Height is 4, I'll get -4. So there's a correlation between TextHeight and the Line Height property that is baffling me.

    It's possible I'm misunderstanding something key in the example you made for me. Any idea what I'm doing wrong?

  • Hello!

    I'm trying to detect line breaks in my text objects so I can dynamically alter dialogue box images.

    I looked here and got a great answer using RegexMatchCount on Newlines in the text object:

    How Do I Detect Line Breaks?

    However, I'm using Rex's CSV plugin to load a lot of dialogues from CSV files. I have everything working except that when the dialogue loads and wordwraps into the text object, the wrapping doesn't seem to create any sort of Newline indicator for the Regex to detect.

    Is there a way to count these automatic line breaks from the word wrap when the dialogue is drawn from a CSV file?

    Thanks!

  • Oh, excellent! I got stuck trying to approach the solution from the wrong angle. Factors! Psha! XD

    Thanks a lot, linkman! This certainly does the trick.

  • Is there a simple way to break apart a number into its factors? And possibly isolate them?

    For example, if I input the number 12, it'd output 1, 2, 3, 4, 6, or 12.

    What I'm trying to do is detect when a number is, say, divisible by 3. So I could crack the number into its factors and if the second or third factor is a 3 I'm golden. If there were a math expression like "factor(x, y)" where x = the number to deconstruct and y = the factor to pull out I'd be luckier than a box of breakfast cereal, but I couldn't find anything like it in the System Expressions section.

    Thanks in advance!

    (I dug through the manual and did some searches through the "How Do I...?" section and I couldn't find a solution, probably because of how often the word "factor" is used outside of math.)