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 - markc74

Pages: [1]
1
Scripting / Can I do this using arrays and surfaces?
« on: January 26, 2021, 04:09:11 AM »
Hope someone far cleverer than me can help!

I'm creating a new layout for use on my living room box (so widescreen and a little snazzier than my usual ones!)

I had an idea to create a cool filter select menu where you can press a button and move around a grid of available filters, grouped in rows - so my top row might be "all games','most played','favourites' and the next row might be arcade - 'mame','model 3','teknoparrot' etc

I can push the filters into an array fine:

Code: [Select]
local s_list = ["Top","Arcade"];
local f_list = [];
      f_list.append(["Top","All Games"]);
      f_list.append(["Top","Favourites"]);
      f_list.append(["Top","Most Played"]);
      f_list.append(["Arcade","Classics"]);
      f_list.append(["Arcade","Model 2"]);
etc

But what I would like to do, is generate surfaces on the fly based on the row that they appear in. I'd then like to reference those surfaces by their generated name so I can scroll them independently. So in the above example I would have a surface called "Top" and another surface called "Arcade"

So something like this:

Code: [Select]
foreach (s in s_list) {
      #Generate surface based on s value at posiition y
      foreach (f in f_list) {
            # Add items to above surface at position x
            # x=x+200
      }
      y=y+200
}

I could obviously hard code all the filters in, but this would be pretty long-winded and not very flexible.

Is there a way this can be done?

2
Scripting / Issue with animate2 module and delay
« on: December 12, 2019, 01:19:50 AM »
Hi guys - it's been a while since I've messed around with Attract Mode but got the bug again and am working on a new layout for a micro build I've nearly finished.

Anyway - What I'm *trying* to do is slowly scroll a menu bar off the top of the screen after 3 seconds. This is the line of code I am using:

PropertyAnimation(menu).key("y").from(0).to(-80).delay("3s").duration("5s").easing("ease-out-circle").play();

I don't actually want it to take 5 seconds to scroll out - I'm just using that to demonstrate the problem I am having. Basically the bar stays exactly where it should for 3 seconds, but then immediately moves near to the top of the screen and then slowly scrolls the rest away over 2 seconds. It's as if the animation is starting at the same time as the delay (but not visible) and then jumps to the 3 second point of the animation and completes it.

Any ideas? Am I being an idiot?

3
Hi all,

I've been working on this layout on and off for a little while as I had a couple of bugs that I couldn't seem to iron out. After a moment of clarity (read:sobriety) I think it should be working pretty well now. It's basically an expanded version of my Vertical theme here: http://forum.attractmode.org/index.php?topic=2120.0

It's very much aimed at CRT cabinets running at 640x480. I haven't tried it in 320x240 but it would probably work fine with some tweaking to font sizes and such.

I've included the layout and the attract mode config file because it very much relies on both the displays and filters being setup in a particular way but it should be easy enough to follow. Ask any questions if you want any more info.

Video: https://www.youtube.com/watch?v=nXN8tFDVSVk

(Note that I haven't finished my games lists yet so there's a few blanks/rom names showing as titles etc)

Features:
Switch between game list view/history/artwork with a button press (button 3)
Switch between system/genre/year/controls with a button press (button 2)
Switch between filters (based on above list) with a button press (button 1)

Uses the animate2 and history scripts from arcadebliss so credit to those guys for being awesome

Hope this is useful to someone!

M

4
Hi guys,

I did a layout a while ago called Invaders that I was using for my vertical cabinet. I uploaded it to the Themes board

I'm most of the way through a horizontal version but I'm hitting 2 bugs that I can't seem to fix and I'd be very grateful if anyone could help shed some light on what I might be missing!

I've attached a video showing what *is* happening but I'll explain first what *should* be happening!

The title on the top left bar is showing the current selected filter. I have a button on my panel which goes to the next filter when pressed.

Bug 1: When I reach the end of the filter list, I can't get the title to return to the first filter (ALL). Instead it stays on the last filter on the list (Sony Playstation). If I press the next filter button again, you can see ALL scroll off the list and it carries on as normal. I've attempted to check to see if the next filter name is null but i cant seem to get it to work... (14 seconds/27 seconds of video)

