Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: liquid8d on October 15, 2015, 12:01:44 AM
-
I just spent a little time putting this together. Time to share :) If you like them and want to see other category images added let me know.
(http://i.imgur.com/2eElfkA.png)
You can update mappings for the images to category names in the class, and the class has 3 modes - first match, last match, or random match.
local bg = fe.add_artwork("snap", 0, 0, fe.layout.width, fe.layout.height);
local text = fe.add_text("[Title]", 0, 0, fe.layout.width, 75);
local genre_image = fe.add_image("images/unknown.png", fe.layout.width - 188, fe.layout.height - 170, 168, 150);
class GenreImage
{
mode = 1; //0 = first match, 1 = last match, 2 = random
supported = {
//filename : [ match1, match2 ]
"action": [ "action" ],
"adventure": [ "adventure" ],
"fighting": [ "fighting", "fighter", "beat'em up" ],
"platformer": [ "platformer", "platform" ],
"puzzle": [ "puzzle" ],
"racing": [ "racing", "driving" ],
"rpg": [ "rpg", "role playing", "role playing game" ],
"shooter": [ "shooter", "shmup" ],
"sports": [ "sports", "boxing", "golf", "baseball", "football", "soccer" ],
"strategy": [ "strategy"]
}
ref = null;
constructor( image )
{
ref = image;
fe.add_transition_callback( this, "transition" );
}
function transition( ttype, var, ttime )
{
if ( ttype == Transition.ToNewSelection || ttype == Transition.ToNewList )
{
local cat = " " + fe.game_info(Info.Category, var).tolower();
local matches = [];
foreach( key, val in supported )
{
foreach( nickname in val )
{
if ( cat.find(nickname, 0) ) matches.push(key);
}
}
if ( matches.len() > 0 )
{
switch( mode )
{
case 0:
ref.file_name = "images/" + matches[0] + ".png";
break;
case 1:
ref.file_name = "images/" + matches[matches.len() - 1] + ".png";
break;
case 2:
local random_num = floor(((rand() % 1000 ) / 1000.0) * ((matches.len() - 1) - (0 - 1)) + 0);
ref.file_name = "images/" + matches[random_num] + ".png";
break;
}
} else
{
ref.file_name = "images/unknown.png";
}
}
}
}
GenreImage(genre_image);
(http://i.imgur.com/TAoWNFd.png)
-
nicely done!
---
Maybe you could use slightly thicker lines on
- fighter
- rpg
- sports
because these are more "delicate" than the rest
-
Very nice indeed... Good job as always Liquid8. :)
-
liquid8d, good job. :)
-
Hi liquid8d, just add its on new layout. You may try & thank you for your effort :)
http://forum.attractmode.org/index.php?topic=430.0
-
//filename : [ match1, match2 ]
"action": [ "action" ],
"adventure": [ "adventure" ],
"fighting": [ "fighting", "fighter", "beat'em up" ],
"platformer": [ "platformer", "platform" ],
Just find some issue of above script, since file name is fighter.png, "fighting" should be amend to "fighter" . Thanks.
"fighter": [ "fighting", "fighter", "beat'em up" ],
-
Thanks! It looks great in your theme, too!
-
nicely done!
---
Maybe you could use slightly thicker lines on
- fighter
- rpg
- sports
because these are more "delicate" than the rest
btw, I agree with you, but these were stock images I found.. I can do okay with photoshop but would probably mess up trying to make those look better :)
-
I can fix it if you'll send me photoshop (layered) files with these 3 icons.
-
I just checked in the sample layout and the PSD:
https://github.com/liquid8d/attract-extra/blob/master/extras/genre.psd
https://github.com/liquid8d/attract-extra/tree/master/layouts/genre
Thanks!
-
ok, I've updated following icons:
- new shooter (based on galaga ship)
- new fighter
- rpg - thicker and filled sword
- sports - slightly thicker
- puzzle - new shape
I've made this as separate layers - so you'll have all old and new versions in one file.
PSD file in attachment
-
It is very nice. Could you help to save as png format for each? Thanks :)
-
I'll leave that to liquid8d - he has to decide if he likes new icons. Maybe he'll like original icons better.
-
It is better to change image of "SPORT" (eg. football image). The current boxing image is too similar of FIGHTER. Thanks.
-
I updated the new Fighter, Puzzle, RPG, Sports and Shooter icons:
(http://i.imgur.com/uU2rNWA.png)
I did a new Sports with a ball and left verion's new one as -alt. I preferred the old Shooter icon, but left verion's new one as -alt. You can swap them out if you prefer the other.
Thanks verion!
https://github.com/liquid8d/attract-extra/blob/master/extras/genre.psd
https://github.com/liquid8d/attract-extra/tree/master/layouts/genre/images
-
no problem
-
i want to add player number ,manufacture image using this script but it not working with me what i am missing ?
also i have problem to convert my players number from hyperspin list to AM All information convert except "players" i change it to "p" "mode"
the value is numbers . i want to view image player 1-4 in my front am if there anything can help ..
also i try to change this :
local cat = " " + fe.game_info(Info.Category , var).tolower();
to
local cat = " " + fe.game_info(Info.Players, var).tolower();
-
I made a bunch of new genres because "rhythm" and "VR" were a must have for me, and for some reason i had "action" as the same thing as "platformer".
Since i spent a few minutes on that i'll share the images.
now i have way too many colors, but i save the bad ones for genres i don't play much, like strategy or adventure, and i save the clearly noticeable ones like yellow and red for RPG and Fighters.