SA-MP Forums Archive
[Tutorial] PAWN for SA-MP in Sublime Text 2 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] PAWN for SA-MP in Sublime Text 2 (/showthread.php?tid=445985)

Pages: 1 2


PAWN for SA-MP in Sublime Text 2 - Macluawn - 23.06.2013

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.


Re: PAWN for SA-MP in Sublime Text 2 - PaulDinam - 24.06.2013

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


Re: PAWN for SA-MP in Sublime Text 2 - Cameryn - 24.06.2013

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


Re: PAWN for SA-MP in Sublime Text 2 - StreetGT - 24.06.2013

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


Re: PAWN for SA-MP in Sublime Text 2 - Macluawn - 24.06.2013

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.


Re: PAWN for SA-MP in Sublime Text 2 - dipsnark - 23.07.2013

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[])


Re: PAWN for SA-MP in Sublime Text 2 - Aprezt - 23.07.2013

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


Re : PAWN for SA-MP in Sublime Text 2 - Garwan50 - 24.07.2013

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.


Re : PAWN for SA-MP in Sublime Text 2 - Garwan50 - 24.07.2013

Help plz


Re: PAWN for SA-MP in Sublime Text 2 - Micius - 24.07.2013

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


Re : PAWN for SA-MP in Sublime Text 2 - Garwan50 - 25.07.2013

How can i get the error when i compile ?


Re : PAWN for SA-MP in Sublime Text 2 - Garwan50 - 28.07.2013

uppppp


Re : PAWN for SA-MP in Sublime Text 2 - Garwan50 - 30.07.2013

Upp ?


Re: PAWN for SA-MP in Sublime Text 2 - JusstinRoller - 30.07.2013

can anyone do this on teamview for me?


Re: PAWN for SA-MP in Sublime Text 2 - JusstinRoller - 30.07.2013

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


Re : PAWN for SA-MP in Sublime Text 2 - Garwan50 - 30.07.2013

Its because of all youre includes i think


Re : PAWN for SA-MP in Sublime Text 2 - Garwan50 - 30.07.2013

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


Re: PAWN for SA-MP in Sublime Text 2 - Macluawn - 30.07.2013

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.


Re: PAWN for SA-MP in Sublime Text 2 - Binx - 31.07.2013

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


Re: PAWN for SA-MP in Sublime Text 2 - Misiur - 09.10.2013

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