TTF Strange line spacing behavior

  • #10, by sebastianWednesday, 25. May 2016, 12:49 5 years ago
    local int = Interfaces["test"] -- store interface in a variable for quicker access

    if int.InterfaceOffset.y == 1200 then -- query if interface is in closed position
    int:to(1000, { InterfaceOffset = {x = int.InterfaceOffset.x, y = 880}, easeBounceOut) -- slide out with bounce at end
    elseif int.InterfaceOffset.y == 980 then -- query if interface is in open position
    int:to(1000, { InterfaceOffset = {x = int.InterfaceOffset.x, y = 1200}, easeQuintIn) -- slide in with slow start

    Is all i need to move interfaces now?

    Thread Captain

    2346 Posts

  • #11, by afrlmeWednesday, 25. May 2016, 13:02 5 years ago
    haha. Technically you could use less if you write a function. Then all you would need to do is write one line of code inside of an execute a script action to trigger the relevant interface movement. The only issue with my example is that the interface has to be in the exact positions you specify for it to trigger, which might not be so good if you plan on using a mouse enter / leaves type of approach, but it will work fine with mouse wheel, button or a keyboard shortcut.

    If you wanted to use mouse enters / leaves then it would be more ideal to check the current position & do a bit of calculation to get the delay value required to keep the interface sliding in / out at a constant rate. Let's say the interface has already slid out by 50% & then you move the mouse out & then back over it, it would still be using the same delay value you initially set, which would make it slide out a lot slower than it's supposed to slide out. I believe I actually wrote something to calculate the percentages in one of the sliding scripts I previously wrote.

    Luckily for me, I'm not using the mouse enter / leaves method, so I got away with only a few lines of code. wink


    7005 Posts

  • #12, by bananeisafreeWednesday, 25. May 2016, 16:01 5 years ago
    I'm glad that subject created a bit of good vibes smile.
    I was not talking about that script though! But it's a very good info to have, has we would like to integrate something of the sort on our game.
    It would be a subsection of the interface coin tough and I guess we would have to define the two values (open and close) depending on the position of the IC itself.
    For the moment I use the mouse position wich works but is not very pretty but will be enough for the techdemo

    To go back to the sliders script I was talking about. It was the sound sliders in a menu.

    I added a small script with mute switches that save the volume value before setting it to zero. and bringing back to the old value when you flick the switch again. That way the volume slider is always relevant.

    edit : I tryed with another font and the problem persist.

    Forum Fan

    120 Posts

  • #13, by afrlmeWednesday, 25. May 2016, 21:51 5 years ago
    Ah right the volume slider script... grin

    I actually rewrote that too, but I don't think I've added the script or a ved to the wiki for it. I remember creating the page for it & that was about as far as I got. Then again, there's probably a better solution available since I last wrote it (again) as even my last rewrite is well over a year or so old - probably from before we had access to the shorthand Lua script method too.


    7005 Posts

  • #14, by bananeisafreeFriday, 27. May 2016, 13:48 5 years ago
    Quick update on the problem of the fonts.

    I have done a bit of jerking around and this is what I understood :

    The problem appears every time I go from the first line to the second line of the writing box. ether I add a "" or not.
    The trick I found to "cheat" a bit was to have only one line of text in the first line of the box, add a "" and then use break-lines at my heart content.

    Two problems tough.
    First I have to have short first phrase for every dialogue, and it is limitating to say the least.
    Second. Even though it resolve the problem of line spacing afterward, the second dialog will always be lower than the rest; so it's still jerking around...

    edit : Regarding the volume slider script, it works fine with me. And with a bit of tunning I managed to make it efficient enough for what I wanted.

    Forum Fan

    120 Posts