Well-Actually War Trall Ishad Nha Posted June 17, 2014 Share Posted June 17, 2014 (edited) Windows Alint Compendium This is the write-up for notes on how to use Alint on Windows, some of this applies to the Mac version too. *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. It is not a text editor it does not check spelling or grammar. 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://spiderwebforums.ipbhost.com/index.php?/topic/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 Sylae: [ Go look again at that "#24", you'll notice that it's actually a permalink to that post in question. ] 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. 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. Celtic Minstrel: You could also just install Alint wherever and then add it to your %PATH%, which can be done in the Control Panel under System; it varies by OS version, but on Win7 I have to go to Advanced System Settings, click the Advanced tab, and then click the Environment Variables button. 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. Assumptions: Notes below are written assuming that: all of your files and programs are found on the C: drive. in particular they are found in the Program Files directory. (Installing to the Program Files directory causes no problems in Windows XP but I hear it will lead to hassles in Vista. If you get hassles just install to the root C: (or whatever) directory 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. Sylae: It is worth noting that, due to the unique way cmd.exe works, if you have the scenario placed on a filesystem that is different than your user profile directory's (such as a flash drive or secondary disk), you first have to put that drive letter in. So, if you're checking a scenario in E:\Profile\Games\BoA\Frostbite, you need to run the following commands: e:\ cd \Profile\Games\BoA\Frostbite 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. Celtic Minstrel: On Win7 you can simply drag the file over the command prompt window, and its path will be inserted for you. I'm not sure if this'll work on XP or Vista. Yes, this does work for XP, Vista I don't know about. Tip from Khoth: It should be able to handle files with spaces in the name, if you put double quotes round the filename: alint -w "I like spaces.txt" Celtic Minstrel: If you drag a file to the window, double quotes are automatically inserted for you. An example of using Alint in practice: 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 DosKey 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. Sylae: It's better practice to use redirection "alint (arguments) > report.txt", especially with cmd.exe. The standard copy/paste method you suggest injects lots of unneeded line breaks and other formatting errors compared to the original program output. Celtic Minstrel: If you get a lot of errors but don't want to redirect them to a text file, you can do something like the following: alint -w *.txt | more This will show the errors one screen at a time; you press space to view the next screen. Remove any text files that are not BOA scripts, else you will be spammed with errors. They can be placed in a folder of their own. Sylae: Although this does work, it would probably be better practice to work one script at a time, especially for developing. *.txt is great if you just want to open alint on someone else's scenario, say "OMG there are 1,945 bugs in this scenario" and call it a day. Meanwhile, in the real world, those will mostly be false positives and getting the entire scenario output while going through one script in particular probably isn't what you're going for. Celtic Minstrel: There are other ways to do this, if you know how globs work and apply some naming conventions. For example, if you name town scripts using the common naming convention of "t.txt", you can check all town scripts with something like "alint t*.txt". If you do it from powershell, you can check town and outdoor scripts at the same time with something like "alint [to]*.txt". (You enter powershell by typing "powershell" and then pressing enter. I think powershell was a separate download in XP, but it's included in Win7; no idea about Vista.) DosKey Help: at the Command Prompt type HELP DosKey, this brings up a brief help screen. DosKey: Edits command lines, recalls Windows XP commands, and creates macros. 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 to handle any type of file not just text, its description makes it sound like a second batch processing command, which it is not. -d: Print bison debug trace information (You don't want to do this) Celtic Minstrel: This is more for people working on alint (ie with the source code) rather than using alint. -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, 200. 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) Number range may be from 115 to 199, this will need to be researched. 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. Sylae: This is a "logic error", not a "syntax error". For the most part it's the responsibility of the person writing the script to check these. 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. Have 'i', want '' You have an integer parameter, but no parameter should be there at all. "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 simply want an Enter inserted at the end of a line. It may also demand lower case letters in things like state names and reserved words like ACTION. Text Editors Can show line numbers Can show which brackets or parentheses are paired, this detects errors when they should be paired but they are not. If text file is given a C++ Syntax Type, strings and comments will be color coded. Celtic Minstrel: In many editors you can go further and define a specific AvernumScript syntax type. I did this for TextWrangler, for example. I expect it's also possible for Notepad++, but I haven't investigated. Running Alint from an MS-Dos batch file Save the two lines below to a new file, give it a catch name like Alint.bat, extension must be .bat. CD C:\Program Files\Blades of Avernum\Blades of Avernum Scenarios\Of Good and Evil2.bas alint *.txt > AlintOGE.tbl When you click on the Alint.bat batch file, the text generated is outputted to a file called AlintOGE.tbl. This can be opened in a text editor. Once it is loaded, every time the batch file is run, the prompt will occur for AlintOGE.tbl to be reloaded. First line changes the directory to C:\Program Files\Blades of Avernum\Blades of Avernum Scenarios\Of Good and Evil2.bas Second line runs the batch checking function of Alint, then it outputs the data to a file called AlintOGE.tbl You can choose any name you like, not just AlintOGE.tbl Celtic Minstrel: Again, put the "C:" bit on a separate line, and note that it should be replaced with whichever drive BoA is installed on. I'd also recommend giving the output file a .txt or .log extension instead of .tbl. (Original Alint Readme) Alint readme alint is a program that checks BoA scripts for errors. It is a command-line program. If you are unfamiliar with that, read commandline.rtf for information. To use it, type the command alint followed by the names of the files you want to check. It will scan those files, and report any errors it finds. If no errors are found, it will not print anything, unless you specify the "-v" option. If you have the "-w" option, it will also warn you about a few things that are not errors but probably are not what you wanted. The easiest way to use it is to type "cd ", then drag the scenario's folder into the terminal window, then press return. You are now in the folder for that scenario, and you can check all the script files with "alint *" (* means "everything"), or "alint -w *" Then, you can fix the errors it finds and recheck with up-arrow then return. If you just type "alint", it will print a short description of how to use it. To avoid printing spurious messages, it will only tell you about one error per line of script. Also, it doesn't really know what you were intending, and sometimes an error can cause other error messages further down. This is especially so in dialog scripts - if you miss a break after a code section, it thinks that everything until the next break is particularly bad code and spams you will errors for every line. I intend to fix this in a future version. If you fix everything it finds, you should recheck to see if anything was hidden by the previous ones. It is important to remember that no errors reported does not mean that there is nothing wrong with your script. There are many things that it does not check for, and it is no help at all when your script is valid but not what you intended. If you find it giving an error when there isn't one, or if it fails to spot an error you think it should notice, please let me know (email@example.com) Errors are located by line numbers - a text editor with the ability to go to a specific line number will help you greatly. Project Builder and XCode have editors you can use, and I believe BBEdit does too. If the line given seems correct, try looking up a line or so - there may be something there, like a missing semicolon. It will never report a line number that is too small. (Original Commandline file) How to use the command line Alint doesn't have the sort of user interface normal for Mac programs. This document explains how to use the command line. To get at it, use the program "Terminal" (in the Utilities subfolder of the Applications folder) If you start it, you will get a window containing the command prompt - a little bit of text followed by a '$' or a '%', depending on what version of OS X you are using, and whether you changed it. The text will be something like "computername:~ username$". The important part here is the "~": It shows what folder you are currently in. Files and folders are shown by a path - a listing of the subfolders you have to go through to get there. For example, the Terminal program's path is "/Applications/Utilities/Terminal". A "~" is an abbreviation of your home folder, so the path to your music folder is "~/Music". Commands You do things in Terminal by typing commands. For example, the command "ls" (without the quotes) lists the files in the current folder. For many commands, you can modify them by entering options after them. These are typically a "-" followed by a letter. For example, "ls -G" will list files, and colour the names depending on what type of file they are. "ls -l" (lowercase L, not number 1) will show more detailed information about the files. You can combine them and do both, by "ls -lG" or "ls -l -G". Another important command is "cd", short for "change directory". This is used to change the current folder. To use it, type "cd foldername", for example "cd Music". Then, using ls will show the files in that folder, rather than the files in your home folder. foldername here is an argument to the command. It tells cd more specifically what to do. You can use "cd .." to go back a folder, and "cd" on its own to get back to your home folder. A useful feature of Terminal is that if you drag a file or folder into the window, it will paste the path in. so you can type "cd " then drag a folder in, then press return, and you will be taken there. If you press the up arrow, the last command you entered will be pasted in, and you can edit it a bit if you want before you press return to execute it. Other commands To get more information about a command, you can look up its manual with "man command". Other commands are "cp" for copying files, and "mv" for moving them. Beware, as these commands will overwrite files without warning you if you copy over something. "rm" deletes files. Use this with care, if at all. "cat" displays the contents of a text file in the terminal window. If it's a big file, "more" gives a better display. Installing alint To install alint, go to the directory that it was downloaded to (using "cd"). If you listr the files (use "ls"), you should have something like: alint commandline.rtf readme.rtf install.sh uninstall.sh Install it by typing "sudo sh install.sh". You'll need to type your password here. ("sudo" is the command line equivalent of having to enter your password to change things in System Preferences etc, and "sh" runs the commands that are in the file "install.sh") Then, alint will be available in any terminal window opened from now on (but not the current one) Installing alint puts it in a folder (/usr/bin) which is checked when you enter a command. Now, you can use alint as a normal command. Uninstalling alint To uninstall, do the same thing, but "sudo sh uninstall.sh". Using alint without installing it If you can't or don't want to install alint, you can use it by running it from where it is. To do this, go to the folder alint is in, and run it with "./alint" ("./" means the current folder). Alternatively, from another folder, type the path to it ("~/Downloads/alint/alint", perhaps). This is less convenient, however. Edited June 18, 2014 by Ishad Nha merging double-post Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.