sfall script editor

@Timeslip
Just wondering: have you ever tried Mono? You could make this app cross-platform if it worked with mono :)
They have Visual Studio add-in and Mono Develop IDE which uses Visual studio projects/solutions.

PS: I know that mono windows forms implementation is far from being perfect but it still might be worth a try :)
 
Timeslip said:
odd, it certainly works here. It's not something I've written; it's just a bog standard windows file open dialog, so there's not any room for it to be going wrong. If you can't get multi select in it, then presumably you can't get multiselect in any windows application whatsoever that uses the standard dialogs either... :?

OK, so you were talking about your script editor, and I was talking about Jargo's FSE. My bad. Indeed, ctrl/shift selecting stuff IS working in YOUR editor. Sorry for the mix up. :oops:
 
hakimio said:
Just wondering: have you ever tried Mono? You could make this app cross-platform if it worked with mono :)
Yes, I use it regularly, but... why? Fallout isn't cross platform. Neither is the mapper, nor is the sslc or int2ssl that are required for script (de)compilation. Nor is the code editor control I used, which uses p/invoke for caret control. You need to use wine anyway for everything else, so just install .net into wine and be done with it.

'Cross platform' isn't some random magical make-things-better checkbox to tick.

hakimio said:
So, immediately after me saying I'm a student, you link a piece of software costing a minimum of $100. Nice. :roll:

Somehow, I think that if I had the money my 5 year out of date copy of ida pro would be the first thing in need of an update.
 
Timeslip

You can add to the compiler, remove unused procedures and variables?

Example

procedure start begin
end

procedure talk_p_proc begin
start_gdialog(962, self_obj, 4, -1, -1);
gsay_start;
call Node001;
gsay_end;
end_dialogue;
end

procedure Node999 begin
end

procedure Node001 begin

Reply(100);
NOption(101, Node999, 4);
end

procedure Node002 begin //not used
end

So with the variables.

There is a script editor F-GECK.
It is a lot of functionality. You can find lots of ideas.

Some screenshots.
http://jordan631.narod.ru/jordan631/01.PNG
http://jordan631.narod.ru/jordan631/02.PNG
http://jordan631.narod.ru/jordan631/03.PNG

F-GECK and source
http://teamx.ru/node/92
 
Jordan said:
You can add to the compiler, remove unused procedures and variables?
Yup, the optimization pass already removes unreferenced procedures and local variables. It doesn't touch global variables yet, but I'm working on it.

The complete list of optimizations it does atm are in the optimization.txt file, but in short it does constant folding, constant propagation, dead code removal, dead store elimination, variable combination, unreferenced variable removal, unreferenced procedure removal and procedure inlining. Still to come is to expand constant propagation and unreferenced variable removal to handle global variables. Beyond that I'm not planning to do anything complicated, because the execution speed of scripts isn't really that important.

Of course, it's worth a note that I know that sfall's compiler currently miscompiles some scripts if you turn optimization on. Of the 1100-ish scripts I have, about 60 of them currently cause the compiler to fail in the optimization pass, and one of them somehow manages to crash it completely. It's a good bet that there's a lot more for which it generates wrong code without giving a visible error too.

Jordan said:
There is a script editor F-GECK.
It is a lot of functionality. You can find lots of ideas.

Some screenshots.
http://jordan631.narod.ru/jordan631/01.PNG
http://jordan631.narod.ru/jordan631/02.PNG
http://jordan631.narod.ru/jordan631/03.PNG

F-GECK and source
http://teamx.ru/node/92
There's already another script editor? Can it handle pulling errors from sfall's compiler? If so, then I'm wasting my time writing yet another one...
 
I've never seen that script editor before. Is it only in russian language or just passed under the radar?

/Edit: Downloaded and tested it out. Is it somehow possible to switch language to english? Because if not, it's sadly very useless for me and I can't even test around. :>

But what I can see is, that it could need some more improvements. Looks like I can only open one script at a time, etc.
 
Timeslip said:
Yup, the optimization pass already removes unreferenced procedures and local variables. It doesn't touch global variables yet, but I'm working on it.

The complete list of optimizations it does atm are in the optimization.txt file, but in short it does constant folding, constant propagation, dead code removal, dead store elimination, variable combination, unreferenced variable removal, unreferenced procedure removal and procedure inlining. Still to come is to expand constant propagation and unreferenced variable removal to handle global variables. Beyond that I'm not planning to do anything complicated, because the execution speed of scripts isn't really that important.

That's great. Thank you for your work.

Timeslip said:
There's already another script editor? Can it handle pulling errors from sfall's compiler? If so, then I'm wasting my time writing yet another one...

In the program there is a button that sends a script to compile a bat file.

Lexx said:
I've never seen that script editor before. Is it only in russian language or just passed under the radar?

/Edit: Downloaded and tested it out. Is it somehow possible to switch language to english? Because if not, it's sadly very useless for me and I can't even test around. :>

But what I can see is, that it could need some more improvements. Looks like I can only open one script at a time, etc.

