Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: jedione on April 16, 2019, 07:03:14 AM

Title: module location?
Post by: jedione on April 16, 2019, 07:03:14 AM
any one know ,,is it possible to call modules like "fade" from within a layout

i could of sworn iv seen it before,


 
Title: Re: module location?
Post by: keilmillerjr on April 16, 2019, 11:16:08 AM
Code: [Select]
fe.load_module("fade");
Title: Re: module location?
Post by: jedione on April 16, 2019, 01:28:41 PM
na,, sorry i ment,  have the fade module in a file in your layout,  and not in the modules folder.......
Title: Re: module location?
Post by: keilmillerjr on April 16, 2019, 02:28:05 PM
https://github.com/mickelson/attract/blob/master/Layouts.md#do_nut
Title: Re: module location?
Post by: jedione on April 17, 2019, 07:22:11 AM
https://github.com/mickelson/attract/blob/master/Layouts.md#do_nut

#### `fe.load_module()` ####
fe.load_module( name )
Loads a module (a "library" Squirrel script).

Parameters:

name - the name of the library module to load. This should correspond to a script file in the "modules" subdirectory of your Attract-Mode configuration (without the file extension). :'(
Title: Re: module location?
Post by: keilmillerjr on April 17, 2019, 01:46:31 PM
Im really confused about what you are confused about.
Title: Re: module location?
Post by: rand0m on April 17, 2019, 02:33:18 PM
Im really confused about what you are confused about.

I think Jedione wants the module code as a part of layout.nut (not external) and he is wondering how to call a module (use its function) if its in layout.nut. Script won't help if I am correct in my assumption since they are also external.
Title: Re: module location?
Post by: rand0m on April 17, 2019, 02:34:22 PM
Im really confused about what you are confused about.

I think Jedione wants the module code as a part of layout.nut (not external) and he is wondering how to call a module (use its function) if its coded into layout.nut. Script won't help if I am correct in my assumption since they are also external.
Title: Re: module location?
Post by: keilmillerjr on April 17, 2019, 02:51:21 PM
Im really confused about what you are confused about.

I think Jedione wants the module code as a part of layout.nut (not external) and he is wondering how to call a module (use its function) if its in layout.nut. Script won't help if I am correct in my assumption since they are also external.

Not sure why you would want to duplicate code. You could copy and paste it into your layout.nut. Call classes and functions like normal. Official squirrel docs and electric imp is good resource. Keep in mind electric imp implementation has slight differences between official version, so cross reference docs.
Title: Re: module location?
Post by: dukpoki on April 17, 2019, 11:38:43 PM
Code: [Select]
// Modules
fe.do_nut(fe.script_dir + "modules/fade.nut" );

If you have a subfolder "modules" in your layout folder and put the module in question in that subfolder.  Or you can put the modules in the main layout folder and just delete the "modules/" part.
Title: Re: module location?
Post by: jedione on April 18, 2019, 06:59:41 AM
Code: [Select]
// Modules
fe.do_nut(fe.script_dir + "modules/fade.nut" );

If you have a subfolder "modules" in your layout folder and put the module in question in that subfolder.  Or you can put the modules in the main layout folder and just delete the "modules/" part.

ahh yes,, this is what i want!!!  sorry for the confushion.   

and the reason, you ask ...is because some potential themes i have use a modified module
and i only need it for that theme, so it makes sence to me at least to keep it with theme assets..thats all.