On the top right of the frontend it shows the display. As there are only 4 I can show them all with a scrolling 'tab' when you click the 'next display' button. This works great, and does go to the next display, BUT:

Bug 2: It doesn't reload the filters at the top left, meaning that they dont make sense for the display. i.e. systems should show "MAME", "Playstation" etc but if I switch to year, the filter list should show "1978", 1979" etc. (32 seconds of video)

https://youtu.be/hZihdxN8sqo

As soon as these bugs are fixed I'll upload it properly to the themes area. Any help most gratefully received!!

Many thanks,
Mark

Code: [Select]
//
// Attract-Mode Front-End - "Blip 2018 by MarkC74"
//

fe.layout.width=800;
fe.layout.height=480;

fe.load_module("animate2");
fe.layout.font = "captain";


// BACKGROUND
// ----------

local menu_bar = fe.add_image("background_menu.png",0,0,640,64);

// FILTERS MENU
// ------------

local filter_current = fe.add_text("",14,12,320,40);
filter_current.charsize = 32;
filter_current.align = Align.Left;
local filter_next = fe.add_text("",14,54,320,40);
filter_next.charsize = 32;
filter_next.align = Align.Left;


// VIDEO
// -----

local vid_area = fe.add_surface(640,368);
vid_area.y = 64
local no_vid = vid_area.add_image("black.png",0,0,640,480);
local vid = vid_area.add_artwork("video",0,0,640,480);

local shade = fe.add_image( "shade.png", 8, 64, 640, 368 );
shade.alpha = 200;

// GAMES LIST
// ----------

local lb = fe.add_listbox( 20, 80, 400, 336 );
lb.charsize = 18;
lb.set_sel_rgb( 255, 255, 255 );
lb.alpha = 50;
lb.selbg_alpha = 0;
lb.sel_alpha = 255;
lb.rows = 13;
lb.align = Align.Left;


// HISTORY TAB
// -----------

local history = fe.add_surface(640,368);
history.x = 640;
history.y = 64;
local history_background = history.add_image( "black.png", 0, 0, 640, 368 );
history_background.alpha= 150;
local history_text = history.add_text("[!get_hisinfo]", 32, 8, 600, 304);
history_text.charsize = 16;
history_text.align = Align.Left;
history_text.word_wrap = true;


// ARTWORK TAB
// -----------

local flyer_cab = fe.add_surface(640, 368);
flyer_cab.x = 640;
flyer_cab.y = 64;
local flyer_cab_background = flyer_cab.add_image( "artwork_background.png", 0, 0, 640, 368 );
local flyer_cab_flyer = flyer_cab.add_artwork ("flyer", 8, 0, 287, 368);
local flyer_cab_cab = flyer_cab.add_artwork ("cabinet", 297, 0, 333, 368);
flyer_cab_cab.preserve_aspect_ratio = true;





// FRAME
// -----

local frame = fe.add_image("frame.png",0,0,640,480);
local button_go = fe.add_image("button_go.png",552,404,68,57);
local right_side_mask = fe.add_image( "black.png", 640, 0, 880, 840 );





// TOP MENU
// --------

local top_menu_tab = fe.add_image("top_menu_tab.png",304,16,80,40);
local top_menu_system = fe.add_text("SYSTEM",304,24,80,20);
local top_menu_genre = fe.add_text("GENRE",384,24,80,20);
local top_menu_years = fe.add_text("YEAR",464,24,80,20);
local top_menu_controls = fe.add_text("CONTROLS",544,24,80,20);


// BOTTOM MENU
// -----------

local bottom_menu_text = fe.add_text("Game [ListEntry] of [ListSize]",20,440,320,20);
bottom_menu_text.charsize=16;
bottom_menu_text.align = Align.Left;

local label_game_details = fe.add_text("[Year] [Manufacturer]",304, 440, 240,20);
label_game_details.charsize=16;

local bottom_menu_tab = fe.add_image("bottom_menu_tab.png",276,371,128,64);
local bottom_menu_video = fe.add_text("GAMEPLAY",304,408,80,20);
local bottom_menu_info = fe.add_text("HISTORY",384,408,80,20);
local bottom_menu_cabinet = fe.add_text("ARTWORK",464,408,80,20);


