SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Tutorials (https://forum.sa-mp.com/forumdisplay.php?f=70)
-   -   [Tutorial] PAWN for SA-MP in Notepad++ (https://forum.sa-mp.com/showthread.php?t=174046)

Slice 04/09/2010 03:20 PM

PAWN for SA-MP in Notepad++
 
Hey,
I made my own Notepad++ language/API for SA-MP scripting, follow these steps and you can have it too!
Here's an example on what it looks like:
http://spelsajten.net/autocomplete.gif

Screenshot!

For those who aren't familiar with Notepad++, you can read about it & download here: http://notepad-plus-plus.org/

If you want Notepad++ to show every single word in the current document, you can select "Word completion". That might get annoying with large scripts, however.

To get the syntax highlight working, you will need to download my custom userDefineLang.xml then place it in your Notepad++ AppData folder (see below).

Now, type in %appdata%\Notepad++ in your Explorer (or in Run).
http://spelsajten.net/step-1_1.png
You should see a folder with a couple files (config.xml, contextMenu.xml, shortcuts.xml, stylers.xml).

NOTE: If you have a file called userDefineLang.xml that you want to keep, you will have to merge those files manually.

Copy the downloaded userDefineLang.xml to the folder you're in (it should look something like this).

After that, you need to associate Notepad++ with PAWN files, see below.
http://spelsajten.net/step-3.png
Additionally, you can put .inc there if you want to.

Auto-complete
You will need an API file for the auto-completion.

Download PAWN.xml (right click -> save link/target) and put it in the "APIs" folder; this, however, is not located in your AppData. It's in the program's main folder.
http://spelsajten.net/step-a.png

It should look somewhat like this:
http://spelsajten.net/step-b.png

Ctrl + Space will pop up the auto-complete, and Ctrl + Shift + Space will show the function arguments.
You can, however, make this happen automatically by changing your settings, see below:
http://spelsajten.net/settings-1.png
Click that and find this tab:
http://spelsajten.net/settings-2.png
If you want to see the auto-complete instantly, put "From the 1 th character".

Compiling
For this to work, you will need a plugin called NppExec. If you already have it, skip this step.
http://spelsajten.net/step-4.png
If you don't have the Plugin Manager, download the latest copy of Notepad++.

Check NppExec and click Install; restart Notepad++ when prompted to.

http://spelsajten.net/step-6.png
Put this code in the window that pops up:

Put npp_save on the first line if you want to save the file before compiling automatically (lazy motherfucker..).
Code:

cd $(CURRENT_DIRECTORY)
"C:\Program Files (x86)\PAWN Compiler\pawncc.exe" "$(FILE_NAME)" -; -(

NOTE: Replace the path to match your PAWN compiler folder; also make sure you have an "include" folder in there with the latest SA-MP include files.

http://spelsajten.net/step-7.png
http://spelsajten.net/step-8.png
Now it should try compiling whatever document you have open. If you see any output from the PAWN compiler, then it's looking good so far.

http://spelsajten.net/step-10.png
Optionally, check this to slim down the output in the command window.


Now you will probably want to assign a hotkey to the compile script.

Open up the NppExec settings.
http://spelsajten.net/step-11.png

Select "PAWN Compiler" from the list, click "Add/Modify", then click "OK".
http://spelsajten.net/step-12.png

Restart Notepad++.

Open up the shortcut mapper.
http://spelsajten.net/step-13.png

Find "PAWN Compiler" under "Plugin commands"; double click it.

http://spelsajten.net/step-14.png

Select a suitable key (combination) then click "OK" and click "Close" on the shortcut mapper.

WillyP 04/09/2010 03:25 PM

Re: PAWN for SA-MP in Notepad++
 
love the auto complete!

Hiddos 04/09/2010 04:38 PM

Re: PAWN for SA-MP in Notepad++
 
Lemme try this, notepad is one of the good things that microsoft created.

Calgon 04/09/2010 04:44 PM

Re: PAWN for SA-MP in Notepad++
 
Quote:

Originally Posted by Hiddos (Post 824115)
Lemme try this, notepad is one of the good things that microsoft created.

This is for Notepad++, not Microsoft Notepad...

Hiddos 04/09/2010 04:46 PM

Re: PAWN for SA-MP in Notepad++
 
Quote:

Originally Posted by Calgon (Post 824119)
This is for Notepad++, not Microsoft Notepad...

Damn I failed. Well they got kinda the base idea from it (/me runs)

woot 04/09/2010 06:02 PM

Re: PAWN for SA-MP in Notepad++
 
Nice, thank you! :)

General Abe 04/09/2010 06:06 PM

Re: PAWN for SA-MP in Notepad++
 
This is epic. Using it right now... being able to keep track of loose brackets/what ones you're working within has to be the best thing since sliced bread.

joemomma53 04/09/2010 10:21 PM

Re: PAWN for SA-MP in Notepad++
 
This is great, nice job

gamer931215 04/09/2010 11:48 PM

Re: PAWN for SA-MP in Notepad++
 
VERY nice tutorial, also like the part that it will give u a list with options (when as example at that screenshot it will give a list of dialog styles already instead of searching such things at the wiki). Il give it a try

Edit: again... nice tutorial! Couldnt done it without the screenshots, but got it working, thank you very much for sharing this :) !

MrDeath537 05/09/2010 12:13 AM

Re: PAWN for SA-MP in Notepad++
 
Really very nice. Good job!


All times are GMT. The time now is 08:32 AM.

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