[PROGRAM] X-Studio 2 Script Editor [Beta III : 30th Mar 14]

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

Jakesnake5
Posts: 2880
Joined: Fri, 17. Feb 06, 04:55
x4

Post by Jakesnake5 » Mon, 9. Jun 14, 10:07

I always wondered why Exscriptor used the apostrophes for string identification, and XS/2 follows suit.

I'd have thought that using " to begin/end a string would be better, as I don't know why anybody would use it in a string to start with, so would, logically, not cause problems. Or, at least, not as many.

Leave it to contractions to cause a script editor problems. :)

As for the script call using [THIS] as an argument being improper, this hasn't stopped people from doing it, and the game seems to accept it. Weird.

Took me a couple tries to figure out which argument check was doing it :)

User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 » Mon, 9. Jun 14, 11:34

Jakesnake5 wrote:I always wondered why Exscriptor used the apostrophes for string identification, and XS/2 follows suit.

I'd have thought that using " to begin/end a string would be better, as I don't know why anybody would use it in a string to start with, so would, logically, not cause problems. Or, at least, not as many.

Leave it to contractions to cause a script editor problems. :)

As for the script call using [THIS] as an argument being improper, this hasn't stopped people from doing it, and the game seems to accept it. Weird.

Took me a couple tries to figure out which argument check was doing it :)
There are reasons to use " in a string, which is why the " escape sequence exists in practically all programming languages, but we wont to too far into that, suffice to say ' is used because the game used ' - in python for example you can use '"' to define a string with a " in it, or "'" to define a string with a ' in it. If you want to represent the name of an object within a string, you need to use " if you want to be grammatically correct.

However ignoring all of the above, its not a good idea to hard-code " or ' into X strings, a supported and better solution would be to use a TextFile:
<t id=1>"%s" - Hello World</t>
Then use the sprintf with textfile lookup - This both provides you with grammar, and translate-ability.

As a matter a fact, the game does prevent passing invalid data (in some limited circumstances) to a script that requests a specific type, when you go to select the passed argument, for say perhaps "number" the script editor in-game will only allow you to input a number. This is meaningless however, as its just a loose guide to what the arguments are ment to be, a variable is a variable in the MSCI, and anything can be passed anywhere - even when error prone or inappropriate.
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire

Jakesnake5
Posts: 2880
Joined: Fri, 17. Feb 06, 04:55
x4

Post by Jakesnake5 » Mon, 9. Jun 14, 18:26

Would help if thing's behaved themselves, but we're stuck with it. However, the xml code for the offending text string is:

Code: Select all

<line linenr="784" indent="  "><text>send incoming message </text><var>'MARS 9000:  I'm sorry Dave, I'm afraid I can't do that.'</var><text> to player: display it=</text><var>[TRUE]</var></line>
As you can see, it defines the text string as a <var>, and exits with </var>, so the game, (and XS) knows what it is. The trouble XS runs into is processing it for compile. It just doesn't work right since XS has nothing to tell it the whole string is a variable, so it hit's a wall with the extra 's.

Maybe XS2 needs to utilize a style sheet like x2script.xsl, to define what we see like the browser does when you double click a script xml. The style sheet tells the browser how to display the code properly, regardless of what that code looks like.

Another tactic, would be to assign the string to a variable, then use the variable instead of a text string.

Actually, I'm surprised that the guys who did M.A.R.S. didn't put that text in the T file and pull it to a var that way.

Trouble is, the way XStudio handles it now, is it forgets that there is a string variable there, and can't handle it when you try to save it.

Maybe if XS were to put a hidden 'flag' of some sort at the beginning and end of the string, and know to just ignore what the string contains when parsing. The game has to do something like that itself.

Would have to put in a selector to identify whether you were typing a variable name or a text string, just to get the data right. :o

User avatar
mr.bear
Posts: 444
Joined: Sat, 11. Dec 10, 01:38
x2

Post by mr.bear » Mon, 9. Jun 14, 21:38

i think the best way to solve this problem is by using an escape character for apostrophes.