// SCRIPTS
// -------

// VARIABLES
// ---------

local info_view = 0;
local slide_time = "500ms";
local animation_style = "ease-in-out-circle";


// ONLOAD
// ------

function start_up( ttype, var, transition_time )
{
if (ttype==Transition.StartLayout) {
if (var==FromTo.Frontend)
{
PropertyAnimation(button_go).key("alpha").from(0).to(220).duration("1s").yoyo(1).loops(-1).play();
filter_current.msg = fe.filters[fe.list.filter_index].name;
if (fe.list.name=="System") {top_menu_tab.x=304;}
if (fe.list.name=="Genre") {top_menu_tab.x=384;}
if (fe.list.name=="Year") {top_menu_tab.x=464;}
if (fe.list.name=="Controls") {top_menu_tab.x=544;}
}
}
if (ttype==Transition.ToNewList) {
//fe.set_display(fe.list.display_index);
};
   return false;
};
fe.add_transition_callback( "start_up" );


// ON TRANSITIONS
// --------------

function on_transition( signal_str )
{
if (signal_str=="next_filter")
{
filter_current.msg = fe.filters[fe.list.filter_index].name;
filter_next.msg = fe.filters[fe.list.filter_index+1].name;
//if (fe.filters[fe.list.filter_index+1].name.isnull()) {
// filter_next.msg = "xxxx"
//};
PropertyAnimation(filter_current).key("y").from(12).to(-28).duration(slide_time).easing(animation_style).play();
PropertyAnimation(filter_next).key("y").from(52).to(12).duration(slide_time).easing(animation_style).play();




};
if (signal_str=="next_display")
{
if (fe.list.name=="System") {
PropertyAnimation(top_menu_tab).key("x").to(384).duration(slide_time).easing(animation_style).play();
} else if (fe.list.name=="Genre") {
PropertyAnimation(top_menu_tab).key("x").to(464).duration(slide_time).easing(animation_style).play();
} else if (fe.list.name=="Year") {
PropertyAnimation(top_menu_tab).key("x").to(544).duration(slide_time).easing(animation_style).play();
} else {
PropertyAnimation(top_menu_tab).key("x").to(304).duration(slide_time).easing(animation_style).play();
};
};
if ((signal_str=="up"||signal_str=="down"||signal_str=="next_display")&&(info_view!=0))
{
info_view = 2;
fe.signal( "custom1" );
}
if ((signal_str=="custom1"))
{
if (info_view==0) {

PropertyAnimation(lb).key("x").from(20).to(-250).duration(slide_time).easing(animation_style).play();
PropertyAnimation(history).key("x").from(640).to(0).duration(slide_time).easing(animation_style).play();
PropertyAnimation(bottom_menu_tab).key("x").to(356).duration(slide_time).easing(animation_style).play();
info_view = 1;
};
else if (info_view==1) {
PropertyAnimation(flyer_cab).key("x").from(640).to(0).duration(slide_time).easing(animation_style).play();
PropertyAnimation(bottom_menu_tab).key("x").to(436).duration(slide_time).easing(animation_style).play();
info_view = 2;
};
else {
PropertyAnimation(lb).key("x").from(-250).to(20).duration(slide_time).easing(animation_style).play();
PropertyAnimation(history).key("x").from(0).to(640).duration(slide_time).easing(animation_style).play();
PropertyAnimation(flyer_cab).key("x").from(0).to(640).duration(slide_time).easing(animation_style).play();
PropertyAnimation(bottom_menu_tab).key("x").to(276).duration(slide_time).easing(animation_style).play();
info_view = 0;
};
};
return false;
};
fe.add_signal_handler( "on_transition" );





// SHOW HISTORY TEXT

class UserConfig {
</ label="History.dat", help="History.dat location. Be sure to enable and config History.dat from the plugins menu.", order=1 />
dat_path="C:\\games\\mame\\history.dat";
};

local my_config = fe.get_config();

