Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: l3m35 on February 20, 2020, 03:44:00 PM
-
Hello, since many romlists have messed titles, I was thinking in get the game title from the rom name, so instead of something like "Ghouls 'N Ghosts (JUE) (REV 01) [!]", I could extract only "Ghouls 'N Ghosts" from it.
I know the scraper should get it, but it seems to don't work for many games, specially the most obscure ones like prototypes, homebrews, etc.
My idea was to use a substr, could anyone tell me if I'm doing it wrong of if there is an easier way?
function clean_title() {
local m = fe.game_info( Info.Title );
m.substr(0,m.indexOf('('));
return m;
}
local cleanamer = fe.add_text( "[!clean_title]", flw*0.01, flh*0.55, flw*0.22, 100);
But this breaks Attract soon as I launch it (i know it's Javascript, no idea if Squirrel is the same thing).
-
I do the same thing, except use the split function.
-
Thank you. Seems to be working now with:
function mb_clnttl(ioffset ) {
local m = fe.game_info( Info.Title,ioffset );
return split( m, "(" )[0];
}
local cleaname = fe.add_text( "[!mb_clnttl]", flw*0.01, flh*0.75, flw*1, 100);
-
Configure-->General-->Hide Brackets in Game Titles = Yes
-
Configure-->General-->Hide Brackets in Game Titles = Yes
Thank you, I tried it. But didn't work for uncommon titles using brackets and parentheses, some titles were broken.