Minecraft-Console-Client
Minecraft-Console-Client copied to clipboard
[Idea] Debugging cs scripts
Prerequisites
- [X] I have read and understood the user manual
- [X] I made sure I am running the latest development build
- [X] I tried to look for similar feature requests before opening a new one
Console Client Version
Latest
Describe your problem
Make mcc give the line and column of the error when the compiler fails please :) It would be a great feature to save time...
Suggest a possible solution
^
Attach screenshot here (If applicable)
No response
Minecraft Version
All
Device
Desktop
Operating System
Linux
Yes, would be very nice sometimes, so maybe someone could include it in the CSharpRunner class and so on. I don't really know anything about it, but maybe this link could help? 'https://docs.microsoft.com/de-de/dotnet/api/system.codedom.compiler.compilererror?view=dotnet-plat-ext-6.0'
Edit:
Maybe just changing result.Errors[0].ErrorText in Line 120 to $"{result.Errors[0].Line};{result. Errors[0].Column}: {result.Errors[0].ErrorText}" would be enough?
Edit 2:
I also think, MCC often doesn't accept scripts even if their is just a warning like 'XY is declared, but it's value is never used' in them. Maybe result.Errors[0].IsWarning could also be used and displayed another way instead of canceling the script.
Hello,
I would highly recommend using an actual IDE like Visual Studio for developing a ChatBot or any advanced script.
You can do so by downloading the whole project and opening it in your IDE, then adding the ChatBot along with the others.
Once done, you can auto-load it on login by adding a line in McClient.cs:
https://github.com/MCCTeam/Minecraft-Console-Client/blob/25248025c21cfd1c11c86deb90c029080fdc937e/MinecraftClient/McClient.cs#L217-L218
If you do this, you'll benefit from all the debugging capabilities of your IDE.
Once done developing your ChatBot, you can wrap it into a C# MCC script and load it conventiently with /script.
Hello,
I would highly recommend using an actual IDE like Visual Studio for developing a ChatBot or any advanced script. You can do so by downloading the whole project and opening it in your IDE, then adding the ChatBot along with the others. Once done, you can auto-load it on login by adding a line in
McClient.cs:https://github.com/MCCTeam/Minecraft-Console-Client/blob/25248025c21cfd1c11c86deb90c029080fdc937e/MinecraftClient/McClient.cs#L217-L218
If you do this, you'll benefit from all the debugging capabilities of your IDE. Once done developing your ChatBot, you can wrap it into a C# MCC script and load it conventiently with
/script.
Of cause using an IDE for advanced scripting is highly recommended, but I think it's worth making such a little change to make little changes in the production/runtime environment on servers etc. a whole lot easier. It would also help at debugging errors that only occur sometimes and weren't showing up in development because the environment the bot is running in can change for example if you share chatbots with others using mcc or if the computer you're developing your scripts on has another os and so on than the conputer or server it's running on in production/final use case.
This means it would be very nice if you could reconsider including more specific debugging output into MCC. Thank you very much for reading.
Of course any improvement is welcome! I just don't really have enough time to work on this myself. Feel free to send a PR 👍
Implemented in 78f9c3580009c137ec3896173dd4799dfd3a7110
I didn't even realize i implemented a feature request 🤣
I didn't even realize i implemented a feature request 🤣
I think I've mentioned it once to you. Maybe you forgot it xD