function get_hisinfo()
{
local sys = split( fe.game_info( Info.System ), ";" );
local rom = fe.game_info( Info.Name );
local text = "";
local currom = "";

local alt = fe.game_info( Info.AltRomname );
local cloneof = fe.game_info( Info.CloneOf );
local lookup = get_history_offset( sys, rom, alt, cloneof );

if ( lookup >= 0 )
{
text = get_history_entry( lookup, my_config );
local index = text.find("- TECHNICAL -");
if (index >= 0)
{
local tempa = text.slice(0, index);
text = strip(tempa);
}
} else {
if ( lookup == -2 )
text = "Index file not found.  Try generating an index from the history.dat plug-in configuration menu.";
else
text = "No Information available for:  " + rom;

return text;
};



// DEBUG
// -----




5
Scripting / Is it possible to format text on a surface?
« on: May 20, 2018, 03:37:36 PM »
I'm trying to create a group of objects that animate in and out of the screen in the same way, so I thought adding them to a surface would be the answer but I cant see a way to set font sizes within a surface. The only option I can find is to add text which defaults to a tiny font.

Is it possible?



6
Themes / Vertical CRT layout 0.2
« on: February 12, 2018, 12:27:39 PM »
Hi all,

After some great help from calle81 and popoklo, here's the layout I'll be using in my cabinet and is free for anyone to use/break whatever.

It's aimed at standard resolution (15hz) CRT's in vertical orientation. That's what my cabinet is so I've created it for that but it should be relatively straightforwards to scale if anyone wants to.

Video:

https://youtu.be/ST8crDZLBq8

Features:
  • optimised for low resolution CRT's in vertical orientation
  • games list which slides in and out!
  • cycles through videos/history*/flyers/cabinet when a key is pressed (custom1)
  • left index bar showing how far down the game list you are
  • poor code quality and stupid bugs undocumented features!

*History code was completely stolen from ArcadeBliss so all credit to them for making that work (thanks!)

Known issues
  • tabs at bottom occassionally get misaligned. Probably something to do with my inexperienced use of animate2 module
  • info doesn't always slide in properly (as above)
  • it's really unoptimised...

I'm posting it now, because it works well enough for what I need and the bugs don't bother me enough. However - if someone else wants to have a pop at it then please do. There's not a lot of code to it and I've included the photoshop artwork file in the attachment. The only thing I ask, is that if you do fix my shoddy code, then please upload it into this thread so I can read it and get better  :D)

7
Hi all,

I'm almost finished creating a theme for my upright CRT cabinet but I've ran into a problem that I can't seem to fix and really hope someone here might be able to help me out.

The theme (called the Invaders) is a relatively simple list with a video running in the background. Pressing the "custom1" button cycles between the video of the game running, the flyer, and cabinet before returning to the video again. This happens via animate.nut which just slides the images in and out from the side.

On initial loading, scrolling up and down through the list works perfectly well, but after cycling through the vid/flyer/cabinet a couple of times the whole theme starts slowing down and becoming choppy.

I've done some searching but didn't really come up with anything. The laptop I'm using to create the theme is an i7 with 16GB ram and 500GB SSD so I dont think that should be causing the problem so I expect the problem lies with my code being inefficient in some way (I'm learning as I go!)

Anyway -if anyone has time to take a look at the attached layout and see if they can see anything obvious I'd be very grateful!

Here's a youtube link showing initially how smooth it runs, and then the slowdown/stuttering appearing (around the 1:00 mark)

https://youtu.be/-YSqlLmkfMs

8
Themes / Arcade Row - WIP
« on: March 23, 2015, 11:51:59 AM »
Hi all - I posted a vid of this on YouTube a while ago. It's not perfect and there's definitely room for some optimisation but it does roughly what I need to do with it. If I get some time I'll come back to it to smooth things out but if anyone else wants to pick it up then I'm more than happy.  :)

Requires artwork setup properly - marquee/video/snap folders setup.

https://youtu.be/XJEgRZT6bk0

9
Scripting / Question about ListEntry
« on: February 12, 2015, 03:08:46 PM »
Hi - loving the frontend but a bit stuck and could do with some help if anyone has the time!

I'm trying to map the ListEntry value to a variable so I can do a calculation on it. I'm going to use this value to position a graphic on the screen depending on what percentage you are through the current list).

How do I do this? I've tried pretty much every combination I can think of!

Many thanks in advance. Once this is done my theme will be ready to share...!

Mark

Pages: [1]