Exscriptor - new external script editor

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Whimsy wrote:You can revel in your hooraisins as the new version includes this function.
Dude, there is a sea of hooraisins in a large vat. I am reveling in this sea of hooraisins!
User avatar
Ponder
Posts: 1585
Joined: Wed, 19. Nov 08, 15:58
x3tc

Post by Ponder »

Whimsy wrote:It should do, yes - Exscriptor reads the TShips file too, and as long as the entries there have corresponding entries in an XML file too (to give them a name), then they should show up. If not, then something may be wrong...
I forget to set the path to my modified .cat but if I set the path I can't open scripts and couldn't see any command/objects on the right side.
This is the text of the errorlog.txt:

Error Log
---------

Exception occurred:
Message: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Stack Trace: bei X3_Script_Editor.XData.resolveXMLReference(String xmlref)
bei X3_Script_Editor.XData.removeXMLrefsFromString(String text)
bei X3_Script_Editor.XData.loadLanguageFiles()
bei X3_Script_Editor.XData.initialise(String pathToX3, String lang, Int32 gameID, String modfile)
bei X3_Script_Editor.Editor.LoadX3Data()
Source: X3 Script Editor V3
Target: System.String resolveXMLReference(System.String)

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

Exception occurred:
Message: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Stack Trace: bei X3_Script_Editor.Editor.LoadFiles(String[] fileNames)
Source: X3 Script Editor V3
Target: Void LoadFiles(System.String[])

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

Exception occurred:
Message: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Stack Trace: bei X3_Script_Editor.Editor.LoadFiles(String[] fileNames)
Source: X3 Script Editor V3
Target: Void LoadFiles(System.String[])

-------------------------------------------
Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy »

Schaf123 wrote:I forget to set the path to my modified .cat but if I set the path I can't open scripts and couldn't see any command/objects on the right side.
Is there any way you can upload your modified cat/dat for me to test? That way I can try to figure out what might be going wrong in this case.
User avatar
Ponder
Posts: 1585
Joined: Wed, 19. Nov 08, 15:58
x3tc

Post by Ponder »

Here is it. Thanks for your help :)
Last edited by Ponder on Fri, 28. Aug 09, 00:55, edited 1 time in total.
Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy »

Schaf123 wrote:Here is it. Thanks for jour help :)
Coincidentally enough, it was caused by an XML comment in your XML file - normally the program should handle them fine but there was one scenario that I obviously missed...

Anyway I've fixed it in the latest version, V1.2.20. Give it a try and hopefully it should work now. :)
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Whimsy, that new Find Calling Script feature is awesome! Personally, I find it lightning quick, considering what its doing.

Thank, sir.
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

I've improved the error handling for this now so that an invalid sector ID won't stop the whole file from loading.
Thanks for the quick fix! Now it works without any problems.

The new 'Find calling scripts' is a cool thing! Might be very useful in case you don't know in how far your changes to a script will influence others.

Thanks again for the excellent work.
Greets,
ScRaT
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

You you what would produce even more hooraisins?

The very opposite of the "find all calling scripts" feature.

Say you've created a massive AL plugin with 23 scripts, and you want to distribute it on the S&M forum. It'd be neat to be able to "find all scripts called" to find everything you'd need to package in order to distribute. Of course, you'd probably run it on the main AL, or the setup script to ensure you're at the bottom level.

Just sayin' s'all.
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Whimsy wrote:
Litcube wrote:You know what would be neat? An option in the Tools menu bar that checks all the scripts in your script directory to see if the current script is being used at all, and if so, opens all those scripts. If not, it lets you know.
That's a good idea - you're right, it could be quite useful. I'll give it a go and see what happens. :)
I just wanted to say thanks again, Whimsy. That feature let me clean up ALOT of scripts! *Really* handy feature to have. Thanks for listening.
Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy »

Firstly, glad you found the 'Find all calling scripts' thingy useful, Litcube! But then it was your idea after all. :)
Litcube wrote:Say you've created a massive AL plugin with 23 scripts, and you want to distribute it on the S&M forum. It'd be neat to be able to "find all scripts called" to find everything you'd need to package in order to distribute. Of course, you'd probably run it on the main AL, or the setup script to ensure you're at the bottom level.
I've not been ignoring this, honest - I just haven't had chance to look at it yet properly. However, I will eventually get round to it and release a new version with this function.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Just an idea for the future version,

I don't suppose its possible to set up multiple folders for scripts?

e.g. I have all my stock scripts in the \scripts folder
And then I have all of my scripts for a particular package I'm working on in the scripts\package

Any chance you can make it work from a folder (e.g. scripts\package) but use also use all scripts in another folder (e.g. \scripts)




Also, I can't seem to find the [ACTION_JUMP]

As from fight.defend.earth
066 ||skip if not $action == [ACTION_JUMP]
But the exscriptor doesn't recognise it





Thirdly
(Lines 18 and 19)
$ship -> add secondary signal: signal={SIGNAL_KILLED}, script='test1', prio=0, name=$scr.var.data
$ship -> add secondary signal: signal={SIGNAL_DAMAGED}, script='test1', prio=0, name=$scr.var.data

- Error on line 19 - Unresolved literal: {SIGNAL_DAMAGED}

It doesn't seem to like that signal

*edit resolved
{SIGNAL_DAMAGED 1010} should be used (The select menu on the side, just uses prints it out with out the 1010 thou)



Fourthly
I don't know whether or not I've posted this before, but I've found the source of the compiler warnings that are incorrect.

if $int >= 0
$pos = [TRUE]
else
$pos = [FALSE]
$int = - $int <------------- Variable int is being used on line 11 before being assigned to.
end

