[Discussion] Generic X3TC S&M questions II
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 7232
- Joined: Fri, 9. Apr 04, 21:19
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Either by using the ingame script list to copy the script using "c" and thereby giving it a new name, or by using the Exscriptor and simply saving the script under a different name.
Still unanswered questions of mine in the following post: Link
Greetings,
ScRaT
Still unanswered questions of mine in the following post: Link
Greetings,
ScRaT
-
- Moderator (Script&Mod)
- Posts: 22438
- Joined: Sun, 14. Nov 04, 23:26
not enterly sure which RegEx parser is used, but most standard regex should work. However, it is abit fussy. u might just have to play around with it until u get it right.ScRaT_GER wrote:I have a short question concerning the RegEx Engine used by X3:TC.
I want to match roman digits I, V and X. So only if a string consists of these digits, I want a match.
The regular expression which should fullfill this need should be the following one: ^(I|V|X)+$
According to an online RegEx checker this works.
However it does not work with X3:TC.
I'm reading the RegEx from a T-File, where it is defined like this:Reading this text from the T-File and logging it to the logbook shows, that everything is unescaped correctly.Code: Select all
<t id=10003">\^\(I\|V\|X\)+\$</t>
But unfortunately it just won't match any romand digits. So XVII is not a match for ^(I|V|X)+$ - at least not in X3:TC.
Is it a mistake on my side - and if so, how can I make it work - or is the X3:TC RegEx Engine not capable of processing this RegEx?
i would remove the $ at the end and try that
the start wasn't added due to it not working correctly or having any proper testing.ScRaT_GER wrote:When using the "call named script" command, I noticed that in the ingame SE the option "START" is not available.
However, in the Exscriptor it is possible to use that startoption and it works perfectly well, as long as you START the script on an object.
If you START it globally, it will call the script in an infinite loop which can crash your game:So was the START option forgotten or left out on purpose? If the latter applies, why was it left out?Code: Select all
* works perfectly well: START [PLAYERSHIP]->call named script: script='a.test', null, null, null, null, null * crashes your game: $null = null START $null->call named script: script='a.test', null, null, null, null, null
there is the start named script command as well thou, which will do the same thing but work properly
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Thanks for the answers, Cycrow.

Greetings,
ScRaT
Mh, I think I already tried that. I guess, I shall try harder then.i would remove the $ at the end and try that