btw the script-xml you quoted is only used by the browser - it uses a transforming style sheet to convert xml to html. that entire section is ignored by the game.

mr.bear
Rapunzel, Rapunzel, let down your bear...

Jakesnake5
Posts: 2880
Joined: Fri, 17. Feb 06, 04:55
x4

Post by Jakesnake5 » Tue, 10. Jun 14, 15:25

mr.bear wrote:i think the best way to solve this problem is by using an escape character for apostrophes.

mr.bear
Do you mean adding an esc char before the first and last apostrophes in the string, so XS knows to ignore the ones in the middle? Or replacing ALL of apostrophes? Or just the ones inside the string?

The first and last methods have merit. The 2nd would be a bit messier :)

User avatar
mr.bear
Posts: 444
Joined: Sat, 11. Dec 10, 01:38
x2

Post by mr.bear » Tue, 10. Jun 14, 17:17

it would be like in C/C++ where any apostrophe within a string requires a preceeding backslash.

eg. 'the quick brown fox\'s blue paintbrush'

mr.bear
Rapunzel, Rapunzel, let down your bear...

Jakesnake5
Posts: 2880
Joined: Fri, 17. Feb 06, 04:55
x4

Post by Jakesnake5 » Wed, 11. Jun 14, 17:45

mr.bear wrote:it would be like in C/C++ where any apostrophe within a string requires a preceeding backslash.
That'd be workable.

I program, so know most specifically how to make things work. Others might take a time or two to figure it out. (Mostly the 'I don't RTFM' group) :)

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Sun, 12. Oct 14, 11:36

mr.bear wrote:UPDATE: Nicoman35/AldeberanPrime - I've fixed the issues you were having, they'll be included in the next update
Hi. Did you ever release that update? I did allow beta 3 to update when it first ran.

I am having a similar issue: http://imgur.com/yOkleRC

However, I do not have a 0003* in my addon\t folder, and there is no 0123* file on my disk.

EDIT: From Console.rtf, I see:
Enumerating English language files
Reading language file: I:\X3AP-APCP\addon\t\0001-L044.pck...Success
Reading language file: I:\X3AP-APCP\addon\t\0002.pck...Success
Reading language file: I:\X3AP-APCP\addon\t\0003-L044.pck...Success
Reading language file: I:\X3AP-APCP\addon\t\0010-L044.pck...Success
Reading language file: I:\X3AP-APCP\addon\t\0123-L044.pck...Success
Reading language file: I:\X3AP-APCP\addon\t\0901-L044.pck...

So it appears that XS2 succeeded in reading files that do not exist ;), but it choked on the same 0901 reported previously by Nicoman.
  • (Win8.1 x64)

Nicoman35
Posts: 681
Joined: Thu, 17. Nov 05, 13:12
x3tc

Post by Nicoman35 » Tue, 14. Oct 14, 01:02

DrBullwinkle wrote:Did you ever release that update? I did allow beta 3 to update when it first ran.
No, it was not released. And guess what - it's winter soon... ZZzzz..

Viliae
Posts: 140
Joined: Tue, 12. Apr 11, 22:12
x3tc

Post by Viliae » Tue, 14. Oct 14, 10:51

Hello
DrBullwinkle wrote:(...)
However, I do not have a 0003* in my addon\t folder, and there is no 0123* file on my disk.
(...)]
Sorry Dr but you are wrong, 0123* and 0003* tfiles are hidden in 01.dat.
0003* - contains dialog lines for exporting game stats.
0123* - contains dialog lines for DiD mode and are connected with Steam connection.