But $int is an argument, so it always exists. It appears to happen when ever you use a minus sign before the variable.




Fifthly, the write to log book commands
write to log file # <Var/Number> append=<Var/Number> value=<Value> (and the other ones too)
only work if you do not include the # character. So it might be best to not include the # in the commands list
User avatar
Ponder
Posts: 1585
Joined: Wed, 19. Nov 08, 15:58
x3tc

Post by Ponder »

Hi Whimsy,
at first you did a great work.

But try this in your exscriptor

Code: Select all

if 90 < $hull < 99
The same line in the InGame SE works, but your Exscriptor say this:
Exscriptor wrote:- Error on line 2 - Invalid expression - tokens remaining. Have you missed something out?
What's wrong with it?
Too geek for real life.
jlehtone
Posts: 22562
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone »

Schaf123 wrote:The same line in the InGame SE works
Define "works". What is it supposed to do? what does it actually do?

It does look like you do attempt:

Code: Select all

IF ( 90 < $hull ) AND ( $hull < 99 )
or

Code: Select all

IF $hull BETWEEN 90 AND 99
but most languages would turn it into:

Code: Select all

IF ( 90 < $hull ) < 99
(or the other precedence)

Which in turn evaluates to

Code: Select all

IF true < 99
or

Code: Select all

IF false < 99
and 'true' and 'false' being usually 0 and 1 both of those are always:

Code: Select all

IF true
(the other precedence evaluating to 'IF false')
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.
User avatar
Ponder
Posts: 1585
Joined: Wed, 19. Nov 08, 15:58
x3tc

Post by Ponder »

with "works" I mean there was no error.

Code: Select all

$hull = [THIS] -> get hull percent
if 90 < $hull < 99
  write to player logbook 'hi'
end
I wanted to test whether I can compare $hull with other values because I want to have different solutions for different cases of $hull. (Hope you can understand it)

I will try your propositions. Thanks for halp and sorry for my cryptic question.
Too geek for real life.
Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy »

s9ilent wrote:I don't suppose its possible to set up multiple folders for scripts?
I'm not sure what you mean here - what do you want it to be able to do over multiple folders? The 'find all calling scripts' function? If so, I'm not sure it would be very worthwhile in that case.
Also, I can't seem to find the [ACTION_JUMP]
It should be under 'Constants', the fourth button. All the ACTION ones are at the top of the list. :)
{SIGNAL_DAMAGED 1010} should be used (The select menu on the side, just uses prints it out with out the 1010 thou)
How very strange - I can't see why it would need the 1010 (or at least why it wouldn't show it in the list). I will investigate and try to fix it in the next version.
I don't know whether or not I've posted this before, but I've found the source of the compiler warnings that are incorrect.
I almost wish I'd never included these compiler warnings as they've never quite worked properly. The problem isn't the minus - I think it's more to do with $int being an argument. I'll try to fix it (again) but at this point I think with every fix to the warnings I end up making it break in some other situation, so no guarantees... :D
So it might be best to not include the # in the commands list
Well spotted - I've fixed this now, so the command list doesn't have the #.
Schaf123 wrote:I wanted to test whether I can compare $hull with other values because I want to have different solutions for different cases of $hull. (Hope you can understand it)

I will try your propositions. Thanks for halp and sorry for my cryptic question.
As jlehtone said, if you want to check that $hull is between 90 and 99, you need to use an expression like this:

Code: Select all

if $hull > 90 AND $hull < 99
I'm not entirely sure why the ingame editor accepts the code you posted, because it doesn't seem to be valid syntax, but either way I doubt it does what you wanted. :wink:

Incidentally if you want to test for different cases of $hull, one way might be to do something like this:

Code: Select all

if $hull > 75
... * Do something when hull is > 75
else if $hull > 50
... * Do something when hull is > 50 and <= 75
else if $hull > 25
... * Do something when hull is > 25 and <= 50
else
... * Do something when hull is <= 25
end
Hope that helps. :)
User avatar
Ponder
Posts: 1585
Joined: Wed, 19. Nov 08, 15:58
x3tc

Post by Ponder »

Whimsy wrote:Hope that helps.
Yes it helps me a lot. I totaly forgot "else if". Thank you!
Too geek for real life.
Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy »

Okay, I've created a new version, V1.2.21. In it I have:

- Fixed the # in the log commands (they should no longer appear in the list)
- Fixed yet another 'used before defined' bug
- Sorted out the SIGNALs; SIGNAL_DAMAGED should work correctly now
- Added a 'Find called scripts' function

Note on the find scripts functions - they both only work on actual calls, i.e. the 'call script', 'interrupt with script', and 'start task' commands. There are other commands (like the global script maps, connecting signals to scripts etc) where scripts are used but not directly called, and these aren't included.

I'm not sure whether that's all that people wanted, or if they want every reference to another script to be included in the search. :?

Anyway, as usual, let me know if you find any bugs etc. :)
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Hey, Whimsy! Good job!

Find called scripts probably should include global script maps. This command is going to be useful for those wanting to package their scripts to the public. I envision someone opening up the scripts "setup" fuction, running this command, and finding all of the script required to support the setup function.

It's quite a frequent problem. I've done it myself, where I forgot to include a particular script in a package, and it causes all sorts of issues.

Does the command "branch out"? Meaning, will it find all called scripts within all called scripts?
Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy »

Litcube wrote:Does the command "branch out"? Meaning, will it find all called scripts within all called scripts?
Not presently. I can see if I can make it recursive when I extend it to the other commands. Do you think it's worthwhile restricting it only to .xml files? That way it should ignore the Egosoft .pck files.
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

I think ignoring .pcks would be a good idea. Probably also !s.

Return to “X³: Reunion - Scripts and Modding”