I've send you a PM with all required information.Whimsy wrote:[...]That would be great, thanks! That way if Mediafire plays up again there's an alternative source.[...]
Exscriptor - new external script editor
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
- Blacky_BPG
- Posts: 2030
- Joined: Mon, 23. Feb 04, 23:42
Hmm. I've not been able to reproduce this, and I can't see what might be causing it - could you give me any more information? Have you been able to get it to happen again?Enrico777 wrote:Unfortunately it just crashed for me after playing around with it. It happened after browsing through the Station commands and clicking a [+] sign in front of a command, then clicking the [-] afterwards, then Exception.
I don't recognise all of those language files, but I know that 44/497213 and 44/497215 are both XTM files and both have the same problem - a stray & inside them at the line numbers mentioned in the error message. You can open these and fix it just by changing the "&" to "&". But these shouldn't be causing the Exscriptor to crash; if you fix them or move these files out of the way temporarily, does the program still crash?Note that the first exceptions happened because I didn't set the language correctly, at first. They didn't crash the tool. After I set the language correctly there are still two exceptions and the last one crashed the tool.
Good idea, I'll do this in the next version. I'm sorry I couldn't fix your problems yet though!Edit: For future versions it might be a good idea to put the language selection into the options, which show up on first start of the tool.
@Whimsy: I fixed the errors you mentioned, plus some more errors in the files.
Edit: Removed suggestion for an existing function.
--
While fixing the errors in the t folder, I noticed that my changes would be overwritten if Exscriptor remains open and is closed later. Is it supposed to save all the data that got loaded in?
--
Now Exscriptor loads up and shows "X3 data loaded but with errors:". Those errors are conflicting files not syntax errors like before. And they have no "error" warning in the descriptions.
Suggestion: You could make the text in the lower left corner (the mini log) copyable. I couldn't even copy it with CTRL-C.
--
The crash to desktop happened again: I clicked on the [+] and [-] for a bit and it CTD. I remember which sign I clicked last: It was the [-] in front of "Formations" in the "Objects" list.
Exception text (without loaded assemblies):
Edit: As you can see, it is missing a function for double-click. So it counts my click on [+] click on [-] as double-click. I could actually reproduce the error and I could avoid it by clicking not so fast.
--
Also the "Object commands" list doesn't show the texts correctly. See screenshot:
[ external image ]
Keep up the good work.
Edit: Removed suggestion for an existing function.
--
While fixing the errors in the t folder, I noticed that my changes would be overwritten if Exscriptor remains open and is closed later. Is it supposed to save all the data that got loaded in?
--
Now Exscriptor loads up and shows "X3 data loaded but with errors:". Those errors are conflicting files not syntax errors like before. And they have no "error" warning in the descriptions.
Suggestion: You could make the text in the lower left corner (the mini log) copyable. I couldn't even copy it with CTRL-C.
--
The crash to desktop happened again: I clicked on the [+] and [-] for a bit and it CTD. I remember which sign I clicked last: It was the [-] in front of "Formations" in the "Objects" list.
Exception text (without loaded assemblies):
The errorlog.txt is empty (just headline).************** Ausnahmetext **************
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei X3_Script_Editor.Editor.clickCommands(Object sender, EventArgs e)
bei System.Windows.Forms.Control.OnDoubleClick(EventArgs e)
bei System.Windows.Forms.TreeView.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Edit: As you can see, it is missing a function for double-click. So it counts my click on [+] click on [-] as double-click. I could actually reproduce the error and I could avoid it by clicking not so fast.
--
Also the "Object commands" list doesn't show the texts correctly. See screenshot:
[ external image ]
Keep up the good work.
It doesn't save, but for some reason it refuses to let go of the files once it's opened them, so they're effectively write-protected. I'll keep investigating this bug but so far I've been unable to figure out how to fix it.Enrico777 wrote:While fixing the errors in the t folder, I noticed that my changes would be overwritten if Exscriptor remains open and is closed later. Is it supposed to save all the data that got loaded in?
These will just be object command conflicts, I expect - they're fairly normal and shouldn't cause any problems.Now Exscriptor loads up and shows "X3 data loaded but with errors:". Those errors are conflicting files not syntax errors like before. And they have no "error" warning in the descriptions.
This as a known bug (I even mention it in the manual) . You should be able to copy using CTRL-Insert (the other shortcut) but in V1.009 I've tried to work around the issue and so CTRL-C should work okay now too (at least in a few places).Suggestion: You could make the text in the lower left corner (the mini log) copyable. I couldn't even copy it with CTRL-C.
I still don't understand why this is happening, nor have I been able to reproduce it, but I've improved the function in question so hopefully, if it does happen again, the error will be trapped and should appear in the log instead of the Exscriptor simply crashing.Enrico777 wrote:The crash to desktop happened again: I clicked on the [+] and [-] for a bit and it CTD. I remember which sign I clicked last: It was the [-] in front of "Formations" in the "Objects" list.
Do you mean the way it's almost overlapping the text boxes underneath it? If so, I've fixed this now (don't know how I missed it originally, actually). If that's not what you mean, then I'm confused... everything else looks normal to me.Enrico777 wrote:Also the "Object commands" list doesn't show the texts correctly. See screenshot:
Thanks for the help!Keep up the good work.
I told you why it's crashing underneath the crash log. It doesn't find a function to handle double clicks.Whimsy wrote: I still don't understand why this is happening, nor have I been able to reproduce it, but I've improved the function in question so hopefully, if it does happen again, the error will be trapped and should appear in the log instead of the Exscriptor simply crashing.
Edit: In 1.0009 it doesn't crash anymore.
I haven't been scripting for a while, but isn't it supposed to show clear text instead of things like COMMAND_TYPE_NAV_46 ?Whimsy wrote:Do you mean the way it's almost overlapping the text boxes underneath it? If so, I've fixed this now (don't know how I missed it originally, actually). If that's not what you mean, then I'm confused... everything else looks normal to me.Enrico777 wrote:Also the "Object commands" list doesn't show the texts correctly. See screenshot:
That looks to me as if it doesn't find the texts. This was happening on the other lists as well, until I fixed the files.
It's actually crashing inside the double click handling function - which is really simple, so I couldn't see why it might be crashing. Hence my confusion. But I'm glad it's not crashing now, anyway...Enrico777 wrote:I told you why it's crashing underneath the crash log. It doesn't find a function to handle double clicks.
Edit: In 1.0009 it doesn't crash anymore.
No, it's currently working as intended - it's supposed to use the COMMAND_WHATEVER form, since that's what the ingame editor uses. If it picks up any user defined names from other files then they should be shown beneath the default name (using +/- thingies). Multiple entries under a command mean a conflict (more than one name for the same command). Though you can actually use any of these names in a script, since in the end it all gets converted back to the same number.Enrico777 wrote:I haven't been scripting for a while, but isn't it supposed to show clear text instead of things like COMMAND_TYPE_NAV_46? That looks to me as if it doesn't find the texts. This was happening on the other lists as well, until I fixed the files.
Thanks for finding the other bugs, though - you've been a great help.
Glad to be of service!Draslin wrote:Awesome I have tons of plans for scripting in X3 but the clunky interface has alway frustrated me enormously. This external editor looks much cleaner and easier to use. Might have to reload X3 after all.
Me again!
Great manual you have written. It's actually worth reading!
And thanx for mentioning us there!
I've found a strange thing when making comments: I put * in front of some lines and when I reopened the script later, the commented code was changed! Here is the result:
It removed some ifs and put the logical operands into {} at the end of the lines. I think that's all what has changed (despite the fact that indenting is gone).
Edit: Oh, and I just got another exception "The stack is empty" - after compiling with Exscriptor:
Great manual you have written. It's actually worth reading!
And thanx for mentioning us there!
I've found a strange thing when making comments: I put * in front of some lines and when I reopened the script later, the commented code was changed! Here is the result:
Code: Select all
* $Quest = $Needed $Total {==}
* $Time = playing time
* $Quest = $Time $End {>}
* $Message = sprintf: pageid=$Page.ID textid=2025, $Employer, $Time, $End, null, null
* $Message = sprintf: pageid=$Page.ID textid=2025, $Employer, $Total, $Ware, null, null
* set quest state with message: quest=$Quest state=[Quest.Aborted] msg=$Message
* send incoming message $Message to player: display it=[TRUE]
* return null
* end
* end
Edit: Oh, and I just got another exception "The stack is empty" - after compiling with Exscriptor:
The log is empty, too.************** Ausnahmetext **************
System.InvalidOperationException: Der Stapel ist leer.
bei System.Collections.Stack.Pop()
bei X3_Script_Editor.Compiler.finaliseJumps()
bei X3_Script_Editor.Compiler.parse(ArrayList code, ArrayList arguments)
bei X3_Script_Editor.Editor.menuCompile(Object sender, EventArgs e)
bei System.Windows.Forms.MenuItem.OnClick(EventArgs e)
bei System.Windows.Forms.MenuItem.MenuItemData.Execute()
bei System.Windows.Forms.Command.Invoke()
bei System.Windows.Forms.Command.DispatchID(Int32 id)
bei System.Windows.Forms.Control.WmCommand(Message& m)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)
bei System.Windows.Forms.ContainerControl.WndProc(Message& m)
bei System.Windows.Forms.Form.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
No problem! Glad someone read it.Enrico777 wrote:Great manual you have written. It's actually worth reading! And thanx for mentioning us there!
I must have forgotten to add this to the known bug list in the manual. If you use conditionals in a commented out command (like an if, or a while) then the Exscriptor basically ignores them since it cannot calculate where the corresponding end might be. That's why your ifs are disappearing (and thus the indentation).Enrico777 wrote:I've found a strange thing when making comments: I put * in front of some lines and when I reopened the script later, the commented code was changed!
However, there might still be something weird going on with those operators - could you post the original code, before the Exscriptor screwed it up? That way I can recreate the problems myself and hopefully fix them.
Alternatively I might just change it to ignore commented commands altogether and just treat them as text, since they're more trouble than they're worth... You'd only notice the difference if you tried to uncomment it in the ingame editor anyway.
Hmm, I think I know what caused that - it's probably because the ends don't match up with ifs or whiles (or vice versa). I'll fix it in the next version.Enrico777 wrote:Edit: Oh, and I just got another exception "The stack is empty" - after compiling with Exscriptor:
Sure, there you go:Whimsy wrote: However, there might still be something weird going on with those operators - could you post the original code, before the Exscriptor screwed it up? That way I can recreate the problems myself and hopefully fix them.
Code: Select all
if $Needed == $Total
$Time = playing time
if $Time > $End
$Message = sprintf: pageid=$Page.ID textid=2025, $Employer, $Total, $Ware, null, null
set quest state with message: quest=$Quest state=[Quest.Aborted] msg=$Message
return null
end
end
Okay, I've rummaged around a little in the innards of the Exscriptor and fixed a few problems, resulting in V1.010. In particular:
- fixed the weird {==} thing that appeared
- fixed a subtle problem with the script loading process that meant it was unable to check the parameters of call commands (it will now tell you if you try to use too many parameters)
- changed it so that all comments are now compiled as simple text, not as commands (this means you won't be able to uncomment them in the game, but does mean there will be less bugs). Note you can still load commented commands as normal.
And with any luck, I haven't broken anything important in the process.
- fixed the weird {==} thing that appeared
- fixed a subtle problem with the script loading process that meant it was unable to check the parameters of call commands (it will now tell you if you try to use too many parameters)
- changed it so that all comments are now compiled as simple text, not as commands (this means you won't be able to uncomment them in the game, but does mean there will be less bugs). Note you can still load commented commands as normal.
And with any luck, I haven't broken anything important in the process.
Great! I wanted to post the problem with the call commands yesterday, but I thought you already noticed - and now you even fixed it.Whimsy wrote: - fixed the weird {==} thing that appeared
- fixed a subtle problem with the script loading process that meant it was unable to check the parameters of call commands (it will now tell you if you try to use too many parameters)
- changed it so that all comments are now compiled as simple text, not as commands (this means you won't be able to uncomment them in the game, but does mean there will be less bugs). Note you can still load commented commands as normal.
Btw, I successfully wrote a script with Exscriptor yesterday. Only one Exception(most probably my own fault) and one odd situation afterwards. Nothing to worry about.
Relaxed Compiler:
-> Your compiler doesn't moan about this:
But it seems to be invalid code (or another problem) because this is what the internal editor makes of it:
[ external image ]
The red thing is counted as a variable by the internal editor. So I had to separate that into two lines.
-> Also I tried to assign multiple values to an array (before I learned that it's not possible) like this:
That was totally okay for your compiler, while it doesn't work in X3. Maybe it's possible to block that to make noobs like me realize that it won't work?
Request:
Could you add drag and drop to the script window? I have lots of scripts in the folder and usually close the script when I (think I) am done. So I always have to scroll to the right script. Just a minor request if it's easy to do.
-> Your compiler doesn't moan about this:
Code: Select all
if $min_tc == $tc_array_s [$tc_a_i]
But it seems to be invalid code (or another problem) because this is what the internal editor makes of it:
[ external image ]
The red thing is counted as a variable by the internal editor. So I had to separate that into two lines.
-> Also I tried to assign multiple values to an array (before I learned that it's not possible) like this:
Code: Select all
$array = 'A', 'B', 'C'
That was totally okay for your compiler, while it doesn't work in X3. Maybe it's possible to block that to make noobs like me realize that it won't work?
Request:
Could you add drag and drop to the script window? I have lots of scripts in the folder and usually close the script when I (think I) am done. So I always have to scroll to the right script. Just a minor request if it's easy to do.
Ah, expressions. I loathe parsing these things - virtually anything goes. But in this case, it is invalid - I'm pretty sure that you can't use array variables like that; you have to extract the value out first. It would be easier but X3 sadly doesn't seem to allow it (though please correct me if I'm wrong).Enrico777 wrote:Relaxed Compiler:
-> Your compiler doesn't moan about this:Code: Select all
if $min_tc == $tc_array_s [$tc_a_i]
But it seems to be invalid code (or another problem)
Nevertheless, you're quite right - the compiler should pick up on it, which it now does (in theory, anyway!).
Yeah, this would be nice to have too! I actually thought about extending the syntax with extra features - the one I had in mind was a "for" command that would convert fromEnrico777 wrote:-> Also I tried to assign multiple values to an array (before I learned that it's not possible) like this:Code: Select all
$array = 'A', 'B', 'C'
That was totally okay for your compiler, while it doesn't work in X3. Maybe it's possible to block that to make noobs like me realize that it won't work?
Code: Select all
for i = 0 to $size inc 1
Code: Select all
$i = -1
while $i < $size
$i = $i + 1
Anyway, back to the point - V1.011 should pick up on this too (it will complain about invalid characters in the expression).
Good idea - I wish I'd thought of it! It's now implemented in the new version. You can even open multiple files at once (just like you can the normal way).Enrico777 wrote:Request:
Could you add drag and drop to the script window? I have lots of scripts in the folder and usually close the script when I (think I) am done. So I always have to scroll to the right script. Just a minor request if it's easy to do.
I would. But I understand that it's a lot of work for something that isn't your fault. Exscriptor is already better than the internal editor in my opinion, so you don't have to strive for perfection.Yeah, this would be nice to have too! I actually thought about extending the syntax with extra features - the one I had in mind was a "for" command that would convert from
toCode: Select all
for i = 0 to $size inc 1
automatically, so you could use it as a sort of shortcut or macro. Array initialisation could have been another possibility. But in the end I decided that it was a lot of effort and likely nobody would use it anyway...Code: Select all
$i = -1 while $i < $size $i = $i + 1
I really appreciate the time and work you invest into Exscriptor, to make it as good as possible!
Thanks! I'm glad to know that it's proving useful for people.Enrico777 wrote:I really appreciate the time and work you invest into Exscriptor, to make it as good as possible!
Anyway, further to my comments earlier, I've cooked up a new version that allows you to use preprocessor macros. The ones I've done so far are a foreach, two for loops, and a dim - the array initialisation you mentioned. Basically, you can use them as normal commands and then before it compiles, it expands them to the equivalent script commands. For example, the foreach looks like this:
Code: Select all
foreach $x in $array
Code: Select all
$iterator = size of array $array
while $iterator
dec $iterator =
$x = $array[$iterator]
Let me know if you think of any more macros that might be useful (and not too complicated to implement!).
Complete AWESOMENESS!!!Whimsy wrote: Anyway, further to my comments earlier, I've cooked up a new version that allows you to use preprocessor macros. The ones I've done so far are a foreach, two for loops, and a dim - the array initialisation you mentioned. Basically, you can use them as normal commands and then before it compiles, it expands them to the equivalent script commands.
At the moment I cannot think of other useful macros, but I am far from being a pro scripter in X3. Btw, I just finished my little script project (* 100% done with Exscriptor) so I might be scripting less until I start something new. So maybe less input from me.
Anyway, due to my laziness, I have some small requests:
- Could you add the path to /scripts automatically after selecting the X3 folder? I know, it's literally NO WORK to select two folders, but since I have set up Exscriptor quite often these days, I thought it would probably be easy to change in the setup process.
- Another request of laziness: Could you make a .bak copy of overwritten scripts, so one can easily revert to the previous version? This is actually not only laziness: I made a mistake yesterday and overwrote my modified script with the original version. So all efforts were lost. If I had a auto .bak, I could have restored the previous version before the mistake at least.
- A more serious suggestion: Would it be possible to edit Script Arguments - or change their position (move them up/down)? It's rather annoying if you "change" (delete/create) one argument, you probably have to redo the others too, to fit the hierarchy. Although it happens rarely.
You see, I am running out of bugs, starting nit-picking.
Edit - found more to pick:
- Would it be hard to include a search function to quickly find some code segments in the editor?
- Your Options window can be maximized. Looks odd. Okay, okay I'll stop.
If you still like me after this post, I would appreciate if you use my other nick 'Cebraio' in the manual - not that it would be much better, but ... yeah it is better than this crappy name that I selected.
I'll run around and do some advertising for Exscriptor now ....
Ceb.
I got sick of having to do that as well, every time I tested a new version. Done.Enrico777 wrote:Anyway, due to my laziness, I have some small requests:
- Could you add the path to /scripts automatically after selecting the X3 folder? I know, it's literally NO WORK to select two folders, but since I have set up Exscriptor quite often these days, I thought it would probably be easy to change in the setup process.
Good idea. Done.Enrico777 wrote:- Another request of laziness: Could you make a .bak copy of overwritten scripts, so one can easily revert to the previous version? This is actually not only laziness: I made a mistake yesterday and overwrote my modified script with the original version. So all efforts were lost. If I had a auto .bak, I could have restored the previous version before the mistake at least.
Done.Enrico777 wrote:- A more serious suggestion: Would it be possible to edit Script Arguments - or change their position (move them up/down)? It's rather annoying if you "change" (delete/create) one argument, you probably have to redo the others too, to fit the hierarchy. Although it happens rarely.
Trickier than it looks... but still Done.Enrico777 wrote:- Would it be hard to include a search function to quickly find some code segments in the editor?
Fixed. Or rather, Done.Enrico777 wrote:- Your Options window can be maximized. Looks odd. Okay, okay I'll stop.
Done, since you asked so nicely.Enrico777 wrote:If you still like me after this post, I would appreciate if you use my other nick 'Cebraio' in the manual - not that it would be much better, but ... yeah it is better than this crappy name that I selected.
And as a bonus feature the Exscriptor now remembers if you had any scripts open when you closed it and will reload them again next time it starts. All this and more in the sparkly new V1.013. Which means poor V1.012 was probably the shortest lived version ever...
I must say, even though I'm not a scripter but just a dabbler in other people's code ( ), I do like this handy program a lot. So I've found a few suggestions as well, although I don't really expect these to go high up on your priority list... Still:
- Do you think it might be possible to make file tabs (when you have multiple documents open) closable on double / middle click, just like in Firefox or Visual Studio? When I "work" with scripts it's most often because I try to resolve some conflicts in different scripts, so I have to go through a lot of files following the chain of sub-scripts, most of which won't be changed at all. Of course there's Ctrl+W, but I'm a mouse guy... This is purely for convenience, really.
- From the same approach I think a 'compare scripts' function might be useful - that is, something like WinMerge, where you choose two files that will be displayed next to each other. Highlighting of differences would be awesome, but just having them on the screen right next to each other would be great. WinMerge is useless for X-scripts because it doesn't process the .xsl file, so all the useless clutter ES uses to format the script files destroys any chance of actually noticing any differences. Exscriptor might be perfect for such a function.
- And one more convenience item: I'd like to be able to shift the dividing bar between the code and the command panes to the right, i.e. resize them in favor of the code view pane.