Are there any debugging tools or methods available for Oxide JS plugins?
I can use `print()` to output to an rcon console (Rusty), but I was hoping for a more elaborate way to debug my code. JavaScript debugging/testing is a daily job for me in a browser, but I'm not certain how Oxide would allow me to "dump" values and other useful data about the code I create.
I found the JustDecompile tool to find out the Rust API underneath Oxide, but that's about it.
Also: what global variables are available inside the JS API? As I can't "dump" anything I can't seem to find out what I can and can't use when creating a plugin. Some codes use a global `rust`, but for me that global is `undefined/`null`.
Also, some of the examples are missing on the Oxide API Docs site, e.g. chat and console commands examples (only the C# equivalents are there). When are the docs updated?
Is there a way to mock events in the Oxide API? E.g. create a fake player and kill it with certain `hitInfo` data (to trigger `OnEntityDeath`)? Or simulate server init after the server has really done initializations?
My day-job includes JavaScript web development, but working with an invisible API is a bit painful to do.
JavaScript development, debugging and testing
Discussion in 'Rust Development' started by ojrask, Aug 6, 2015.
-
Oxide is open source, nothing invisible there.
https://github.com/OxideMod/Oxide -
Reading source code in a strange language is not that helpful regarding API access. Sorry if I sounded bashy with that "invisible" statement. Let me elaborate about that part:
The current API documentation is heavily biased towards C#, including missing examples for other languages and examples on how to do things differently between languages. This is understandable though, as some of the supported languages are new I presume. This leads me to dumping variables and poking around to find what I need.
With some more searching I found that C# plugins don't even have the global `rust` available, but it instead is a helper global for JS, Lua and Python. Need to test some more. I wonder how my plugin didn't have it defined. I presume somehow "everything" under the C# namespace `Oxide.Game.Rust` is under the global helper `rust`?
The documentation is open source too it seems. I'll try getting some done with JavaScript in case I can get on my feet with this.
-
Wulf Community Admin
The `rust` helper is there just to make things easier for the languages that aren't able to access functions as easily. There aren't as many JavaScript examples, as Oxide has primarily been Lua in the start, with C# support being added in Oxide 2. -
Okay. I tried out and seemed to work fine now. Is there a difference in calling `rust.XYZ` from inside an Oxide hook method and a custom logic method?
-
Wulf Community Admin
Not that I am aware of. -
Made a pull request on some JavaScript examples in the Docs repo over at Github. How soon can contributors expect their changes to go live if they're deemed as OK?
-
Wulf Community Admin
Waiting for the JS guy to review.
-
Yay!

Is this forum section okay for tutorials and such in case I have the time to create some later on? -
Wulf Community Admin
Yup, it's fine for now.
-
Yeah
