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

Pages: 1 ... 6 7 [8]
106
Scripting / What's the right way to access the entries in a list?
« on: August 20, 2015, 02:28:07 PM »
Hi all,

I'm trying to create a kind of "flip card" layout, but in order to do it, I need to know the right way to access all (or at least a specified subset) of the entries in the current filter, and I'm not sure how to go about determining that. Specifically, when I'm creating an array of "cards," each card has that game's snap on it, etc. I guess what I'm really asking is how do I get the next/previous, etc. snaps of the currently selected game? I've tried studying the SimpleArtStrip example, but I'm obviously missing something. I'll keep at it, but in case anyone had any other ideas... Thanks!

107
Scripting / Re: Surfaces. How do they work?!
« on: August 18, 2015, 12:29:46 PM »
I'm an idiot. I added my original surface below the overall background plate. So it's there, just under everything. Ugh!

108
Scripting / Surfaces. How do they work?!
« on: August 18, 2015, 12:27:14 PM »
Hi all,

I have a bunch of junk I'm trying to cram into a surface, like this:

Code: [Select]
local surfSnap=fe.add_surface(280, 140);
surfSnap.set_pos(0, 60);

local snap_bg=surfSnap.add_image("snap_bg.png", 0, 0, 280, 140);
local snap_img=surfSnap.add_artwork("snap", 0, 0, 280, 140);

If I don't use surfaces, I can stack 'em up and they display as expected, but I'm trying to lay the groundwork for some motion, and surfaces appear to be the way to go. Am I missing something? I tried setting the surface object's alpha, visible, set_rgb, but nothing changed what I was seeing. I'd appreciate any insight! Thanks!

109
Scripting / Re: Multiline? Expanded tokens? Oh my!
« on: August 17, 2015, 06:33:23 AM »
Thanks -- after posting that last response, I realized I could do just what you've done above, so thanks for that!

I stripped everything out and replaced it with the following:

Code: [Select]
switch (ttype) {
case Transition.ToNewSelection:
print ("\nTransition: "+ttype+"; ");
print ("var: "+var+"\n");
print ("Current selection index: "+fe.list.index+"\n");
break;

case Transition.ToNewList:
print ("\nTransition: "+ttype+"; ");
print ("var: "+var+"\n");
print ("Current filter index: "+fe.list.filter_index+"\n");
break;

case Transition.StartLayout:
print ("\nTransition: "+ttype+"; ");
print ("var: "+var+"\n");
break;
}

While watching the output window, moving from list to list works as it should: var is applied correctly; however, when moving from selection to selection, var is always one iteration "behind;" that is, if I'm incrementing, var will add 1, but if I then decrement, var will add 1, and if I decrement again, var will subtract 1. If I then increment again, var will subtract 1 and, on the next increment, add 1. Programmatically, I can't see that I'm doing anything wrong, but I must be, because ++/-- shouldn't behave like it is... :-\

Any other thoughts? I do appreciate the help, and I'm trying not to come across like a complete moron (too late?!), so again, thank you very much!

(Full disclosure: years ago, I spent a lot of time coding Flash ActionScript 3, so there might be some language baggage I'm carrying! :-) )

110
Scripting / Re: Multiline? Expanded tokens? Oh my!
« on: August 17, 2015, 05:24:11 AM »
That was my exact code, and I thought the missing break was intentional! :) I added it in, but that gives me an initially blank layout (textwise). It got me thinking, though, to I tossed in some cases for other transition types. Except now I'm not sure exactly which transition is firing when! I'm printing out ttype when the callback executes, but I'm only seeing the constant value (e.g., 0, 6, etc.) and I can't find a list of what each named constant actually represents (and in some cases, simply moving to the next/prev game triggers 3 callback executions). For example, is a ttype of 0 Transition.StartLayout or maybe Transition.ToNewList? If there's a list of transition types and their actual values somewhere, I'd love to know about it! Thanks, as always!

111
Scripting / Re: Multiline? Expanded tokens? Oh my!
« on: August 16, 2015, 09:47:18 PM »
All right, thanks to liquid8d's example, I managed to get most of what I'm gunning for working! Now (of course!) I've run into another snag. :(

With the following:

Code: [Select]
local tfCountDeets=fe.add_text("", 0, 0, 100, 100);
local countDeets;

countDeets=(fe.list.index.tointeger()+1)+" ("+fe.list.size+")";
tfCountDeets.msg=countDeets;

on first run the index appears correct: as soon as I start AM, I see whatever the last list was and whatever the last game was, just like I should, and they're properly indexed. However, if I press up or down (using a keyboard right now), the list changes appropriately, but the index starts doing crazy things! For example, if I was at, say, game 10 of 40, when I start AM, the following would spit out "9":

Code: [Select]
print (fe.list.index); // outputs 9 (as expected!)

But the next up/down would give me the same result (9 in this case)! And, supposing I pressed down in the prior example, the next press up would display 10 (game 11); the next press up would display 9 again... What it looks like is happening is AM is one game behind (or ahead) of where it needs to be. I'd think it was just a screen redraw issue except the print() statement returns the same (wrong) values.

Any thoughts? Thanks!

EDIT: All right, I just noticed that if I'm on, say, filter A and game 20, if I switch filters, then switch back, suddenly I'm on game 21, but an up or down leaves me at the same "new" index, which sorts itself with the next up/down, but it's odd nonetheless...So here's what I've got going on, just in case anyone more knowledgeable than me can tell me what I'm doing wrong:

