Jump to content

Avernumscript Editor


Niemand

Recommended Posts

So despite the many other things I should have been doing this weekend, this is what I've been working on: A text editor specifically for writing Avernumscript. At the moment it displays line numbers, includes the ability to use Alint to check scripts, has a function to count characters in the selection (for avoiding overlong strings), has a jump to line number function, and has functions to insert basic code for a while loop and for a one shot dialog message. I'm curious to know if other people have ideas for features that would be useful, particularly new types of quick code snippet generators.

 

I want to also warn Windows users that I have no intention to port this program should I finish it. It would require a total rewrite of ~95% of the code using different libraries, and I would have to learn what I was doing every step of the way.

 

Also, can anyone remind me who actually wrote Alint? I would like to ask that person's permission to bundle it with this script editor.

Link to comment
Share on other sites

Apparently I'll never see this program, but I'll weigh in anyhow.

 

When you asked what features would be nice, the first thing I started thinking about were pieces of code that I often copy and paste while I'm writing a script. What I came up with are.

 

-force_instant_terrain_redraw() / pause(): which is used in about every frame of a cutscene, so could be nice.

-dialog boxes: especially add_dialog_choice("OK") and choice = run_dialog(1), but an entire box with empty strings would be even better.

-You said basic loops, how about a basic rectangle call? You could ask what variable you want for x and y, and the limits of x and y, then insert the appropriate loops.

 

I'm going to start scripting right now, I'll get back to you if anything else hits me. :p

Link to comment
Share on other sites

Niemand, we have ways of making you do a Windows port. :p

 

This has renewed my interest in learning XML so I can write a .scheme file for AvernumScript in PN2. Won't be able to do all the fancy code-generation, but at least PN2 already highlights mismatched brackets and does line numbers.

 

--------------------

Avoid dropping air conditioners out of windows.

- Label on an air conditioner

Link to comment
Share on other sites

This seems nice, but what exactly will it feature that Textwrangler doesn't have? That, too, is a free text editing program, specifically for HTML, but it works well with any kind of script.

 

EDIT: I was thinking, as something I would love to see, that it might be very handy to have some pre-defined script starts. Like that you can make a new file, and that you can choose what sort of script you want, and according to that the START, INIT etc states are automatically added.

 

Something else which may be usefull, along the lines of what kelandon commented and is nit implemented in Textwrangler to my discontent, is a checker that automatically checks for parentheses: if you type an unmatched right bracket somewhere, it will immediatly warn you.

Link to comment
Share on other sites

Update:

Kelandon: Bracket checking is in. It proved to be a lot of work, but I'll agree that it's useful. I had to implement it in a kind of clumsy way though, so while it seems to be okay on 1000+ line scripts, I may need to improve it for better efficiency. It also does parentheses as suggested by Thralni.

 

Lazarus: for the force_terrain_redraw(),pause() thing I got to thinking it might be both good and possible to let users create their own snippets to be added via a set of short cuts. I'll have to work on the idea. A full-blown dialog box generator is a good idea, I'll definitely be putting that in. As for nested loops, one can make a section of code, use the loop generator to surround it with a loop using one variable, then surround that with a another loop using another variable. Hopefully that will be flexible enough and simple enough to be a convenient system to use.

 

Dintiradan: Well, you'll have to start out by teaching me about GUI frameworks for Windows. . . To all the windows users, I'm genuinely sorry not to able to do it, but a port is just more than I think I could handle. Being a cocoa program for Mac OS this is written in Objective-C, and makes extensive use of NSMutableAttributedStrings, NSTextStorage, and so forth that I would have no idea how to reproduce using Windows native frameworks. The best solution would be for someone who does know more about programming on Windows to make an equivalent program.

 

Thralni: While the line numbers and syntax highlighting don't differ greatly from Textwrangler, (which I do think is a great program, by the way.) it allows the user to check the script using Alint without leaving the application, marks the lines that Alint reported errors on, and has the code snippet generators. I don't expect this program to be spectacular in it's additional features, I'm hoping to make it possible to spend more time in a single application when writing scripts, and do simple, repetitive scripting tasks more efficiently. Lastly, you idea of script templates is great and I will definitely look into it.

 

And finally, I really just have to agree with Nemesis' analysis of the best way to solve every problem related to using Windows. :p

Link to comment
Share on other sites

Quote:
Originally written by Niemand:
Kelandon: Bracket checking is in.
Cool. I approve.

