14.10.2016, 23:21
Developing SA:MP with Webstorm 2016
1. Summary:This tutorial will be going through how to set up a simple build and run server script from the Webstorm 2016 IDE as well as a few set up themes that help separate key words. I personally find Webstorm to be a nicer IDE because it allows you to set up build scripts which will let you automatically RCON or have you generate an API or changelog at the click of a button
2. Why Webstorm?
Webstorm is a lightweight IDE that allows you to install easy edit plugins like VIM. It is similar to sublime text but in my opinion performs a lot better and handles projects much more nicely. You can exclude files and folders so that when searching the entire project you can ignore specific files.
Webstorm allows the use of Gulp and Node development, meaning that you can kick off a node version of your server which, in the right hands allows you to debug and handle server side stuff a bit nicer. Gulp files are used to set off build scripts (The ones I've provided are merely: Build and Run), meaning you can build the AMX or write a script to kick off a changelog formatter or format an API sheet.
3. Setting up the build / run scripts
- Copy and Paste the "build" folder into your existing project or copy the entire folder to start anew
- Right click the "build/GulpFile.js" and select "Show Gulp Tasks"
- Go to File -> Settings -> Editor -> File Types
- In the top section, click on the green plus and input the following:
Name: Pawn
Description: Pawn
Line Comment: //
Block comment start: /*
Block comment end: */
Hex prefix: 0x
Support Paired braces: true
Support paired brackets: true
Support string escapes: true - Add Keyword associations, I typically do the following:
- TAB 1
- #include
- #pragma
TAB 2 - #define
TAB 3 - forward
- new
- public
- return
- stock
TAB 4 - float:
- text:
- Go to Editor -> Colors & Fonts -> Custom and input your own custom colour scheme
When starting a script, it's very important that you edit the GulpFile.js. This is because the current version of the package I've provided doesn't allow an easier and more intuitive way of selecting which file to compile. The edit is as follows:
HTML Code:
var gulp = require('gulp'); var run = require('gulp-run'); gulp.task("build: script", function(){ process.chdir("../pawno/"); return run("pawncc.exe ../gamemodes/[FILENAME].pwn").exec(); }); gulp.task("run: samp-server", function(){ process.chdir("../"); return run("start samp-server.exe").exec(); });
4. Conclusion
The reason I use Webstorm is because I mainly use it for work but it also harbours a lot of nice little features that I personally find handy like being able to split files vertically and horizontally to work on the same file in two places at once. The only issue for me is that you need to pay for a license.
If this has helped in any way, any feedback would be appreciated. It took me less than an hour to get the project together.
5. Download:
Windows: Here