LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

"Assigned to 'SMILE' button" does what exactly?

Root / Programming Questions / [.]

SquareFingersCreated:
Is there a difference between a program launched from by Direct mode RUN command, a program launched from the browser, and a program launched by the SMILE button? If so, what are the differences?

A program from the SMILE button can LOAD stuff from other projects.

A program launched by the SMILE button does not overwrite your editing environment. Your code will still show up in exactly the same slot it was in before calling the SMILE program. A program launched with RUN or BROWSE will set up the environment (the slots) the way it needs, but when it's done it doesn't reset it. This is why the SMILE button is nice; you can run editor programs and whatever without having to switch back and forth between the editor program code and your own code. Programs that load files from the "local" project won't be able to load these files when running with direct mode if you're not in the appropriate project. However, when using Browse, it temporarily sets the project to the browsed project so that everything runs appropriately. Confusingly, when you run programs from Browse, the environment persists in the editor but NOT the project. When you go back to the editor, you usually end up with being in your own personal project, but with files loaded from another project. Bleh.

Great. So there are some features which are useful, but will throw an error if they are not used in particular circumstances. So, is there a way to tell, while a program is running, if trying this feature will work or will end the program with an error?

Yeah, in fact many programs take care of this situation. The only thing that'll fail because of these features is loading a file, since we usually load files relative to the current project. When loading a file, you can check the result (I don't remember how, sorry), which will tell you if the file wasn't loaded correctly. This is almost 100% due to an incorrect project (because you loaded it in direct mode), so games like "Yuki No Reindeer" will actually tell you "You're probably in the wrong project; run in Browse mode or change projects". So:
  • SMILE programs will run with no problems. Slot and project environment are setup and taken down appropriately for each run
  • Browsing programs will run with no problems. Slot and project environment is setup, but slots are left after exiting
  • Direct mode does not set the project environment, so may produce file loading errors.

The thing I'm trying to do is load files from any or all of the projects. It seems the only way to do this is to include the project name and / character at the beginning of the filename parameter of the LOAD command or function. If I do that in a SMILE-button-launched environment, it works. Otherwise, I get Illegal function call error and the program ends. So, my options appear to be: - Do not use this nifty feature to add a nice detail to my program (nothing necessary, but it is a valuable addition) - Use this nifty feature, and my program can ONLY be run by SMILE-button - While the program is running, ask the user if this instance was started with the SMILE-button, trust that the answer is right, and use or not use the feature accordingly. None of these options is great.

Oh, the / doesn't work with Browse? Hm, maybe the / is a hack they used just so that they could get their SmileTool to work. Yeah, I see the issue now. If you're trying to load things across projects and / in a load gives an illegal function call, that's not going to work too well. Bluesun's sys file copier uses FILES "SYS",FILELIST$ to get all the files from the SYS project, which he can then load by prepending the filetype. Stuff like LOAD("TXT:SYS/THEFILE"), or LOAD("DAT:SYS/OTHERFILES"). I'm not entirely sure how it works because I haven't tried it myself, but maybe you could look over his code and find a solution. His code works in Browse mode, but I'm not sure if this will work for projects other than SYS (and I don't want to assume anything).

PROJECT OUT PJ$ or PJ$=PROJECT() gives the active project name. One of the PRG system variables is empty or something when running a tool slot IIRC. I don't remember but bluesun knows all of this (but he's been out for a while).