Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: farique 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.
-
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
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?
-
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:
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.