Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug function for script #21

Open
shadow2560 opened this issue Jun 5, 2020 · 4 comments
Open

Debug function for script #21

shadow2560 opened this issue Jun 5, 2020 · 4 comments

Comments

@shadow2560
Copy link

Hi,

I have a feature to suggest for the Tegra scripts function, could you add an instruction that write screen output to a text file (errors included) (the function should not change what is displayed on the screen, the text file writing should be in addition). An example for a script named "foo.te":

enableDebug("foo.te.log") /* Debug activated in the file "foo.te.log", if it's possible the param could be optional, without the param set the script will print the debug output to a file named "script_file_name.log" and placed beside the script. */
printf("Hello world") /* Display "Hello world" to the screen and display something like "Displaying: Hello world\n" on the debug file. */
disableDebug() /* close the previously opened enableDebug()
exit()

An other example for errors:

enableDebug("foo.te.log")
Printf("Hello world") /* Display the error on the screen and write something like "Error: $error_text" in the debug file and call the disableDebug() function cause this error force script termination */

I ask this function cause I'm blind (not totaly but I can't read what is displayed on the screen) and it's realy difficult to debug my Tegra scripts without any infos displayed or text of the errors encountered.

An other suggestion, the possibility to call an other "foo2.te" script in the "foo.te" script could be a nice addition but you have probably already thought of it and this thing is probably more difficult to implement but if you do it, a nice new function to add could be a gotoEOF() function that end the script called and continue the main script (if called in the main script, call the exit() function or display an error and exit the script).

Thanks in advance, I realy like this script function.

@suchmememanyskill
Copy link
Owner

Hi,

First off, this sounds like quite a nice idea (implementing it shouldn't be terribly difficult). I from time to time also have issues debugging my scripts, but, i can do by with the line number displayed in the error message (or modifying TE itself).

Second, the ability to call multiple scripts would be a bit of a pain to implement. Sounds like a cool idea, just, imo, not that useful.

I'll see when i will implement this, Time is not on my side currently.

sidenote: If you want i could help with scripts in my discord

@shadow2560
Copy link
Author

Thanks for the quick reply.

From my side I will look into the sources of TegraExplorer, maybe I could implement debug function described before by myself (surely I'll made a pull request if I manage to do it).

For the possibility to call others scripts in a script, it was just a very less important suggestion, like you say it's not so important and it's a difficult function to implement.

An other cool thing could be the possibility to write an output to a file like in linux shell for example with '>"filepath"' or '>>"filepath"' after the commande, at least with the printf() function this could be intresting. The possibility to read from a file could also be usful ('<"filepath"') but I think it's mutch more difficult to implement that than the write possibility.

I have some other questions to ask to you but I'll ask it to you on Discord.

@suchmememanyskill
Copy link
Owner

hi, even though this is a very old issue, TegraScript has been fully rewritten and has a much better error reporter, telling you where the error was, and what the actual error was other than "hi i failed".

@shadow2560
Copy link
Author

The problem is that I'm blind and I can't see what is displayed to the screen, the better way to debug for me was to redirect the text errors (or print results) to a file on the SD.

I continue to follow your project with attention, I realy like this project and I have created my tegrascript to restaure the console with the ChoiDuJour and EmmcHaccGen method witch is very usful to unbrick consoles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants