PDA

View Full Version : [tutorial] Setting up Scite to edit SCAR,LUA,IA files



Dark40k
22nd Nov 08, 3:26 AM
This is a short tutorial on how to set up Scite so as to have autocompletion, syntax highlighting and a few corrections.
It is based on fneep's excellent tuto (http://fneep.fiffa.net/?page_id=59). I only have added a few custom things (colors, fonts,...)

What it does:
- autocompletion: type the first letters of the command (hit CTRL-SPACE to force autocompletion). Hit TAB to select what you want. Works with both lua and specific SCAR commands.
- function help : hit SHIFT-CTRL-SPACE when cursor is in the params of a function. This will display a short help on the function. Works with SCAR functions.
- highlighting: LUA specific functions and SCAR functions show with a different color. Usefull for syntax contol (if function is not highlighted then there is a syntax error)
- compilation: hit SHIFT-F5 to test the compilation. Errors are reported in a docked window. This allows basic syntax checking of the code without starting DoW
- test run : hit F5 to make a test run. It is the same version of LUA as in DoW. It allows testing of advanced LUA programming (metatable,...)

You first need to install Scite and DC Mod tools. Install links can be found in this thread (http://forums.relicnews.com/showthread.php?t=144450&page=1&pp=15) (tools section).

This has been tested with Scite1.77 but it should work starting from 1.72.

Now what you need to do is :
1/ Copy into the wscite directory the following files from <DC Install directory>\ModTools\ScarDoc : ScarW40k.api, ScarW40K.properties,ScarW40K_AI.api.

2/ Open ScarW40K.properties in wscite folder with notepad and replace the first lines :

# Autogenerated properties file containing function names for Scar files.
file.patterns.scar=*.scar

keywords6.$(file.patterns.scar)=OnInit OnGameSetup OnGameRestore \
UID \
*Player_GetEntities \
*Player_GetSquads \
*Squad_GetSquadFromGameID \
with

# Autogenerated properties file containing function names for Scar files.
file.patterns.scar=*.scar

keywords6.$(file.patterns.scar)= import \
UID \
Player_GetEntities \
Player_GetSquads \
Squad_GetSquadFromGameID \3/ Download Lua5.0.3 from here (http://luaforge.net/frs/download.php/1983/lua5_0_3_Win32_bin.zip) and unzip files into the wscite folder.

4/ In the wscite folder copy lua.properties to lua.properties.old. (This is for backing up the file)

5/ Download lua.properties.zip from this link (http://dl.free.fr/rNdOPasKB), unzip in the wscite folder.

6/ In windows, set Scite as the default editor for .lua, .scar, .ai, .nis, .nil files. If extension is not known then double click then select wscite as editor. If it is known (some program is already associated) then right click and select "open with". Select "Select program" in the submenu.

7/ Launch Scite and open user properties (menu options). Add the following lines at the end. Save and relaunch Scite to see the difference.

# Set indentation to 4
tabsize=4
indent.size=4

# do not hide blank lines after block when folding
fold.compact=0

# automatically fold files as much as possible when loaded
fold.on.open=1

#open files in an existing instance of SciTE rather than always opening a new instance
check.if.already.open=1

#show margin for line numbers
line.margin.visible=1


This is now done! Try opening a scar file and it should be okay.

Kresjah
22nd Nov 08, 5:08 AM
You might also want to set it to be default for .nil files too. These are essentially just your standard DoW LUA files, but will never be burnt (compiled) on their own and is used solely for inheritance during burning of other LUAs.

Dark40k
22nd Nov 08, 6:36 AM
Thanks Kresjah, I have updated the lua.properties.

The copy/paste did not work for lua.properties (long sentences get spaces inserted). I have replaced with a download link.
Problem is that file may be removed after some time. Can someone provide a permanent download link?

archaeum
24th Jul 09, 9:21 PM
Sorry to necro this thread, but does anyone still have that modified lua.properties file? The link in the OP is dead.

Bowkers
25th Jul 09, 6:16 AM
Hmm, why is this not in the tutorial section? I think a move would be appropiate.

We have arrived at our destination 8 months late. We apologise for any inconvenience caused. ;)

Dark40k
26th Jul 09, 10:13 AM
Here is a new link:
http://dl.free.fr/qCM8Clssg

Link dies if nobody downloads in a month. If somebody can provide permanent download, it would be much better. ;)