Code: [Select]
function transitionCallback (ttype, var, ttime)
{
switch (ttype) {
case Transition.ToNewList:
local filter;
local filterDeets;

filter=fe.filters[fe.list.filter_index].name;
filterDeets=filter;
// print ("\nCurrent filter ("+fe.list.filter_index+"): "+filterDeets+"\n");
tfFilter.msg=filterDeets;

case Transition.ToNewSelection:
local title, rom, cat, players, year, mfr;
local titleDeets, romDeets, copyDeets, countDeets;

title=fe.game_info(Info.Title, var);
titleDeets=(title!=null ? getPrettyTitle(title) : "???");
tfTitle.msg=titleDeets;
tfTitleShadow.msg=titleDeets;

rom=fe.game_info(Info.Name, var);
cat=fe.game_info(Info.Category, var);
players=fe.game_info(Info.Players, var);

romDeets=(rom!=null ? rom : "???")+"\n";
romDeets+=(cat!=null ? getPrettyCat(cat) : "n/a")+"\n";
romDeets+=(players!=null ? getPrettyPlayers(players) : "? player(s)");
tfRomDeets.msg=romDeets;
tfRomShadow.msg=romDeets;

year=fe.game_info(Info.Year, var);
mfr=fe.game_info(Info.Manufacturer, var);

copyDeets=(mfr!=null ? (year!=null ? "© "+year+" "+mfr : "") : "© n/a");
tfCopyDeets.msg=copyDeets;

// countDeets=(fe.list.index.tointeger()+1)+" ("+fe.list.size+")"; // Always one index "behind" it seems...
tfCountDeets.msg="[ListEntry] ([ListSize])";
// tfCountDeets.msg=countDeets;
break;
}
}

fe.add_transition_callback (this, "transitionCallback");

112
Scripting / Re: Multiline? Expanded tokens? Oh my!
« on: August 16, 2015, 11:57:48 AM »
Thanks, liquid8d! I was not doing that, but I'll definitely investigate! From the looks of it, that's exactly what I needed. I'll give it a go and see what happens. Again, thanks!

113
Scripting / Multiline? Expanded tokens? Oh my!
« on: August 15, 2015, 07:52:14 PM »
Hi all,

I'm poking around under the hood, probably in places I shouldn't, but here are my latest questions:

I have a text item that I want to span 3 lines. Once in a while, it'll work if I feed it a string like g_name+"\n"+g_cat+"\"+g_players ; other times, AM instantly crashes. Am I doing something wrong? Here's what I really want to happen:

When switching to the next game in the list, I want its ROM name, its category, and how many players it supports listed (hence the above variables). Here's the other thing: I'd also like to get the actual text for the category and the actual integer value for how many players, but I don't know how to do that. I tried using fe.game_info(Info.Category, index_offset) and fe.game_info(Info.Players, index_offset), but that only ever returns information related to the very first ROM displayed in the layout; moving up or down changes nothing. For the number of players, at least, I'd like to add a statement that "prettifies" the count, something like this:

Code: [Select]
local num_players, g_players;
g_players=(num_players==1 ? "1 player" : num_players.tostring()+" players");

So what I need to do is find some way to get the  currently displayed game's category and number of players (and name, and everything, but hey) in an object format, or find some means to expand the tokens and save the actual values into new variables.

Am I misunderstanding how fe.game_info() should work, or is there something else I need to implement to "kick it" to get updated ROM data when I switch to the previous/next game?

Oh, some notes: I have word_wrap enabled in the particular text field I'm using, and, as I said, sometimes it works, but -- and here's the head scratcher -- if the last game displayed didn't have anything in its category slot, AM would instantly die; if I disabled the newlines and category for a moment, moved up or down to a game with category information, then reenabled it, it would work! Weird!

As always, I'd appreciate any help or insight anyone can provide! Thanks!

114
Scripting / Gaussian blur filter shader: How?!
« on: August 15, 2015, 01:28:02 PM »
Hey all,

I'm trying to mess around with layouts, and I have the (very) basics down, I think, but I want to add a gaussian blur shader to part of it. Except I don't know how to write one and what I've been able to find on the internet looks... all right, it looks weird, but the way they have [Vertex_Shader] and [Pixel_Shader] sections makes squirrel angry, so straight up cutting and pasting is out. I'm happy to learn, but I'm such a neophyte that I'm not even sure where to really begin looking. Any advice or direction would be greatly appreciated! Thanks!

115
General / Re: Yet another n00b filter question
« on: August 14, 2015, 12:30:33 PM »
Thanks for the response. I was afraid it might be something like that :( I was hoping there was a one-line (rule) approach, but assuming we're doing regex under the hood, it makes sense that math operators wouldn't work. All right, thanks again!

116
General / Yet another n00b filter question
« on: August 13, 2015, 09:56:45 PM »
Hey all,

I'm curious to learn if there's a way to filter based on, say, games released before or after a certain year. Basic greater than/less than comparators. But I'm not sure how (if?) they might be implemented in the filters. I have other filters working, but not sure what to do for this (assuming it's even possible)! If there is a way to do this, I'd also use it in games that can be either 1 or more (e.g., 1, 2, 3, 4) players, etc. Anyway, thanks!

Pages: 1 ... 6 7 [8]