Jump to content

Alint: the Script-checking program


Ishad Nha

Recommended Posts

This is the write-up for notes on how to use Alint

Alint Exe Help Notes

 

What it does

When scenario designers want to check their scripts for errors, the program to use is Alint. It only checks scripts, it does not check the Bas file for instance.

 

Where to get it

http://kppp.webs.com/utilities.html

 

Tridash made a version of his own:

http://redsaurus.net/blades/alint(el).zip

This link found at:

http://spiderwebforu...ic/16804-alint/

In post "Posted 27 July 2012 - 08:42 AM #24"

It may be Mac only, I could not get it to work on Windows XP

 

How to use it: Mac

Mac version of Alint comes with help files, they appear to be adequate and should be given priority over what is written here.

According to Niemand there is a GUI version of Alint for Mac, it enables you to avoid the Command Prompt.

 

How to use it: Windows

You can't run the program by itself, unlike Blades of Avernum. Alint can only be run from the Command Prompt, also called the MS Dos Prompt.

It can be placed in the scenario's folder.

Tip from Khoth: Alint can be placed in the C:\Windows directory, then it will be available for any scenario anywhere.

 

Start the MS-Dos Command Prompt, its shortcut should be found at: Start Menu -> Programs -> Accessories

Next, change the current directory to that of your scenario.

 

Example, Frostbite v1.0.2 by Lazarus, the Frostbite scenario is installed at:

C:\Program Files\Blades of Avernum\Blades of Avernum Scenarios\Frostbite Win\Frostbite

In the Command Prompt type:

CD C:\Program Files\Blades of Avernum\Blades of Avernum Scenarios\Frostbite Win\Frostbite

 

Note, "CD" simply means Change Directory.

You can copy the directory location and paste it into the Command Prompt.

Copy: in Windows Explorer right-click any file in the scenario directory, this brings up the Context Menu. Click on the Properties line, found at the bottom of the menu. This brings up the Properties dialog screen. Then in the General tab, look for the word "Location:". Drag the cursor across the location of the file till it is all selected, then copy it. Close the Properties dialog screen.

Paste: If you click on the little black "C\:" button in the upper left corner you can see the word Edit. Hold your cursor over that line to bring up the Edit menu. Click on Paste to paste stuff straight into the Prompt.

 

Remove spaces from the titles of all files being scanned, otherwise you can't get the program to recognize the files.

Tip from Khoth: It should be able to handle files with spaces in the name, if you put quotes round the filename:

alint -w "I like spaces.txt"

 

An example:

C:\Program Files\Blades of Avernum\Blades of Avernum Scenarios\Frostbite Win\Frostbite\Scripts>Alint -v -w t4spring.txt

Hit Enter and Alint will check the script for errors.

After each lot of alterations, hit the Up Arrow and Enter keys till the file comes up clean.

Alint is not infallible, but between it and the Blades of Avernum game you should be able to clean up the errors. Certain errors will not be detected by Alint but the game itself will give error messages.

Note: the meanings of the switches -v and -w are explained below.

 

Alint can be used to check all files in the scenario folder. Here is an example for Frostbite.

C:\Program Files\Blades of Avernum\Blades of Avernum Scenarios\Frostbite Win\Frostbite\Scripts>Alint -v -w *.txt

Then you get the errors printout:

C:\Program Files\Blades of Avernum\Blades of Avernum Scenarios\Frostbite Win\Frostbite>alint -v -w *.txt

Checking file 'abom.txt':

Error line 25: Illegal variable definition

Error line 122: Undeclared variable last_abil_time2

Error line 128: Undeclared variable last_abil_time2

&&&&&&&&&&&

 

Using Command Prompt is not that hard when you master the menu that appears when you click on the "C:\" icon. Ditto if you know about the hotkeys. By the way, in the Edit menu "Mark" means to select while moving in an x,y manner.

You can copy and paste the error reports into a document. Choose Select All or Mark to select the error reports, then hit Enter to copy the text and you are ready to paste into the file of your choice.

 

Remove any text files that are not BOA scripts, else you will be spammed with errors.

 

DosKey Help:

at the Command Prompt type HELP DosKey, this brings up a brief help screen.

 

Command Prompt Help:

at the Command Prompt type Help, this brings up the list of all commands.

 

To alter the size of the Command Prompt window or to alter the amount of lines it contains at any one time:

click on the "C:\" icon. Then click on the word Properties this brings up a dialog box. In the Layout tab, Screen Buffer Size allows you to set the number of lines that the Prompt can handle, I set it to 3,000.

 

Alint Program Help Printout:

simply type "alint" or "alint.exe", omit quotes.

C:\Program Files\Blades of Avernum\Blades of Avernum Scenarios\goodevil.bas>alint.exe

Usage:alint.exe [-advwV] file ...

-a: Check all files, not just *.txt

