Popular Post 50p Posted July 27, 2014 Popular Post Share Posted July 27, 2014 INTRODUCTION Many of you know MTA:Script Editor and that I've stopped working on it. The main reason was the syntax highlighter has many bugs that annoy me and others. Due to the fact I stopped developing it I decided to find a better solution. At first I wanted to make an extension for Eclipse but I thought that's too much to download for everyone just to script for MTA. Then I wanted to write an extension for Visual Studio but again, too much to download. I heard of Sublime Text which is small in download size but powerful at the same time. So I downloaded it and immediately started researching how to make packages for it. Because I made an application for MTA:SE to fetch all the MTA functions and save them in an SQLite database, I decided to reuse it and generate files for Sublime Text instead. So, this is what I came up with over the weekend. INSTALLATION Make sure you have Sublime Text installed. It works with both, Sublime Text 2 and 3 (thanks Goonz for confirming it works with Sublime Text 2). Download the 50pMTAEditor.zip from the link below. Extract the .zip to C:\Users\\AppData\Roaming\Sublime Text 3\Packages\User\50pMTAEditor\ Run Sublime Text 3 and create a new file (File -> New) - this is only necessary so that you can see if it works Select the syntax highlighter (View -> Syntax -> Lua (MTA:SA) ) Select color scheme which has colors of MTA function names. Red for client-side, Orange for server-side and Blue for shared functions (Preferences -> Color Scheme -> User -> 50pMTAEditor -> Monokai-MTA-Edit) And you're ready to edit .lua files and have all MTA functions highlighted and auto-completion too. DOWNLOAD https://dl.dropboxusercontent.com/u/437 ... Editor.zip (only 512 KB) (MD5: CA7EA2AEE682B79BBCA01A34AC39C9FD) KNOWN ISSUES Auto-complete window that shows up when you're typing function names will show both server and client functions because Sublime Text doesn't know which files should be showing which functions. It doesn't matter for many functions because the parameters are the same, but for some functions it does matter, like outputChatBox has "visibleTo" parameter which is not present in client-side variant. In client-side files you will also see server-side functions (eg. getPlayerAccount). 5 Link to comment
Goonz Posted July 27, 2014 Share Posted July 27, 2014 Awesome work, I've just tested it on Sublime Text 2 and it works too. ( Screenshot ) Link to comment
50p Posted July 27, 2014 Author Share Posted July 27, 2014 Thanks for testing, enjoy! Link to comment
lopezloo Posted July 27, 2014 Share Posted July 27, 2014 Just amazing. Thanks so much. Link to comment
qaisjp Posted July 27, 2014 Share Posted July 27, 2014 Awesome work, but you really should use the package control instead of a manual install. https://sublime.wbond.net/ Link to comment
kevenvz Posted July 27, 2014 Share Posted July 27, 2014 Thanks for this awesome release 50p, I liked sublime text better then ur scrioting editor cause I use it for all the languages I open, edit and create! Link to comment
50p Posted July 27, 2014 Author Share Posted July 27, 2014 Awesome work, but you really should use the package control instead of a manual install. https://sublime.wbond.net/ I will in the future but due to rush I thought it's not a big deal to install manually. doesn't work for me Give more details please. Link to comment
Controlled Posted July 28, 2014 Share Posted July 28, 2014 Loving this so far, will you keep it updated with future versions of MTA? Also just a sublime question, instead of hitting enter and having the whole Syntax of the function pop up, is there a way to just autocomplete? Like I'm typing "addCo" have it autocomplete to addCommandHandler? Thanks again! Link to comment
50p Posted July 28, 2014 Author Share Posted July 28, 2014 @Controlled, Yes, you can hit TAB and it will auto-complete function name and in addition function parameter names, so you know what arguments function is expecting. I will keep it up to date but I don't know interval on how often I will run my bot. I'm basically running an application which gets all the function names from the wiki and generates the content I need for Sublime Text. The problem is it has to connect to every function page on the wiki to get all the details, no matter if I already have that function in the package or not. So, that's a killer (bandwidth-wise) for wiki to get requests from my bot for all wiki pages (that's almost 1500 functions, client and server only functions as well as shared functions). MTA team doesn't add new functions every day so that's fine, I can update it from time to time. Thanks for the comments and questions so far. I'm glad you're all liking it. Questions and suggestions are welcome. Link to comment
John Smith Posted July 28, 2014 Share Posted July 28, 2014 doesn't work for me Give more details please. i installed sublime text 3 and when i went to appdata folder etc there wasnt 50p folder so i made one with name just like u said in tutorial and extracted zip in that folder but under syntax theres no choice of mta lua Link to comment
50p Posted July 28, 2014 Author Share Posted July 28, 2014 @John Smith If you have WinRAR installed then you can put the .zip in C:\Users\\AppData\Roaming\Sublime Text 3\Packages\User\ folder and right-click the .zip and choose "Extract to 50pMTAEditor\" then the folder will be created and all the files from .zip file extracted to it. I didn't know it can be so difficult for some people, so in the future I'll have to use Package Control, which is useful plugin and allows easy installation without need to do it manually. Link to comment
John Smith Posted July 28, 2014 Share Posted July 28, 2014 @John SmithIf you have WinRAR installed then you can put the .zip in C:\Users\\AppData\Roaming\Sublime Text 3\Packages\User\ folder and right-click the .zip and choose "Extract to 50pMTAEditor\" then the folder will be created and all the files from .zip file extracted to it. I didn't know it can be so difficult for some people, so in the future I'll have to use Package Control, which is useful plugin and allows easy installation without need to do it manually. i dont know how but i must have missed the "extract the zip" part in your post,sorry. nice job with this thing btw Link to comment
RottenFlesh Posted July 28, 2014 Share Posted July 28, 2014 Wow this is awesome! thank you very much! BTW: Sublime Rulez! ;D Link to comment
50p Posted July 29, 2014 Author Share Posted July 29, 2014 Just wanted to let you guys know, I'm working on a little plugin, the screenshot should say it all: https://dl.dropboxusercontent.com/u/437 ... plugin.png If you create a .lua file anywhere in a resource folder (I'm using SideBarEnhancement plugin, I recommend it but it doesn't trigger event when file is created) and when you try to save it, my plugin will check if the file already exists inside the resource meta.xml if not then you will get this message box asking you if you want to add it. The most important thing is that if the file name starts with "c_" then file will be added as client-side script, otherwise server-side; no the file name doesn't have to start with "s_" but for organization purposes I recommend you follow this naming convention. At the moment it's exclusive to Sublime Text 3, I will try to port it to Sublime Text 2. Also, unfortunately Sublime Text doesn't trigger an event when file is renamed so I cannot update meta.xml when you rename a file. I'll will have to create a service or a hidden app that will be ran when Sublime Text starts and it will do that for me. Don't ask for release date, I will release it soon, very soon. Link to comment
RottenFlesh Posted July 30, 2014 Share Posted July 30, 2014 That would be really cool! I'll be waiting for the release! Link to comment
lopezloo Posted July 31, 2014 Share Posted July 31, 2014 Just wanted to let you guys know, I'm working on a little plugin, the screenshot should say it all: Good idea but maybe can you add detection by folder name too? For example if script is in .../client/main.lua plugin will detect it as client-side script. Link to comment
50p Posted July 31, 2014 Author Share Posted July 31, 2014 Just wanted to let you guys know, I'm working on a little plugin, the screenshot should say it all: Good idea but maybe can you add detection by folder name too? For example if script is in .../client/main.lua plugin will detect it as client-side script. I will do that. It's good idea since I put my client scripts in "client" sub-folder too. Just a little update on the progress. I managed to build a plugin that will restart resource. I'll have to make it customizable so users can bind keys to run the plugin (I think the default will be set to Ctrl+B). I might change it so that resource (of which file you're editing) will restart when you save the file. But there is a huge problem.. To make it work, users will have to download and put my resource in their resources folder as well as run it and give it admin rights or at least allow it to call restartResource and startResource functions because that resource will allow Sublime Text to restart resources that users will be editing. I hope it makes sense. If it doesn't, just ask and I'll explain in details how it works. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now