Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: TheFirstAv3nger on February 04, 2017, 06:01:38 AM
-
Hello, I've been reading a bit about the squirrel language and would like to make a script to change the display.
I've read documentation and there is a function called "fe.set_display()"
If anyone could help me on writing a script to do so I'd greatly appreciate it.
-
fe.displays is an array containing a list of your displays, so you can check len() to see how many there are... each of those entries you can use .name to find out the name.
The issue I noticed when trying to use set_display is you will get stuck in a loop reloading the layout unless you check that you are loading a different display than is already loaded - here is two functions that load based on index or display name:
//find out about the displays
print(fe.displays.len() + " displays\n")
foreach(idx, display in fe.displays )
print( idx + ": " + display.name + "\n")
//load based on display index
function load_display(idx) {
if ( fe.list.display_index != idx ) fe.set_display(idx)
}
//load based on display name
function load_display_name(name) {
foreach( idx, display in fe.displays )
if ( name == fe.displays[idx].name && name != fe.displays[fe.list.display_index].name ) fe.set_display(idx)
}
load_display_name("mame")
-
Thanks for the help. One more thing. How would I go about running this script from the terminal to get the index and name of the displays?
-
Anybody?
-
You should just need to change AM to run in windowed mode and you can see the prompt output...
-
You should just need to change AM to run in windowed mode and you can see the prompt output...
I'm sorry I thought I put that I was on a raspberry pi, running windowed doesnt change anything. I would jut like to run a script from terminal to get the display index or name, then another separate script to switch to said display from a terminal or ssh.
-
Well I would say it's better to design on something else and copy your layout over.. but I'm sure there is a way to pipe output to a logfile or launch it in another terminal and switch back and forth? My linux is a bit rusty.. regardless, unless you are running it in X it'll be a pain to see debug output and the UI