Author Topic: [HELP] Info Tags  (Read 2980 times)

arthurvalenca

  • Sr. Member
  • ****
  • Posts: 125
    • View Profile
[HELP] Info Tags
« on: June 14, 2020, 08:11:50 AM »
Hello everyone, I need help with the code below, in the general settings I have the option to select whether I want to confirm favorites or not, but for the add tag function I don't have this option when I press add tag it opens a window for me to choose the tag I want to add, well in my case I only have a single "Completed" tag, can you help me with the code below that when I click on add tat it adds the tag without having to select in the window?

Code: [Select]
function Complete(){
if (fe.game_info( Info.Tags ) == ";Completed;"){
return "images/completed.png";
}
else if (fe.game_info( Info.Tags ) != ";Completed;"){
return "images/null.png";
}

}

local complete = fe.add_image( "[!Complete]", flx * 0.558, fly*0.352, flw * 0.027, flh * 0.035 );
complete.zorder = 4;

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: [HELP] Info Tags
« Reply #1 on: June 14, 2020, 01:30:01 PM »
Short on the help,, but that theme is looking .....dope...
help a friend....

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1236
    • View Profile
    • My deviantart page
Re: [HELP] Info Tags
« Reply #2 on: June 15, 2020, 12:36:06 AM »
As far as I know, at the moment there's no way to add a tag without using the menu. The fe.game_info entry are read only, and there's no way to change them directly.

A workaround (the one I use in my layout) would be to directly edit the tag files that are in the romlist folder of attract mode, adding or removing the games with the proper tag. That works, but it doesn't affect the current romlist unless you find a way to force a "to new list" transition so the romlist is refreshed internally.

My solution is pretty pervasive: I have a "proxy" romlist built at the beginning and use that for all my game info, so I can add fields to that romlist that don't exist in the real romlist. This is a deep change and requires a lot of code, but you could use a proxy romlist just for "Completed" tag management.
You could do something like this: build a table at the load of a list with the rom names as fields, and the "completed" switch data taken from a tag file (either the default completed tag file or a custom file in your layout folder). This would completely decouple your "completed" status checks with tags.

I know my explanation is a bit confused, sorry, but this is the obscure territory where you add features to Attract Mode that are not even present in the main software :D

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: [HELP] Info Tags
« Reply #3 on: June 15, 2020, 04:07:04 AM »
Add romnane to an array in fe.nv? Or create/read/write tag list file.

arthurvalenca

  • Sr. Member
  • ****
  • Posts: 125
    • View Profile
Re: [HELP] Info Tags
« Reply #4 on: June 17, 2020, 10:48:59 AM »
As far as I know, at the moment there's no way to add a tag without using the menu. The fe.game_info entry are read only, and there's no way to change them directly.

A workaround (the one I use in my layout) would be to directly edit the tag files that are in the romlist folder of attract mode, adding or removing the games with the proper tag. That works, but it doesn't affect the current romlist unless you find a way to force a "to new list" transition so the romlist is refreshed internally.

My solution is pretty pervasive: I have a "proxy" romlist built at the beginning and use that for all my game info, so I can add fields to that romlist that don't exist in the real romlist. This is a deep change and requires a lot of code, but you could use a proxy romlist just for "Completed" tag management.
You could do something like this: build a table at the load of a list with the rom names as fields, and the "completed" switch data taken from a tag file (either the default completed tag file or a custom file in your layout folder). This would completely decouple your "completed" status checks with tags.

I know my explanation is a bit confused, sorry, but this is the obscure territory where you add features to Attract Mode that are not even present in the main software :D

Hello could you help me Paolo?

I have 2 types of Tags, a "Completed" that works well, and one that would be "Broken" to mark the games that are broken with an image, my doubt and I am not able to add 2 tags to the same game, there is already one added the moment I try to add another the two disappear, when I remove each other appears, could you help me?


Code: [Select]
// Games Completed //

function Completed(){
if (fe.game_info( Info.Tags ) == ";Completed;"){
return "images/tags/completed.png";
}

else if (fe.game_info( Info.Tags ) != ";Completed;"){
return "images/tags/null.png";
}

}

local complete = fe.add_image( "[!Complete]", flx * 0.679, fly*0.353, flw * 0.045, flh * 0.028 );

// Broken Games //

function Broken(){
if (fe.game_info( Info.Tags ) == ";Broken;"){
return "images/tags/broken.png";
}

else if (fe.game_info( Info.Tags ) != ";Broken;"){
return "images/tags/null.png";
}

}

local Broken = fe.add_image( "[!Broken]", flx * 0.700, fly*0.353, flw * 0.045, flh * 0.028 );



zpaolo11x

  • Hero Member
  • *****
  • Posts: 1236
    • View Profile
    • My deviantart page
Re: [HELP] Info Tags
« Reply #5 on: June 17, 2020, 11:47:47 AM »
If you had two tags then the tag property will be something like “;broken;completed;” so to check if the “completed” tag is there you have to use the “find” function and check that it’s not null. Sorry I’m answering from my phone and I can’t put an example.

Back home, try with this kind of function:

Code: [Select]
function Completed(offset){
 return (fe.game_info( Info.Tags, offset ).find (";Completed;") != null)
}
« Last Edit: June 17, 2020, 12:07:31 PM by zpaolo11x »

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: [HELP] Info Tags
« Reply #6 on: June 17, 2020, 12:58:11 PM »
Why have a broken tag? Filter it out of the romlist automatically. Status is in mame.xml

arthurvalenca

  • Sr. Member
  • ****
  • Posts: 125
    • View Profile
Re: [HELP] Info Tags
« Reply #7 on: June 17, 2020, 05:17:18 PM »
If you had two tags then the tag property will be something like “;broken;completed;” so to check if the “completed” tag is there you have to use the “find” function and check that it’s not null. Sorry I’m answering from my phone and I can’t put an example.

Back home, try with this kind of function:

Code: [Select]
function Completed(offset){
 return (fe.game_info( Info.Tags, offset ).find (";Completed;") != null)
}

Thanks Paolo!

Worked!!!!!!!!!!!!!

Code: [Select]
function Completed(offset){
 if (fe.game_info( Info.Tags, offset ).find (";Completed;") != null)
return "images/tags/completed.png";
else return "images/tags/null.png";

}

Big Thanks!!!!!!!!!!!!!!

« Last Edit: June 17, 2020, 05:32:29 PM by arthurvalenca »