Attract-Mode Support Forum
Attract-Mode Support => General => Topic started by: arthurvalenca 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?
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;
-
Short on the help,, but that theme is looking .....dope...
-
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
-
Add romnane to an array in fe.nv? Or create/read/write tag list file.
-
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?
// 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 );
-
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:
function Completed(offset){
return (fe.game_info( Info.Tags, offset ).find (";Completed;") != null)
}
-
Why have a broken tag? Filter it out of the romlist automatically. Status is in mame.xml
-
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:
function Completed(offset){
return (fe.game_info( Info.Tags, offset ).find (";Completed;") != null)
}
Thanks Paolo!
Worked!!!!!!!!!!!!!
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!!!!!!!!!!!!!!