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.


Messages - l3m35

Pages: [1] 2
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 / Re: Function to add a tag or Extra info
« on: March 27, 2020, 02:22:20 PM »
In my theme if a user adds a tag "Completed" then the badge appears, but you have to explain the user that he has to do it that way.

Exactly what I was trying to do. So bad it can't be done now...

Thank you, folks.

3
Scripting / Re: Function to add a tag or Extra info
« on: March 27, 2020, 12:23:18 AM »
You don't need to add code to a layout for tags, it's builtin to AttractModes controls.

Configure-->Controls-->Add/Remove Tags=<whatever_you_want>

Thank you. I know of it, my idea is to add a shortcut to quickly add a tag like "finished", same way we can configure one to add a game to Favorites. So I can show a proper badge on each game.

Or instead of a tag, I was thinking in use the Extra field.

4
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.

5
Scripting / Re: Save and reuse data - fe.nv?
« on: March 26, 2020, 01:38:46 PM »
In my code I just use something like

Code: [Select]
wrt_file.write_line("12345798")

instead of

Code: [Select]
local writeit = wrt_file.write_line("12345798")

Well...

Code: [Select]
function launch_transition( ttype, var ) {
[...]
break; // Transition.StartLayout works fine reading the file

case Transition.EndLayout:
WriteTextFile("counter").write_line("12345798");
break;
}
};

Not working for me at all. I'm completely lost, it doesn't write the file :(

Thank you anyway! I'll keep trying.


6
Scripting / Re: Save and reuse data - fe.nv?
« on: March 24, 2020, 03:17:42 PM »
Thanks, I'm trying to write the seconds count to a file, sounds like a better solution. Sadly I had no luck writing the file yet, could you tell me if I'm going wrong here?

Code: [Select]
function on_transition( ttype ) {
local ini_file = ReadTextFile("counter")
if ( ttype == Transition.StartLayout ) {
local line = ini_file.read_line()
return line
}
}

This is working to read the file. But how to write the file?

Code: [Select]
function off_transition( ttype ) {
local wrt_file = WriteTextFile("counter")
if ( ttype == Transition.EndLayout ) {
local writeit = wrt_file.write_line("12345798")
return writeit
}
}

I guess I'm very close, but not working...

7
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

8
Scripting / Re: Multiple fonts in the same add_text
« on: March 19, 2020, 04:24:51 PM »
Thank you all. So bad it's not simple like I was trying LOL

Anyway, I've made as keilmillerjr said: two objects and proper alignment. My worry was about position (in fact it's a clock so as numbers change maybe I would have a changing gap between icon and the first number), but now it's ok.

I could edit the font too, thanks for the idea. I use to edit fonts with Fontographer.

9
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'".

10
Scripting / Re: Slice: Out of Range Error (RegEx)
« on: March 14, 2020, 08:23:29 PM »
I have the same problem with this function. Could anyone show how to solve it? I can say it's not a matter of empty listbox since it's happening to me when I filter the favorites (when returning, I get the error and AM freezes).

Edit: nevermind, I had another filter for tags (empty)  :P

And the If to test was

Code: [Select]
local test = fe.game_info(Info.Title);
if ( test .len() > 0 ){ //the function }

11
Scripting / Re: KeyboardSearch module
« on: March 13, 2020, 07:15:33 PM »
Do this module work with newer AM versions? I've tried a lot to make it work but no way (with AM 2.6.1).

12
Scripting / Re: Line height control, possible?
« on: March 01, 2020, 06:40:47 PM »
Exactly what I was searching for, thanks! Can't believe I didn't find it before.

13
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?

14
Scripting / Re: Get substring from game title
« on: February 23, 2020, 11:59:49 AM »
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.

15
Scripting / Re: Get substring from game title
« on: February 20, 2020, 05:33:07 PM »
Thank you. Seems to be working now with:

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

Pages: [1] 2