[Tutorial] PAWN for SA-MP in Sublime Text 2
#1

PAWN for Sublime Text
http://www.sublimetext.com/

EDIT: Southclaw's work is more complete, I suggest using that.

Description
This adds syntax highlighter for pawn language (.pwn and .inc files) and samp function and define auto completion.

Files
Download the neccessarry files. Setup
  1. Download sublime text 2 (skip this step if you already have it)
  2. Open user package folder by going to Sublime text 2 -> Preferences -> Browse Packages... -> User (see images 1 and 2)
  3. Drop the just downloaded files into User folder.
  4. Restart Sublime Text 2.
  5. In case it doesnt automatically detect .pwn files, go to Sublime text 2 -> View - Syntax - Pawn (see image 3)
Image 1:

Image 2:

Image 3:



Compiling
This was written by Conroy (source).

Open up Sublime Text 2 and go to Tools -> Build System -> New Build System...

Use the following build code:
Код:
{
	"cmd": ["${project_path:${folder}}/pawno/pawncc.exe", "$file_name", "-;+", "-v2", "-d3", "-\\)+"],
	"working_dir": "${file_path}",
	"file_regex": "^([^\\.]+\\.pwn)\\((\\d+)\\)() : (.*)$",
	"variants": [
		{
			"cmd": ["${project_path:${folder}}/pawno/pawncc.exe", "$file_name", "-;+", "-v2", "-d3", "-\\)+", "-l"],
			"working_dir": "${file_path}",
			"name": "Preprocessed output"
		},
		{
			"cmd": ["${project_path:${folder}}/pawno/pawncc.exe", "$file_name", "-;+", "-v2", "-d3", "-\\)+", "-a"],
			"working_dir": "${file_path}",
			"name": "P-code output"
		}
	]
}
Build code provided by user Misuir. (source, github)


Of course you need to replace the path

Save this file and close Sublime Text 2

Now navigate to AppData/Roaming/Sublime Text 2/Packages/User

Open up the .sublime-keymap file based on your operating system

Enter the following (this example is for the Windows file):
Код:
[
	{ "keys": ["f5"], "command": "build" }
]
You can change f5 to another key if you wish

Save and reopen Sublime Text 2

Now go to Tools -> Build System

Click on the name of the build you created

You can now compile your scripts by pressing the button you assigned, enjoy...

Additional Notes
If you witness any bugs, please let me know by replying in this topic.
Reply
#2

I don't understand.. where do I put all these 3 files? :L
Reply
#3

Sweet editor but $70 is too much. I would rather stick with Notepad++.
Reply
#4

I used Sublime Text, but i'm back to Notepad++, Sublime Text is good but not so good as Notepad++, i prefer Notepad++
Reply
#5

Quote:
Originally Posted by PaulDinam
Посмотреть сообщение
I don't understand.. where do I put all these 3 files? :L
Sublime text 2 -> Preferences -> Browse Packages... -> User

Quote:
Originally Posted by StreetGT
Посмотреть сообщение
Sublime Text is good but not so good as Notepad++
Then you havent used sublime text for its full potential. Read some of the features it has, for example, multiple selections, which I use quite often.
Reply
#6

The word 'format' is in two colors. Is there a function that show me the arguments when i typed the whole function? Like SendClientMessage(playerid, color, text[])
Reply
#7

I like it very much! Im using now this to code
Reply
#8

I have a problem, when i push F5 i have this message:

Error trying to parse build system: invalid escape in c:\users\HP\AppData\Roaming\Sublime Text 2\Packages\User\pawn.sublime-build:3:10

I have the version 2.01

Content of pawn.sublime-build
Quote:

{
"cmd": ["pawncc.exe", "-i includes", "$file", "-;+"],
"path": "C:\Users\HP\Desktop\pawno\pawno"
}

The path contain pawncc.exe


EDIT: Problem solve by adding second \ to te path:
Quote:

{
"cmd": ["pawncc.exe", "-i includes", "$file", "-;+"],
"path": "C:\\Users\\HP\\Desktop\\pawno\\pawno"
}

EDIT 2:
Quote:

[Decode error - output not utf-8]
[cmd: [u'pawncc.exe', u'-i includes', u'C:\\Users\\HP\\Desktop\\pawno\\gamemodes\\test.p wn', u'-;+']]
[dir: C:\Users\HP\Desktop\pawno\gamemodes]
[path: C:\Users\HP\Desktop\pawno\pawno]
[Finished]

I can write anything, it always show those line.
Reply
#9

Help plz
Reply
#10

"Create3DTextLabels();" This function half colored. ( Colored white until D3TextLabels(); )
"format" half colored.
Reply
#11

How can i get the error when i compile ?
Reply
#12

uppppp
Reply
#13

Upp ?
Reply
#14

can anyone do this on teamview for me?
Reply
#15

when i press pawn it take a long time how do i fix that
Reply
#16

Its because of all youre includes i think
Reply
#17

My problem is solved, PM me if you want the solution
Reply
#18

First of all, sorry for the late response.

Quote:
Originally Posted by dipsnark
View Post
The word 'format' is in two colors.
Quote:
Originally Posted by Micius
View Post
"Create3DTextLabels();" This function half colored. ( Colored white until D3TextLabels(); )
"format" half colored.
I updated the Pawn.tmLanguage file, redownload it.


Quote:
Originally Posted by dipsnark
View Post
Is there a function that show me the arguments when i typed the whole function? Like SendClientMessage(playerid, color, text[])
Make sure you have the Pawn.sublime-completions file. It should show all the arguments when pressing tab(default).


Quote:
Originally Posted by Garwan50
View Post
My problem is solved, PM me if you want the solution
I, as well as others, would appreciate if you would post the solution here. This is a community forum after all.
Reply
#19

I followed the tutorial exactly but when I go to Syntax, "Pawn" isn't there.
Reply
#20

Since a long time ago, I was always using eclipse based ide's (eclipse -> aptana studio -> netbeans) for work. They were awesome, and did everything I needed. For pawn I used notepad++ and I was happy. I've heard stories about emacs and vim, that if handled correctly they are even better - but I didn't have time to learn about them. Now, recently my boss mentioned something about moving from full-blown IDE to Sublime and being pleasantly surprised. At first I've frowned at the sight of price tag, but it seems that it has open-ended evaluation period.

I've been using it for 2 days - and I know I won't be going back. It's fast, it's easy to learn, and it's freaking powerful. Just by using single feature (multiple text edition) I'm saving tons of time.

I wasn't that excited since moving from notepad to aptana, or changing windows 98 to XP.

AWE-SOME
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)