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] 2 3 ... 8
General / Re: How to view enlarged snaps in Attract Mode
« on: February 18, 2019, 06:18:57 PM »
This sounds fairly straight forward -- so long as it's kept fairly rudimentary. Unless someone beats me to it, I'll see if I can knock something out tomorrow or the next day.

Scripting / Re: Aspect Ratio?
« on: February 12, 2019, 02:16:19 PM »
Have you considered the preserve-art module? Using the set_fit_or_fill() method with "fit" should give you the same result in a more predictable manner. I think. Just a suggestion!

Scripting / Re: Easy way of forcing Uppercase text
« on: February 05, 2019, 04:19:20 AM »
split(string, "(/[");

Yeah, that's much better! Now I have some updates to make...

Scripting / Re: Easy way of forcing Uppercase text
« on: February 04, 2019, 03:15:58 PM »
I wrote a function to "re-sanitize" titles when using magic tokens:

Code: [Select]
function getTitle (ioffset = 0) {
    // Working from the raw title, we have to cut away any extra junk:
    local _t = fe.game_info( Info.Title, ioffset );
    // Ignore anything after the first (, [, or /:
    local _i = null;
    _i = _t.find( "(" );
    _t = _i ? _t.slice( 0, _i ) : _t;

    _i = _t.find( "[" );
    _t = _i ? _t.slice( 0, _i ) : _t;

    _i = _t.find( "/" );
    _t = _i ? _t.slice( 0, _i ) : _t;
    return strip(_t).toupper();

Scripting / Re: Diving into squirrel-scripting: some questions
« on: January 31, 2019, 12:11:28 PM »
Code: [Select]
::Displays = {};
for ( local i = 0; i < fe.displays.len(); i++ ) {
    ::Displays["sys" + i] = fe.displays[i];

Access slots like this (these are all equivalent):

::Displays["sys" + 0.tostring()];

That should work (not at home: can't test it), but it just gives you a table-ized version of the already existing fe.displays array. Unless you're passing something else where I've included fe.displays

Scripting / Re: Check if a slot exists?
« on: January 31, 2019, 07:27:38 AM »
Haven't had a chance to try it out yet, but I wrote a convenience function that should allow for cleaner code. I'm posting it here in case anyone else encounters similar circumstances:

Code: [Select]
function exists (t, s) {
// Pass a known table (t) as-is and an unknown slot (s) as a string:
try {
// Perform some non-destructive operation to determine existence:
// (I wonder if just referencing the potential slot would work?)
return true;
catch (e) {
return false;

// Usage example:
myImage.alpha = ( exists(table, "slot") ) ? 255 : 0; // If table["slot"] exists, set myImage to full alpha; otherwise, set it to 0

If I get home and discover this doesn't work, I'll try something else!

Scripting / Re: Check if a slot exists?
« on: January 30, 2019, 02:07:32 PM »
That's what I'd run into, I think. I had it in mind to write an adjunct function that I could pass properties to, but then I realized they'd fail during the initial call (I think), since there's potentially no property to pass? I'll probably give it a try just to see. Unless someone comes up with something better in the meantime! ;-)

Scripting / Re: Diving into squirrel-scripting: some questions
« on: January 30, 2019, 08:46:30 AM »
So long as your "composite" element exists on the main table (fe), you should be able to do what you want. I have a bunch of variables that I've defined like this (for example):

this.rom_1942 <- {
    "btnA": "Fire",
    "btnB": "Loop"

Later, in a function, I want to get the values of btnA, btnB, etc., based on the currently selected game, so I reference it like this, for example:

::print( this["rom_" + fe.game_info(Info.Name)].btnA + "\n" ); // Prints "Fire" (no quotes) to the console

That's off the top of my head. I'm not in front of my "real" code, but I think the above is accurate.

Scripting / Check if a slot exists?
« on: January 30, 2019, 06:52:27 AM »
This is probably a silly question, but I haven't been able to divine an answer through the Squirrel reference docs or googling.

I'm used to Javascript (Actionscript, really), where I could test for the existence of an object property something like this:

Code: [Select]
if (obj.prop) {
    // Property exists: do stuff:
else {
    // Property DOES NOT exist: do something else:

If I try something similar with Squirrel (in my layouts), I get an error because the slot doesn't exist. Currently, I have a rat's next of try..catch statements to determine whether a slot exists, but it's messy (even though it works). Is there a cleaner way to handle checking whether a slot exists?

Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 29, 2019, 11:16:43 AM »
All you should have to do is unzip the archive in your modules folder (attract/modules/shadow-glow). Nothing needs to be renamed. In fact, renaming anything will probably break things!

Once that's done, in your layout, before you want to apply the drop shadow, use this line: fe.load_module("shadow-glow")

Once those things are done, you'll need to create an instance of your snap first, then apply the drop shadow, maybe something like this:

Code: [Select]
// Load module so we can instantiate DropShadow:

// Create a quick and dirty background (drop shadow won't show up against black!):
local bg = fe.add_text("", 0, 0, fe.layout.width, fe.layout.height);
bg.set_rgb(127, 127, 127);

// Create our artwork and apply a drop shadow to it:
local mySnap = fe.add_artwork("snap", 0, 0, 320, 240)
local myDropShadow = DropShadow(mySnap, 50, 10, 10, 153)

// If we want something other than pure black, we can tweak the drop shadow color:
myDropShadow.set_ds_rgb(0, 0, 51);

The values in that example are arbitrary, but should give you an idea of what's going on. Let me know if that doesn't work. I assume you're using the most recent files (from the post you quoted)? The others had some flaws!

(Edited to include comments and stuff.)

Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 29, 2019, 03:12:24 AM »
One last (?!) iteration of the shader-glow module, based wholly on zpaolo11x's drop shadow and ambient glow shaders and code:

Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 28, 2019, 02:49:14 PM »
Just noticed something. Probably not specific to the classes I've added to this thread (but maybe?), but it seems the undocumented (?) fe.module_dir variable returns the path of the last loaded module! Attempting to set it internally doesn't seem to make a difference, though I could be doing it wrong.

Wanted to put this out there in case anyone else a) runs into the issue I did, or b) knows a better workaround than just moving your next fe.load_module() call further down in your code!

Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 28, 2019, 09:02:20 AM »
Ops, sorry I forgot to rename the shader to stress the difference :D It's the way alpha channel is recalculated which is more fit for glow effects.

Ha! Not your fault. I shouldn't have assumed! In the zip I posted above, I renamed the glsl files: gauss_kernsigma_ds.glsl for the drop shadow, and gauss_kernsigma_ag.glsl for the ambient glow (or flat color glow) effect.

I'm looking forward to testing them out tonight when I get home! Thanks for making your stuff available to the masses! It's my hope that my module-ized files will be of benefit to others as well.

Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 28, 2019, 06:26:58 AM »
I looked a little more closely at the actual shaders zpaolo11x used for his effects and discovered differences in how the alpha was applied with his background glow versus his drop shadow. I've made what I believe to be the requisite changes in the shader-glow module, and I think DropShadow should work like it used to. I'd check first, but I can't, because I'm at work on a machine without AM installed. I'll check when I get home, though!

Usage should be the same as above: the change(s) are minor and should be transparent to the user. Just update modules/shader-glow with the attached code (delete the old code first).

Edit: zip moved to this post.

Scripting / Re: White Image Border + Image Reflection
« on: January 26, 2019, 04:14:01 PM »
I wrote a simple shader that may or may not help with the fade to alpha versus black (attached). You may have to place an image on a surface and make it the size of the entire screen, then resize the surface to the image's original dimensions...or you might not. It's highly experimental, but it's yours to play with if you're so inclined!

Pages: [1] 2 3 ... 8