Oh, okay...the start wasn't added due to it not working correctly or having any proper testing.
The problem with this command is, that it cannot start global scripts. However I wrote a workaround, which works by calling the appropriate command depending on the object the script is running on.there is the start named script command as well thou, which will do the same thing but work properly
Greetings,
ScRaT
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 7232
- Joined: Fri, 9. Apr 04, 21:19
If you mean from an argument then I can't help you, only just started experimenting with those myself. . . just poke though all the different options.EmperorJon wrote:I've forgotten how to get a Yes/No user input...Which command!
If you mean on an incoming message then Cycrows guide might help:
http://cycrow.thexuniverse.us/scripts/h ... index.html
Question of my own.
Arrays.
Just started poking around with these too, but can't see their utility. I must be missing something.
The following command for example:
Code: Select all
<RetVar> = <RefObj> get ship array from sector/ship/station
How would I for example start applying other commands to EVERY element of an array.
A good tutorial on arrays would be nice if someone could point one out, the MSCI handbook only skims the details and the link here is dead
"Shoot for the Moon. If you miss, you'll end up co-orbiting the Sun alongside Earth, living out your days alone in the void within sight of the lush, welcoming home you left behind." - XKCD
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
So you want to grab everything in the array and do something?
For example, get all ships in the sector and change their name?
You have to cycle through the array and apply it individually to each...
So, for this example you would have...
(Variable 'Count' is just a good choice for easy understanding)
$Array = array of all ships in sector
$Count = size of array
While $Count
Dec. $Count
$Ship = $Array [$Count]
(Then, all the commands go fro $Ship here!)
To talk through it...
1. Gets the array.
2. Sets Count as the size of the array.
3. Basically, whilst count exists/is above 0...
4. Decrease it.
5. Ship is the part of the array at that level of decreasement, that count.
Then, it goes back to the while because it's still not 0, and continues for everything in the array.
For example, get all ships in the sector and change their name?
You have to cycle through the array and apply it individually to each...
So, for this example you would have...
(Variable 'Count' is just a good choice for easy understanding)
$Array = array of all ships in sector
$Count = size of array
While $Count
Dec. $Count
$Ship = $Array [$Count]
(Then, all the commands go fro $Ship here!)
To talk through it...
1. Gets the array.
2. Sets Count as the size of the array.
3. Basically, whilst count exists/is above 0...
4. Decrease it.
5. Ship is the part of the array at that level of decreasement, that count.
Then, it goes back to the while because it's still not 0, and continues for everything in the array.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 13244
- Joined: Fri, 13. Jan 06, 16:39
Not. This is not a database application.Bishop149 wrote:How would I for example start applying other commands to EVERY element of an array.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
-
- Posts: 7232
- Joined: Fri, 9. Apr 04, 21:19
Ah, ha Brilliant! Thanks a lot for the explanation!EmperorJon wrote:So you want to grab everything in the array and do something?
For example, get all ships in the sector and change their name?
You have to cycle through the array and apply it individually to each...
So, for this example you would have...
(Variable 'Count' is just a good choice for easy understanding)
$Array = array of all ships in sector
$Count = size of array
While $Count
Dec. $Count
$Ship = $Array [$Count]
(Then, all the commands go fro $Ship here!)
That looks extremely similar to another bit of code I was trying to reverse engineer but i couldn't get my head round what it was doing!
"Shoot for the Moon. If you miss, you'll end up co-orbiting the Sun alongside Earth, living out your days alone in the void within sight of the lush, welcoming home you left behind." - XKCD
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Code: Select all
$ware = $station -> get ware type code of object
$price = get maximum price for ware $ware
ScRaT
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Moderator (Script&Mod)
- Posts: 22438
- Joined: Sun, 14. Nov 04, 23:26
EmperorJon wrote:I've forgotten how to get a Yes/No user input...Which command!
Code: Select all
$ret = get user input: Var/Boolean, title='my yes/no question'
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 1131
- Joined: Wed, 6. Nov 02, 20:31
Don't know if this question fits here, but when a station is destroyed GOD-engine usually deploys a replacement after some time.
Now, I've been using the Board Station script by uberex and those stations that I have boarded and taken does not get rebuild by the GOD-engine it seems even after I repack them and move them to another sector. Does the big-G look for a signal or something that triggers the need to rebuild something?
Now, I've been using the Board Station script by uberex and those stations that I have boarded and taken does not get rebuild by the GOD-engine it seems even after I repack them and move them to another sector. Does the big-G look for a signal or something that triggers the need to rebuild something?
-
- Moderator (Script&Mod)
- Posts: 22438
- Joined: Sun, 14. Nov 04, 23:26
dont think it uses signals, i think it just periodically checks what stations are available in the universe, and then builds new ones that are needed/missing
it doesn't always build them back in the same place thou, there are a number of "proposed" stations in the map file, god simply picks one of these that are free and creates it, it will never have them all created at the same time however
it doesn't always build them back in the same place thou, there are a number of "proposed" stations in the map file, god simply picks one of these that are free and creates it, it will never have them all created at the same time however
-
- Posts: 1131
- Joined: Wed, 6. Nov 02, 20:31
Ok, perhaps. I boarded and captured the Ghoul Missile Factory and transported it to my sector a while back. But G' hasn't replaced it yet though, and as far as I know it was the only one in the universe so it should be high on the list. I'll give it a week game-time and see, that should at the very least be enoughCycrow wrote:dont think it uses signals, i think it just periodically checks what stations are available in the universe, and then builds new ones that are needed/missing
it doesn't always build them back in the same place thou, there are a number of "proposed" stations in the map file, god simply picks one of these that are free and creates it, it will never have them all created at the same time however

-
- Posts: 2178
- Joined: Sat, 14. Jan 06, 21:29
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
I was thinking, do stations have a set size of cargobay for each item?
For example, with my PSS stations they hold quite a lot of stuff, but each one only holds as much as the maximum of a really big station, for example it only holds 8 capital weapons, 50,000 energy cells etc.
Would there be a way to mod a station so it held twice, or even thrice as much?
The only effect it would have on the plugin is that it would eat a lot lot lot more!
For example, with my PSS stations they hold quite a lot of stuff, but each one only holds as much as the maximum of a really big station, for example it only holds 8 capital weapons, 50,000 energy cells etc.
Would there be a way to mod a station so it held twice, or even thrice as much?
The only effect it would have on the plugin is that it would eat a lot lot lot more!

______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 13244
- Joined: Fri, 13. Jan 06, 16:39
The "production multiplier" for docks is in Globals.txt and for factories in TFactories.txt.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.