| Blockland Forums > Modification Help |
| Provide Your Custom Scripts for Streamlining Development |
| (1/4) > >> |
| Platypi:
I'm thinking of creating a add-on that helps make add-on development faster and more painless. For instance, I find writing findClientByName() a bit tedious. Given I use this function quite frequently, I have defined the following function to make calling it faster: --- Code: ---function fcbn(%name) { return findClientByName(%name); } --- End code --- Do you guys have similar functions you use to speed up development? If so, include them below. If I package them up, I will give credit (so include you name and BLID in case there's any ambiguity with your forum profile information). I'd host this add-on (thinking I'll just call it Support_DevLibrary or Support_DevLib) on GitHub, through which other developers can submit pull requests. All utilities included would be solely for the use of development, and not to be included as dependencies for finished, publicly released add-ons. And of course, documentation of each function/utility would accompany the add-on. If something like this already exists, please let me know. I've seen libraries like Support_CodeLibrary. But I haven't as of yet come across anything specifically and solely for aiding development. |
| RTBARCHIVE:
Gui positioning helpers (setPosition and setExtent should already exist; come on TGE): --- Code: ---// Get the gui's X coordinate function GuiControl::getLeft(%this) { return getWord(%this.getPosition(), 0); } // Get the gui's Y coordinate function GuiControl::getTop(%this) { return getWord(%this.getPosition(), 1); } // Get the position of the right-side of the GUI element function GuiControl::getRight(%this) { return getWord(%this.getPosition(), 0)+getWord(%this.getExtent(), 0); } // Get the position of the bottom-side of the GUI element function GuiControl::getBottom(%this) { return getWord(%this.getPosition(), 1)+getWord(%this.getExtent(), 1); } // Get the width of the GUI function GuiControl::getWidth(%this) { return getWord(%this.getExtent(), 0); } // Get the height of the GUI function GuiControl::getHeight(%this) { return getWord(%this.getExtent(), 1); } // Set the position of this GUI. Seriously, this should be default for GUI controls. function GuiControl::setPosition(%this, %pos) { %this.resize(getWord(%pos, 0), getWord(%pos, 1), %this.getWidth(), %this.getHeight()); } // Set the extent of this GUI. Seriously, this should be default for GUI controls. function GuiControl::setExtent(%this, %ext) { %this.resize(%this.getLeft(), %this.getTop(), getWord(%ext, 0), getWord(%ext, 1)); } --- End code --- Not much use for these unless you're making a GUI with graphical design, but I'm sure that'll come around again some time in the future for some other purpose |
| Dannu:
Doesn't sound like a good idea to me. Imagine add-ons being dependent on the fcbn function. Then, instead of developers being assed to write out findClientByName, every end-user needs to have an extra add-on in their add-ons folder or have the entire add-on not work for an obscure reason. (I understand that you could add an auto downloader or a more sophisticated error message saying that you need to have Support_Devtools, but that would already put both the developer and the end-user through much more discomfort than necessary currently) What you could do instead is make a module that developers can include in their add-ons. For example: Give out a custom .cs file that developers place in their add-on. Give instructions that at the very beginning of their client.cs/server.cs they add a code piece such as: --- Code: ---if(!$devToolsLoaded) { exec("./path to devtools.cs"); $devToolsLoaded = 1; } --- End code --- |
| Conan:
sounds like a bad way to create dependencies and break mods in the future. if anything this should be limited to code snippets for reference to do basic stuff, like remove a given word from a string of words |
| Electrk..:
--- Quote from: Conan on January 07, 2018, 05:19:56 AM ---sounds like a bad way to create dependencies and break mods in the future. if anything this should be limited to code snippets for reference to do basic stuff, like remove a given word from a string of words --- End quote --- removeWord() |
| Navigation |
| Message Index |
| Next page |