The program can be translated. If you are interested, I can translate the program interface to English. True text scattered all over the source.
I think I can cope.
 
Timeslip said:
hakimio said:
Just wondering: have you ever tried Mono? You could make this app cross-platform if it worked with mono :)
Yes, I use it regularly, but... why? Fallout isn't cross platform. Neither is the mapper, nor is the sslc or int2ssl that are required for script (de)compilation. Nor is the code editor control I used, which uses p/invoke for caret control. You need to use wine anyway for everything else, so just install .net into wine and be done with it.

'Cross platform' isn't some random magical make-things-better checkbox to tick.
Last time I checked, even after installing .net (which wasn't really straightforward) 99% of .net apps didn't work anyway, but you are right - it's not worth the effort.
Timeslip said:
hakimio said:
So, immediately after me saying I'm a student, you link a piece of software costing a minimum of $100. Nice. :roll:
Sorry, assumed that it will be free because both mono & monodevelop are free.
 
Made another update. This time most of the new work was on sslc's optimization pass; there's no longer any scripts I have that compile with it turned off but fail with it turned on. There's still the possibility of wrong code being generated though, so I'd like to see any examples that people can make that sslc miscompiles.

On the editor side, I've decided that my idea of keeping a separate errors list for each open file was stupid, and merged them all back together. There's new preprocess and roundtrip options in the menu, the first of which shows the the results of preprocessing a script, and the second shows what a script looks like after being compiled and decompiled, which is useful for seeing what the optimizer is doing. You can hover the mouse over a file tab to see the full file path, and the register script option now lets you enter your own description. There's also an option to edit the file as a whole, rather than just the entry of the current script.
 
Just to let you know, Timeslip, I've recompiled several of my scripts with the optimisation on and they seem to work correctly. I'll try to recompile the whole of my mod with your tool and see if that works (it's about 250 scripts).
 
A new version is up. It's now a lot more intelligent about what the scripts actually mean; you can hover the mouse over macros, variables or procedures to get a tooltip with their definition. If you have a scripts corresponding msg open, (use the new 'Auto-open message files' option to save you having to open them manually,) hovering the mouse over a message number will show that message. If you right click on a macro, variable or procedure you will get options to jump to its deceleration/definition, or search for all references. If you right click on an #include, there's also an option to open that include file. There's also a names window that displays a list of all procedures and variables, that you can click to jump to their definitions. Finally, you can now create new files from templates, (There's only one rather pointless test template in there atm. If anyone wants to donate some templates they think should be included, feel free. Otherwise you can add your own templates by saving .ssl files in the /resources/templates folder.)

I've also fixed a lot of bugs with trying to jump to the wrong file when clicking compiler errors that occurred in a header, and the compiler itself now supports switch statements, and can apply some of the optimizations to file scope variables rather than just procedure scope ones.

Ardent said:
Just to let you know, Timeslip, I've recompiled several of my scripts with the optimisation on and they seem to work correctly. I'll try to recompile the whole of my mod with your tool and see if that works (it's about 250 scripts).
Nice to know. I didn't find any further problems in what that version of sslc did either, although now that it does some new stuff there's some more opportunity for wrongness. :P
 
New features sound super cool, Timeslip! Good work! :clap:

Downloading now... I'll let you know if I find any irregularities.
 
Very nice update, Timeslip! I definitely need to test this out at some point, as these features sound great.
 
I've made another small update, with bugfixes only.
Code:
Fixed a crash which could occur when trying to parse functions with more than 1 local variable
Fixed a wrong code error in the optimizer in while loops
Fixed a missed optimization that caused dead store removals to not propagate properly.
Reverted a change that caused for and foreach loops to require a begin/end around the loop body, even if the body was only a single statement. (switch statements still require them.)
 
Timeslip, I need to point out that the registration feature is lacking. In order to fully register a script, three files should be edited:
scripts.lst
scrname.msg
scripts.h

ATM, only the first one is handled by your script editor. This is the reason for the NAME macro not compiling in new scripts (unless of course you type in the script reference manually in the two remaining files). FSE edits the three files with one click - maybe a similar model could be used in your editor?

Of course I know this tool is still WIP, I'm just pointing out what needs to be done to improve the options that are already in.
 
Ardent said:
Of course I know this tool is still WIP, I'm just pointing out what needs to be done to improve the options that are already in.
It's worth pointing out, especially since 99.9% of the scripts I write are global/hook and don't need registering, and hence I forgot scrname.msg even existed. :P

Try redownloading. It should take care of all 3 now. (Plus I've fixed another wrong code error in the optimizer.)
 
Timeslip said:
It's worth pointing out, especially since 99.9% of the scripts I write are global/hook and don't need registering, and hence I forgot scrname.msg even existed. :P

Try redownloading. It should take care of all 3 now. (Plus I've fixed another wrong code error in the optimizer.)

It now registers in all three files, all right. One tiny detail is that it doesn't copy the script description into the comment part in SCRIPTS.H. Compare this little bit of the header file:

Code:
#define SCRIPT_0AREUBEN         (1560)  // 0areuben.int    ; Reuben, Winchester Farm greeter
#define SCRIPT_0AWINGRD         (1561)

The first line is registered with FSE, the other with your editor. As I said, it's a very tiny detail, but this is the way original file was created, so perhaps you'd like to continue this standard (it's up to you, really).

Now, I've run into a bug.
I was writing a new script using a template. I registered it. Then I wanted to include a file, so I started typing #include. Then the following bug report showed up. I got the same effect when I pressed tab in another place in the code.

Unfortunately, parts of this report are in Polish, but I hope you'll manage to understand what's wrong. Let me attempt to translate the first line for you:

Wartość startIndex musi być mniejsza niż długość ciągu = The value of startIndex must be smaller than the sequence?/array? length.

Sorry, I'm a total n00b in computer science.

[spoiler:2d9252d36e]
Code:
************** Tekst wyjątku **************
System.ArgumentOutOfRangeException: Wartość startIndex musi być mniejsza niż długość ciągu.
Nazwa parametru: startIndex
   w System.String.Remove(Int32 startIndex)
   w ScriptEditor.Compiler.AddMacro(String line, Dictionary`2 macros, String file, Int32 lineno)
   w ScriptEditor.Compiler.GetMacros(String file, String dir, Dictionary`2 macros)
   w ScriptEditor.Compiler.GetMacros(String file, String dir, Dictionary`2 macros)
   w ScriptEditor.Compiler.Parse(String file, String path)
   w ScriptEditor.TextEditor.bwSyntaxParser_DoWork(Object sender, DoWorkEventArgs e)
   w System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   w System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)


************** Zestawy załadowane **************
mscorlib
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4200 (NetFxQFE.050727-4200)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
ScriptEditor
    Wersja zestawu: 2.10.0.0
    Wersja Win32: 2.10.0.0
    CodeBase: file:///C:/Gry/Fallout%202/Tools/Timeslips%20script%20editor/ScriptEditor.exe
----------------------------------------
System.Windows.Forms
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
ICSharpCode.TextEditor
    Wersja zestawu: 3.2.0.5777
    Wersja Win32: 3.2.0.5777
    CodeBase: file:///C:/Gry/Fallout%202/Tools/Timeslips%20script%20editor/ICSharpCode.TextEditor.DLL
----------------------------------------
System.Windows.Forms.resources
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_pl_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
System.Xml
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
mscorlib.resources
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4200 (NetFxQFE.050727-4200)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
System.resources
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.resources/2.0.0.0_pl_b77a5c561934e089/System.resources.dll
[/spoiler:2d9252d36e]

I'm using Windows Vista Home Premium SP2.
 
I suspect you have a macro defined in that header you were trying to include that has more than one argument but no definition. e.g. something like '#define bingle(a, b)'. My parser was choking on them. Fixed in svn, but not uploaded just yet.
 
More bugs:

1) I had a script and an msg file opened. I closed the SSL file. The MSG was still open. I chose 'close' from the menu and the following popped up:

[spoiler:cd76a5b90d]
Code:
************** Tekst wyjątku **************
System.ArgumentOutOfRangeException: Indeks -1 jest poza zakresem.
Nazwa parametru: index
   w System.Windows.Forms.Control.ControlCollection.get_Item(Int32 index)
   w System.Windows.Forms.TabControl.TabPageCollection.RemoveAt(Int32 index)
   w ScriptEditor.TextEditor.Close(TabInfo tab)
   w ScriptEditor.TextEditor.closeToolStripMenuItem_Click(Object sender, EventArgs e)
   w System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   w System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   w System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   w System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   w System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   w System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   w System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   w System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   w System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   w System.Windows.Forms.Control.WndProc(Message& m)
   w System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   w System.Windows.Forms.ToolStrip.WndProc(Message& m)
   w System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   w System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   w System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   w System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Zestawy załadowane **************
mscorlib
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4200 (NetFxQFE.050727-4200)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
ScriptEditor
    Wersja zestawu: 2.10.0.0
    Wersja Win32: 2.10.0.0
    CodeBase: file:///C:/Gry/Fallout%202/Tools/Timeslips%20script%20editor/ScriptEditor.exe
----------------------------------------
System.Windows.Forms
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
ICSharpCode.TextEditor
    Wersja zestawu: 3.2.0.5777
    Wersja Win32: 3.2.0.5777
    CodeBase: file:///C:/Gry/Fallout%202/Tools/Timeslips%20script%20editor/ICSharpCode.TextEditor.DLL
----------------------------------------
System.Windows.Forms.resources
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_pl_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
System.Xml
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
mscorlib.resources
    Wersja zestawu: 2.0.0.0
    Wersja Win32: 2.0.50727.4200 (NetFxQFE.050727-4200)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
[/spoiler:cd76a5b90d]

Translation attempt (line 1):
Indeks -1 jest poza zakresem. = The index -1 is out of range.

2) When you open an existing SSL, it doesn't read the file structure (i.e. doesn't list the procedures in the rightmost window). This is the same with files created from templates. When you write a new file from scratch, it seems to work ok.
 
Back
Top