Quote:
I'm hoping to make it possible to spend more time in a single application when writing scripts, and do simple, repetitive scripting tasks more efficiently.
Yes! This is what BoA so desperately needs.

Quote:
Lastly, you idea of script templates is great and I will definitely look into it.
It shouldn't be very hard, I'd think, and it'd be really convenient to have.
Link to comment
Share on other sites

Update again:

So I've now added a quick generator for full dialog boxes, I've got template files for an empty creature script, an empty terrain script, an empty town script, and basicnpc (I intend to make more, also.). There is also a code snippet manager function now: you can define your own code snippets for quick use, each is represented in a menu, and the first nine are assigned keyboard shortcuts. When you press the keyboard shortcut or select the menu item, the snippet is inserted into the current document.

 

What I'm now working on is making the preferences window. So far it allows you to turn on and off text wrapping, syntax coloring, and unmatched brace highlighting, as well as setting all of the colors used in syntax highlighting. So I want to ask potential users: what else would you want to be able to set or customize?

Link to comment
Share on other sites

For the code snippet manager: How about adding an option that will let the user customize where the insertion point starts? For instance, the text for "pause" could be:

Code:
1. force_instant_terrain_redraw();2. pause(#);
Where the code snippet manager treated "#" as a selection indicator: Whenever "pause" was selected, the code would be inserted but with the "#" selected. Then one could do command-1 (or whatever keyboard shortcut it's assigned to) and then immediately enter the number.
Link to comment
Share on other sites

To build upon that, how difficult would it be to do that for all the BoA calls? It could be similar to the argument prompting in Eclipse.

 

--------------------

I got up one morning, couldn't find my socks, so I called Information. She said, "Hello, Information."

I said, "I can't find my socks."

She said, "They're behind the couch." And they were!

- Steven Wright

Link to comment
Share on other sites

This would probably be hard, but I'd love to have this script editor sync-ed up to the BoA documentation somehow. That is, have a list of calls in a separate window (closable, of course) on the side, and clicking on a call pulls up the appendix entry for that call, or something more or less to that effect. Maybe a Help feature that goes to the appendices.

 

Oh! And an astring-like feature, either that runs a spell-check on the text (ignoring the code) or that exports all the text to a text file (ignoring the code) and re-imports it so that the user can run a spell-check with another, separate application. This also might be hard.

 

If either of those two things are possible, they'd be neat, but even if not, the application sounds pretty neat anyway. Originally, I was using at least eight different applications for BoA scenario designing (Photoshop, Preview, and ResEdit for graphics, Word, BBEdit Lite, and Alint for scripts, and the BoA Editor and the BoA app for drawing towns and outdoors). This application might bring the total down to four (Graphic Adjuster, this, and the BoA Editor and BoA app). That would be a very good thing.

Link to comment
Share on other sites

Quote:
Originally written by Niemand:
Also, can anyone remind me who actually wrote Alint? I would like to ask that person's permission to bundle it with this script editor.
Feel free. Also, if it doesn't do quite what you want, feel free to modify it and/or ask me things about it (but if you modify it, please also distribute the modified source)
Link to comment
Share on other sites

  • 2 weeks later...

Sorry, this is my last week of classes for this semester, so it's a little hectic. I'm hoping less than a month to a beta, depending on how things go.

 

Since my last update, I have gotten a couple of things done:

-The program no longer crashes when you erase all the text in the file.

-You can set the colors used for syntax coloring.

- Code Completion! Type part of a BoA keyword or function call, then press a key combination (Opt+Space), and you get to see a list of all the possible matches. The functions have placeholders for their parameters, contained within pairs of '#' characters.

-Cmnd+open bracket or close bracket selects the text contained by the previous or next pair of '#' characters, for quickly selecting the placeholder function arguments.

 

My current to-do list contains:

-Add an auto indent feature

-Fix slowness of text insertion

-Touch up Alint; I'll have to check but I think I might have found a couple of minor things that it incorrectly flags as errors.

-Add quick code generators for floor, terrain, creature, and item definitions

-Make a quick generator for dialogue nodes

-Make application modal windows work (I seem to have broken them somehow.)

-Try to make a nice spell check: This may be tricky. Apple's spell checking implementation doesn't seem to have been intended for any degree of customization by developers. I may end up doing the same thing as astring, but I'd really like a more elegant and user friendly system.

-Try to make some type of online help: This is kind of a long shot. I think it would be great to have, but figuring out how to implement it will be tricky, and even once the implementation is in place, it would need a lot of content put into it to make it really useful. Could be very time consuming. THis might be a feature to put off for a possible version 2, so as not to delay version 1 indefinitely.

Link to comment
Share on other sites

Quote:
Originally written by Niemand:
-Touch up Alint; I'll have to check but I think I might have found a couple of minor things that it incorrectly flags as errors.
Um... well, one thing would obviously be the fact that any function with a capital letter in it isn't recognized as a function. Of course, I'm currently using that little bug as a way to find line numbers.
Link to comment
Share on other sites

  • 2 weeks later...

*bump*

I've posted a beta version, 0.9b, on my utilities page . I know that it runs correctly on my 10.4.8 ppc computer, and seems to work on my brother's 10.3.9 computer, but I would appreciate hearing about any other configurations that it does/doesn't run on. I'm hoping that once any bugs are ironed out and so forth, this version will be superseded by a full 1.0 release in a few weeks.

Link to comment
Share on other sites

I've always been unclear on whether URLs are case sensitive, but I guess they must be, because there's a case problem in the link from your utilities page to the script editor.

 

It works fine on my computer (10.3.9). Looks outstanding. A couple things:

 

* In the Create Dialog feature, it'd be nice to have multiple boxes so that we could see all six strings at once.

 

* Create Note seems weirdly named. Create One-Time Message seems more unwieldly but more accurate. Maybe there's a better term for it.

 

* Word-wrapping is supposed to make the text fit the width of the window, right? It doesn't work when I try it.

 

My first reaction is that this is a great program. I suppose it could use a little bit of documentation (for newbs who don't get the concept of "New From Template").

Link to comment
Share on other sites

I'm glad to hear that you like it.

I'm certainly planning to write documentation for the full release. I don't know about showing all six strings at once when creating a dialog; I agree that it would be helpful, I'm just not sure if I can make that fit in a sheet that won't take up the whole screen. I can also see about renaming Create Note, although I was hoping that the tooltip message would make it's purpose clear. Concerning word wrapping: for some reason this doesn't seem to be affecting windows that are already open, but it does affect all windows opened after the setting is changed. I'll try to fix that.

 

Also, I've fixed the download link.

Link to comment
Share on other sites

Quote:
Originally written by Niemand:
I don't know about showing all six strings at once when creating a dialog; I agree that it would be helpful, I'm just not sure if I can make that fit in a sheet that won't take up the whole screen.
BoE does it (which is why I bring it up), although its solution (make the boxes too small, so that you have to scroll) is a little annoying. It probably could be done right if you made the text boxes adequately wide.
Link to comment
Share on other sites

It's looking very good. Word wrap works well with me. All the dialogue things work with me, making of scripts according to templates works... So yeah, everything works fine. I'm on OS 10.4.9. Only thing until now that didn't seem to work is the naming of code snippets. I get the option to change the name, but it doesn't remeber what i type. For example:

 

I want Snippet 1 to be "Custom strings," but when I type that in, it immediatly reverts to "Snippet 1"

 

I don't know yet if I will be using it instead of textWrangler, as I'm extremely fond of that program. I might be using this program as a last check app, where i check things and correct everything last minute.

 

*Looks Ascript over again*

 

I might throw out TextWrangler anyhow, you know... This program has real good stuff in it. It will take some getting used too, though.

Link to comment
Share on other sites

Alint is a useful program which has pointed out most of the errors in the file used to port Exile scenarios into Avernum. It does have a few errors itself though.

 

First there is a mistake with “fl_shimmers”, the Alint source code shows it as “floor_shimmers”. So to Alint “fl_shimmers” is always wrong while “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.

“Checking file 'sanctitem.txt':

Error line 29: Bad beginstate line

Warning line 29: Result ignored”

 

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.

(At some point I will have to check whether there is a problem with it not checking magnitudes of creatures and terrain types.)

 

Then it is unable to handle spaces between words in the title of a script. This is a problem for all scripts not just the ported ones. The Command Prompt can handle spaces in the names of directories. But it seems unable to handle spaces in the names of files, hence the flaw seems to be inherent in any command – line program.

 

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

Link to comment
Share on other sites

Quote:
Originally written by Ishad Nha:
May not detect the absence of the “i = i + 1;” in a while statement.
It probably doesn't, because this would be harder to program than most of what Alint does. It requires recognizing a while-loop and checking if the variable is set anywhere within it. That's checking more than one line at a time, which I don't think Alint really does at the moment.
Link to comment
Share on other sites

It would really be pointless to make a checking program try to check that a loop variable is used in the loop. What if I write a loop like:

Code:
 while(character x is alive){   hurt character x;} 
Then the loop can be entirely correct, run and finish without actaully using any counter variables at all.

It basically comes down to the fact that it's impossible to write a program that can verify that another arbitrary program will ever finish executing.

 

I'll definitely look into the fl_shimmers, SANCTIFICATION_STATE, etc. things though.

Link to comment
Share on other sites

It has been proven that no general algorithm can exist to check whether or not a loop is valid.

 

On the other hand, you can always surprise us, Niemand. wink

 

--------------------

I hooked up my accelerator pedal in my car to my brake lights. I hit the gas, people behind me stop, and I'm gone.

- Steven Wright

Link to comment
Share on other sites

  • 3 months later...

I dredge this topic up from the depths because I'm making good progress on the move toward the full version 1.0, and i wanted to ask for opinions on a bit of the user interface:

 

I've rearranged the dialog box coder window to make all 6 strings visible at the same time, as requested by Kelandon. There's a full size screenshot of the new layout here . Does this look better than the old, or does it look too large and unwieldy?

 

I'm also working on writing the documentation to go into the online script reference, but it's slow going.

 

Lastly, I think that I may have successfully finished adding something that rhymes with 'ellchecking'. cool

Link to comment
Share on other sites

What language are you using, Niemand (can't check myself 'cause StuffIt is of the Devil)?

 

--------------------

The McKenzie Brothers explain Nimtz and Stahlhofen's observations by way of analogy with a 20-car train departing Chicago for New York with 100 cases of 24 Molsons Beer ("two-fours" in Canuck-speak). The stopwatch starts when the centre of the train leaves the station, but the person holding the stopwatch drinks a case of 24 at each stop. So when the train arrives in New York, now comprising only two cases of beer, the person holding the stopwatch wakes up from his drunken stupor, doesn't remember a thing for the last 23 hours, can't find the stopwatch (he sold it to someone to stake him the last 2 cases) and now claims the trip was "instantaneous" although the train itself hasn't exceeded its reported speed.

 

And there you have it - The McKenzie Brothers' explanation [of group velocity]... Beer DOES affect relativity, in a relative sort of way. I guess.

(Slashdot)

Link to comment
Share on other sites

  • 1 month later...
Quote:
Originally written by Niemand:
I dredge this topic up from the depths because I'm making good progress on the move toward the full version 1.0, and i wanted to ask for opinions on a bit of the user interface:

I've rearranged the dialog box coder window to make all 6 strings visible at the same time, as requested by Kelandon. There's a full size screenshot of the new layout here . Does this look better than the old, or does it look too large and unwieldy?

I'm also working on writing the documentation to go into the online script reference, but it's slow going.

Lastly, I think that I may have successfully finished adding something that rhymes with 'ellchecking'. cool
That screenshot is wonderful... A bit large, but still good. You could allow the user to choose between that and the original version though, in case people have smaller screens.
Is this version available on your utilities page yet?

This isn't exactly important but...
Quote:
Originally written by Kelandon:
I've always been unclear on whether URLs are case sensitive, but I guess they must be, because there's a case problem in the link from your utilities page to the script editor.
I think the case-sensitivity of URLs depends on the server... if it's a unix/linux based server, it may be case-sensitive, but it it's Windows-based, it won't be - I think...
Link to comment
Share on other sites

Sorry, version 1.0 is taking far longer than I intended; I'm working on writing the documentation for the program, an online reference for Avernumscript, and creating more helper functions for common code blocks. The documentation PDF is nearly done, and I'm thinking that most of the larger code helper functions will be pushed off to a later version, as I've realized that I need to gut the system by which they work anyway, and they are very time consuming to create. The online script reference is coming along, I now have 80 pages finished out of somewhat more than 500 needed. (Note that here a 'page' is a HTML page with information on one call or keyword, often faily short. Making them still takes time, though.) A preview / web-based versio of the reference is availible at my site ; so far the Constants, Datatypes, Basic and IO, Basic Dialog Box, Advanced Dialog Box, and Animation and Sound categories are complete.

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...