-d: Print bison debug trace information (You don't want to do this)

-v: More verbose output

-w: Print warnings

-V: Print current version

Options only apply to files appearing after them

 

(The -a switch seems not to do anything?!)

-v: tells you which files have been checked, normally files are only listed if they generate error or warning messages.

 

 

False Errors

First there is a mistake with "fl_shimmers", the Alint source code shows it as "floor_shimmers". So to Alint, the correct name "fl_shimmers" is always wrong while the wrong name "floor_shimmers" is always right.

Then te_cutaway_second_icon is spelled as "te_cutaway_second_item".

As far as I can see, the program does not recognize print_big_str_num. These errors can't be fixed in the MS-Dos Prompt Edit command.

Then it won't accept the Sanctification state in the sanctitem.txt.

 

It seems that the Blades documentation is wrong when it says that states over 100 are not possible for towns. I haven't experimented with this much myself, but it seems to be possible to use states with numbers around, and not exceeding, 255. Of course some numbers can never be used:

INIT_STATE (equal to 0)

LOAD_SCEN_STATE (equal to 0)

EXIT_STATE (equal to 1)

START_STATE (equal to 2)

DEAD_STATE (equal to 1)

START_SCEN_STATE (equal to 111)

SEARCH_STATE (equal to 100)

TALKING_STATE (equal to 110)

UNLOCK_SPELL_STATE (equal to 101)

SANCTIFICATION_STATE (equal to 102)

BLOCK_MOVE_STATE (equal to 112)

DISPEL_BARRIER_STATE (equal to 113)

STEP_INTO_SPOT_STATE (equal to 114)

These states can never be called from placed specials.

 

Unreported Errors

As I learned the hard way, the variables in the various calls are not checked for magnitude. Thus for put_item_on_spot it accepted an item with the number 3,840.

May not detect the absence of the "i = i + 1;" in a while statement.

 

 

Understanding Error Messages.

 

"i" means integer, a whole number.

"s" means a string, a piece of text.

 

Have 'i', want 'ii'

Means you have one integer parameter in a BoA call but you actually need two.

Ditto, Have 'ss', want 's'

Means you have two string parameters in a BoA call but you actually need only one.

 

"syntax error"

Normally these errors will be connected to the wrong use of an Avernumscript call. Check the description of the relevant call in the BoA Editor documentation, see if you entered the wrong kind of variable or whatever.

If that does not work, check all your semi-colons and parentheses.

 

It may also demand CAPITAL letters in things like state names and reserved words like ACTION.

Edited by Ishad Nha
Link to comment
Share on other sites

Ascript can be found at Niemand's site, the Halls of Chaos:

http://blades.hallsofchaos.net/utilities.shtml

I am not on Mac, so I know nothing about how it works, PM (Private Message) Niemand, if you have any queries.

 

I am currently collating the wisdom of the sages into a single Alint help file.

Link to comment
Share on other sites

Since there's evidence that someone still cares, I thought I might fix some of the bugs.

 

fl_shimmers, te_cutaway_second_icon, print_big_str_num and SANCTIFICATION_STATE should now work, and it accepts states up to 255.

 

I don't have a Mac any more, so here's a Windows executable and some source code.

 

 

Windows executable: http://khoth.ath.cx:81/alint.zip (Works On My Machine, it's possible you need to install something from Microsoft to make it work, I'm not entirely sure)

Source: http://khoth.ath.cx:81/alint-0.9.2-source.zip

Link to comment
Share on other sites

It did not work but it gave me some information:

"This application has failed to start because MSVCR110.dll was not found."

I don't know what this dll is, it is not found on my computer.

 

That is the c runtime DLL provided with VS 2012. You can download it from multiple locations or get it from the MS site.

 

I get this when running the new alint with *.txt:

D:\Games\Spiderweb\Blades of Avernum\Blades of Avernum Scenarios\The Cave of No Return>\alint -w *.txt

Couldn't open file '*.txt': Unknown error

But it works fine against just a single file:

D:\Games\Spiderweb\Blades of Avernum\Blades of Avernum Scenarios\The Cave of No Return>\alint -w t8undercave.txt

Checking file 't8undercave.txt':

Warning line 283: Result ignored

Warning line 359: Result ignored

Link to comment
Share on other sites

It might be a good idea to include MSVCR110.dll with the download because Alint won't work without it.

 

Batch checking, *.txt, worked properly.

This does not work:

-a: Check all files, not just *.txt

I don't know what this is:

--: Check stdin

 

Alint requires that init state, start state and exit state all be in capitals. That is no big deal, in Crimson Editor that can be done with Ctrl+U.

 

Running Alint on the folder Sample Scripts\Terrain Scripts yielded some surprises:

Checking file 'beamobj.txt':

Checking file 'chainmine.txt':

Error line 76: Unknown function set_sdf

Checking file 'disarmmine.txt':

Error line 79: Unknown function set_sdf

Checking file 'doorlever.txt':

Checking file 'doorwheel.txt':

Checking file 'lockbox.txt':

Error line 60: Statement error

Checking file 'magicdoor.txt':

Checking file 'minetrigger.txt':

Error line 62: Unknown function set_sdf

Checking file 'sanctitem.txt':

Checking file 'spawnertrap.txt':

Checking file 'specobj.txt':

Checking file 'trap.txt':

 

 

Checking file 'abom.txt' in the Frostbite scenario:

Error line 25: Illegal variable definition

I will need to check if this is a problem in the game itself.

Link to comment
Share on other sites

Do you happen to know whether Avernumscript is completely case-insensitive, or is it just the states that can be lowercase? (I don't have BoA installed here)

 

-a should work (except see below). You'd use it like:

alint -a *

without the -a, it'll only check .txt files, with the -a it should check all files. There's currently a bug where horrible errors in one file can screw up the next one, though. So I'll fix that soonish.

 

-- is if you want to feed in the script directly rather than going through a file. If you do alint --, then it'll expect you to type in a script for it to check. This doesn't work very well from a command window though - it's intended to help other programs use alint.

Link to comment
Share on other sites

Avernumscript seems to be case-insensitive but I have never checked this, I can see if it rejects the lower-case stuff found in Frostbite..

Alint will record errors if the case is "wrong".

 

Edit:

Alint source code will tell you what it will accept.

If we only had the source code to BoA we would know exactly what the BoA program accepts in the way of case.

 

One way to probe this matter is to take a script and make everything in it Upper Case or lower case. I am doing that now with the Beta of Of Good and Evil. Now I am trying everything in lower case, so far no problems.

Edited by Ishad Nha
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...