Q: 0901* - I read somewhere that is connected with plugin manager (I'm not using it because it erase my saves few times) - can I get it somewhere to look what text lines (page ID and text ID) it has :?: I search for missing lines from pageID=35 (got few readtexts in my game).

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 14. Oct 14, 10:55

Viliae wrote:0123* and 0003* tfiles are hidden in 01.dat.
Derp. :roll:

Thanks.

User avatar
dizzy
Posts: 1019
Joined: Sun, 26. Sep 10, 06:00
x4

Post by dizzy » Wed, 26. Nov 14, 08:48

Yeah I have the same problem with loading those .pck files although in my case it doesn't crash but reports a nice error and I can't use the program to load any script, etc:

Code: Select all

Enumerating type definition files
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TDocks.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TFactories.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TLaser.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TMissiles.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TShields.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TShips.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TWareB.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TWareE.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TWareF.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TWareM.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TWareN.pck...Success
Reading type file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\types\TWareT.pck...Failed: Error in zlib library: incorrect header check

EXCEPTION: Error in zlib library: incorrect header check...  Source: Logic::Threads::GameDataWorker::ThreadMain() on line 95
SOURCE: Logic::IO::GZipStream::Read() on line 240

Failed to load game data : Error in zlib library: incorrect header check

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Wed, 26. Nov 14, 19:40

mr. bear,

Any chance of awaking from hibernation? We eagerly await the next version! :)

I emailed you a patch for some issues compiling X-Studio 2 that I encountered, but did not receive a response. Figured you are just busy or that the changes weren't wanted/needed. Let me know if I can help, I'd be glad to assist in tracking down and fixing bugs in the UI portion of the program.

User avatar
mr.bear
Posts: 444
Joined: Sat, 11. Dec 10, 01:38
x2

Post by mr.bear » Thu, 25. Dec 14, 11:28

merry christmas everybody!

Unfortunately I've been consumed by RL & my day job for the last six months. I don't know when, or even if, I'll have spare time to work on X-Studio or X-Studio II from now on, especially since I may move over to Elite Dangerous if the game is popular.

sorry guys, but X-Studio 1 was an especially huge sink on my time, which I just don't have anymore.

mr.bear
Rapunzel, Rapunzel, let down your bear...

User avatar
jack775544
Posts: 1277
Joined: Tue, 13. Dec 11, 08:27
x4

Post by jack775544 » Thu, 25. Dec 14, 11:53

Omg, he speaks it's a Christmas miracle.
I hope you had a good day and a good new year.

As for work on the program, don't worry about it, it's great already.

Oh and on a semi related side note, I am starting to properly learn to code in C and I have to say it is a pain in the ass. How you mangaged to make this and remain (somewhat) sane is beyond me. But you did it, a feat unto itself.

But once again merry Christmas and have a great holiday.

EDIT: these snow flakes on the forum lag my phone to no end. It's so frustrating to type on.
1940s - Various "computers" are "programmed" using direct wiring and switches. Engineers do this in order to avoid the tabs vs spaces debate.

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Thu, 25. Dec 14, 12:07

That is totally understandable. X-Studio 1.07 has been the best release for me so far. I've had no issues with it at all. Thank you so much for putting that effort into making it. I really appreciate it!

User avatar
dizzy
Posts: 1019
Joined: Sun, 26. Sep 10, 06:00
x4

Post by dizzy » Mon, 29. Dec 14, 21:20

zanzal, can you run X-Studio 1 without giving it admin privileges?

jack775544: let me know if you have any C/C++ questions, I may be able to help

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Thu, 8. Jan 15, 01:12

memeics wrote:zanzal, can you run X-Studio 1 without giving it admin privileges?
Yes, just extract each manifest from each file that has one (check *.dll;*.exe) using CFF Explorer. Then edit each manifest to "asInvoker" instead of "requireAdministrator" - finally, replace the manifest in each file with the modified one.

Gqqnbig
Posts: 66
Joined: Fri, 12. Jul 13, 14:08

Post by Gqqnbig » Tue, 22. Sep 15, 06:26

A common problem here, it doesn't show international characters correctly, at least not Chinese.

The old X-Stduio doesn't have this problem.

I assume if you use standard TextBox control, you will not have this problem.

Irrehaare
Posts: 66
Joined: Sun, 15. Nov 15, 19:20
x3ap

Post by Irrehaare » Sat, 26. Mar 16, 21:16

I'm really sorry for this thread necromancy, but I think it's a good place to ask:

Could something be done with download link? Or could someone contact me on prive and send it on my email?
“A mind is like a parachute. It doesn't work if it is not open.”

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”