Author Topic: first_line_hint working differently on 2.4.x  (Read 98 times)

farique

  • Jr. Member
  • **
  • Posts: 20
    • View Profile
first_line_hint working differently on 2.4.x
« on: September 04, 2018, 11:54:04 AM »
Hi, guys.

Is it just me or does first_line_hint stopped working on [Overview] texts on Attract Mode 2.4.x?

The same script works on scrolling the text up and down on 2.3 but not on 2.4.

Thanks.
« Last Edit: September 11, 2018, 12:44:39 PM by farique »

farique

  • Jr. Member
  • **
  • Posts: 20
    • View Profile
Re: first_line_hint not working on 2.4.x ?
« Reply #1 on: September 11, 2018, 10:41:31 AM »
Ok, narrowed it down to .charsize

If I set a .charsize to the [Overview] text box ( _overview.charsize = 20 for instance ), first_line_hint stops working. Every time I dynamically change it, it goes to 0.
If I don't set a character size the font becomes huge but first_line_hint works.

This simple layout demonstrates it. Use W and S to scroll the overview with and without the second line commented.

I'm using Windows 10 64, AM 2.4.1

Code: [Select]
local _overview = fe.add_text( "[Overview]",0,0,300,600)
_overview.charsize = 20

print (_overview.charsize+"\n")

function update_realtime( ttime )
{
local is_PovYposK = fe.get_input_state ("W")
if (is_PovYposK) {
print (_overview.first_line_hint+"\n")
_overview.first_line_hint++
}

local is_PovYnegK = fe.get_input_state ("S")
if (is_PovYnegK) {
print (_overview.first_line_hint+"\n")
_overview.first_line_hint--
}
}
fe.add_ticks_callback( this, "update_realtime" )

Anyone?
« Last Edit: September 12, 2018, 06:22:24 AM by farique »

farique

  • Jr. Member
  • **
  • Posts: 20
    • View Profile
Re: first_line_hint not working on 2.4.x
« Reply #2 on: September 11, 2018, 12:21:26 PM »
AND, to wrap up the monologue (and for future reference):

Got it working by using a variable instead of altering first_line_hint directly.
Like this:

Code: [Select]
local _overview = fe.add_text( "[Overview]",0,0,600,1000)
_overview.charsize = 40

local line = 0

print (line+" "+_overview.first_line_hint+"\n")

function update_realtime( ttime )
{
local is_PovYposK = fe.get_input_state ("W")
if (is_PovYposK) {
line += 1
_overview.first_line_hint = line
print (line+" "+_overview.first_line_hint+"\n")
}

local is_PovYnegK = fe.get_input_state ("S")
if (is_PovYnegK) {
line += -1
_overview.first_line_hint = line
print (line+" "+_overview.first_line_hint+"\n")
}
}
fe.add_ticks_callback( this, "update_realtime" )

There is still the problem of aligning the line variable with the first_line_hint position (you can see what a mean on the console output) but I can live with it for now.
« Last Edit: September 11, 2018, 12:29:22 PM by farique »