Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - l3m35

Pages: [1]
1
Scripting / How to set artwork size in function
« on: April 09, 2020, 02:59:46 PM »
I'm doing a multi system emulator, and since SNES have those horizontal art boxes, I need to reorganize some elements, like artwork position/size, overview position, etc, when user changes the emulator.

I was trying something like this:

Code: [Select]
function change_boxart( ){
if(fe.game_info(Info.Emulator) == "Super Nintendo") {
values <- "flw*0.297,flh*0.278, flw*0.235,flh*0.304"
}
else {
values <- "flw*0.297,flh*0.278, flw*0.235,flh*0.604"
}
}
local boxart = fe.add_artwork( "flyer",!change_boxart)

This is not the way ("wrong number of parameters"). Any clue or better idea about how to get all values from the function? Thanks!

2
Scripting / Function to add a tag or Extra info
« on: March 26, 2020, 07:09:55 PM »
Quick doubt: how to add a tag or fill the Extra field with a function?

I see there is the fe.game_info(Info.Tags), but it just get the tags, but don't let we add a new one like this:

Code: [Select]
fe.game_info(Info.Tags).push("newtag") // example
Same thing to add a string to the Extra field would be useful, too.

3
Scripting / Save and reuse data - fe.nv?
« on: March 20, 2020, 04:18:22 PM »
Sorry, one more question because I'm lost this time.

The situation: I have a time counter to show for how long AM is running, and I'd like to store the total time. So if the user exists the Layout, the time (like XXX seconds) will be stored for the next sessions.

How can I store the value? Write it to a file? I was playing around with fe.nv, but docs don't have much about it.

Thanks!

Edit: besides, I have the counter already working, I just need to save and reuse hrs, min and sec:

Code: [Select]
local hrs = x
local mnts = x
local elapsed_tc = x

4
Scripting / Multiple fonts in the same add_text
« on: March 19, 2020, 02:39:22 PM »
Maybe easy but I can't find out how.

Example: I'm using FontAwesome font to show icons and other for general text. But I need a string like "icon + game categories". So something like:

Code: [Select]
fe.add_text("icon [Category]", 0,0,flw,flh)
Any way to make "icon" use a font and [Category] use other? I tried to call the separately like this (this code was not tested, it's similar):

Code: [Select]
local a = "ï›°"
local b = "[Categories]"
a.font="fonta"
b.font ="fontb"
local c = fe.add_text(a +  b, 0,0,0,0)

It results in script error "trying to set 'string'".

5
Scripting / Line height control, possible?
« on: February 29, 2020, 06:06:17 PM »
One more question: is there any way to set the line height of a text?

What I have:

Code: [Select]
local oview = fe.add_text("[Overview]", flw*0.56, flh*0.27, flw*0.4,flh*0.4);
oview.font= "pxl";
oview.align = Align.TopLeft;
oview.word_wrap = true;
oview.charsize = 16;

But I really would need to set the line height, like "oview.line_height=X" (I know it doesn't exist, just as example).

Seems like there is no way to do it directly, right?

6
Scripting / Get substring from game title
« 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?

Code: [Select]
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).

Pages: [1]