SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 18/06/2016, 07:12 PM   #1
Arturo226
Little Clucker
 
Join Date: Oct 2009
Location: England
Posts: 16
Reputation: 0
Default Pawn Development in macOS

Since I haven't seen a guide anywhere on this forum as to how to set up a development environment for macOS, I figured out that it would be a good idea to share my newly-found knowledge with you guys. So let's get started!

Start off by downloading the following:Setting up Sublime Text 3

After obviously downloading it, place it in your Applications folder and launch it. You should see the program pop up, possibly nagging you every now and then to purchase it. All I can tell you is that if you have $70 to spare, then this is the way to go. Anyway, it would be very nice to have Pawn syntax, function autocompletes and a nice build script in Sublime Text to make our development easier and faster. PackageControl is a great package manager for Sublime, with a lot of handy-dandy tools for the program. To install it, follow the instructions here.

After installing PackageControl, it's time to use it. The package we are interested in is the Pawn syntax package, which contains Pawn syntax and many function autocompletes (even the ones for popular plugins and includes!). In Sublime, go to Tools > Command Palette... (or press Shift+CMD+P from now on), and type in the keyword 'install' in the search bar that should pop up. You should get a first search result of Package Control: Install Package. Select it, and after doing so a list of available packages will appear. Type in the keyword 'pawn', and the package Pawn syntax should be visible. Select that, and it will install right away.

Sublime Text is almost set up, we just need to set up the build script to go with our compiler. Go to Tools > Build System... > New Build System. A new file should appear, with a bare-bones build script that contains a command make. Delete that line and paste in the following:
Code:
{
	"cmd": ["./pawncc", "$file", "-iinclude", "-o$file_path/$file_base_name", "-;+", "-(+", "-d3"],
	"file_regex": "(.*?)[(]([0-9]*)[)]",
	"working_dir": "/Applications/Pawn",
	"selector": "source.pwn"
}
As you might have guessed, our compiler will go in the Applications folder. If you don't like that, you can place it elsewhere, but make sure you change the working_dir in the build script! Save the build script in the directory that initially comes up (Sublime Text 3/Packages/User), and call it Pawn.sublime-build

Setting up the compiler

Now that Sublime is out of the way, we can get to the main bit of this tutorial: the compiler itself! After downloading the Zeex's Pawn Compiler zip package (or after making it from source), you should have three files and a folder include. Place those contents in a folder called Pawn, and move it to the Applications folder (or wherever you like). The compiler itself is the pawncc executable, which is run with the parameters specified in the build script.

However, we still need to provide all the includes in order to gain access to all functions required to write gamemodes and filterscripts. We can get those from the SA-MP Windows Server package that contains PAWNO, and with it the includes. Copy all the files located in pawno/include and move them to the corresponding include folder for our macOS compiler.

And that's it, you're ready to go!
You can enable Pawn syntax by going into View > Syntax and selecting Pawn in Sublime Text 3. If Sublime doesn't automatically select our build system for .pwn files, then you can do so manually by going to Tools > Build System and selecting Pawn. By default, the shortcut to building is CMD+B.

If you have any questions regarding this tutorial, then don't hesitate to ask!

Last edited by Arturo226; 18/04/2017 at 11:36 PM.
Arturo226 is offline   Reply With Quote
Old 09/04/2017, 11:18 AM   #2
Inuro
Big Clucker
 
Inuro's Avatar
 
Join Date: Dec 2013
Posts: 76
Reputation: 11
Default Re: Pawn Development in OS X

My error:
Assertion failed: (*(ptr+1)=='\0'), function readline, file /UsePawn compiler 3.10 Copyright (c) 1997-2006, ITB CompuPhase

rs/Artur/Downloads/pawn-master/source/compiler/sc2.c, line 415.
[Finished in 0.0s with exit code -6]
[cmd: ['./pawncc', '/Users/viotquentin/Desktop/SAMP/gamemodes/roleplay.pwn', '-iinclude', '-o/Users/viotquentin/Desktop/SAMP/gamemodes/roleplay', '-;+', '-(+', '-d3']]
[dir: /Applications/Pawn]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
Inuro is offline   Reply With Quote
Old 18/04/2017, 11:39 PM   #3
Arturo226
Little Clucker
 
Join Date: Oct 2009
Location: England
Posts: 16
Reputation: 0
Default Re: Pawn Development in OS X

Quote:
Originally Posted by Inuro View Post
My error:
Assertion failed: (*(ptr+1)=='\0'), function readline, file /UsePawn compiler 3.10 Copyright (c) 1997-2006, ITB CompuPhase

rs/Artur/Downloads/pawn-master/source/compiler/sc2.c, line 415.
[Finished in 0.0s with exit code -6]
[cmd: ['./pawncc', '/Users/viotquentin/Desktop/SAMP/gamemodes/roleplay.pwn', '-iinclude', '-o/Users/viotquentin/Desktop/SAMP/gamemodes/roleplay', '-;+', '-(+', '-d3']]
[dir: /Applications/Pawn]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
Try downloading the compiled binaries from here (the Darwin release) and see if that helps.
Arturo226 is offline   Reply With Quote
Old 28/06/2019, 04:34 AM   #4
KizZweLL
Little Clucker
 
KizZweLL's Avatar
 
Join Date: Jan 2016
Location: Philippines
Posts: 26
Reputation: 0
Default Re: Pawn Development in OS X

I can't fix this error, can you help me?

[Errno 13] Permission denied
[cmd: ['/Users/stephen/Documents/Server/pawno', '/Volumes/McCodeXe/Server/gamemodes/barron.pwn', '-iinclude', '-o/Volumes/McCodeXe/Server/gamemodes/barron', '-;+', '-(+', '-d3']]
[dir: /Users/stephen/Documents]
[path: /Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
[Finished]
__________________
Sometimes impossible can turn into reality.
KizZweLL is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Setting up a pawn development environment on OSX with IntelliJ Mandrakke Tutorials 2 21/11/2016 03:13 PM
Visual Studio as the development environment for PAWN Arca Scripting Help 7 28/07/2012 09:18 PM
[Tool/Web/Other] PAWN Scanner - Scan PAWN files for information. Slice Tools and Files 10 15/07/2012 08:09 PM
[In Development]Programming Windows with PAWN! Sasino97 Everything and Nothing 70 21/05/2012 06:15 PM
[PAWN] Integrated Development Environment nemesis_567 Scripting Help 12 04/01/2012 12:08 PM


All times are GMT. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.