Scripting Bug

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

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

strude
Posts: 1471
Joined: Wed, 3. Aug 05, 08:15
x4

Scripting Bug

Post by strude »

Not sure if it's just me, but when I use the script function "get gate destination: return sector" from the Universe and Sector commands group, the script will not save from that point on. My usage is

$nextdoor = South Gate get gate destination: return sector= 1

$nextdoor is the return value and is a new variable
South Gate is of type <var/warpgate> and is selected from by choosing Select Warpgate
1 is of type <var/number> and is entered as a number

There are no errors. When I exit the script, it asks me if I want to save it, to which I say yes. I can run the script and everything works as I expect it to. I can go back into the script and make changes and everything appears normal. Everything is fine until I exit the game and go back in (or alt tab out and look at the xml file generated) and any changes made after I have used this function are not there. I can however delete any use of this function from the script, and after I do that, changes will be saved again.

This can be repeated (at least in my game) by doing the following. Using the Boring Boron start

- Make a new script and have it do something like add an advanced sat to the current sector using

$sat= create ship: type= Advanced Satellite owner=Player addto= Kingdoms End x= 0 y= 0 z= 0

- Exit and run the script, confirm that the sat is placed
- Exit the game to the main menu, then start a new game using the same start
- Rerun the script and ensure it still works correctly
- Edit the script and add the following functions

$nextdoor = South Gate get gate destination: return sector= 1
$nextdoor -> set known status to TRUE

- Exit and run the script, confirm that the sector Three Worlds is now visible on the universe map
- Exit the game to the main menu, then start a new game using the same start
- Edit the script

If you have the same as me, you'll find the two additional lines you added are not there, and running the script will not reveal the Three Worlds sector. Additionally, if you add those two lines to the script, save the script and alt tab out, you can see that the changes haven't been saved by opening the script xml file in a text editor. If you then go back into TC and delete only the "get gate ddestination" line, save and alt tab, you will find the script xml file now contains the original add satellite line and the set known line, so the saving has worked once the get gate destination line is removed.
Since I'm running Steam I can't check it this is still present in the V2 patch version. Hopefully this isn't on some list of know bugs, and hopefully I'm not doing something silly causing it not to save??

Any thoughts?
Last edited by strude on Mon, 9. Feb 09, 18:05, edited 1 time in total.
Gaming PC: Gigabyte H270M-D3H | i7 7700 | 16Gb DDR4 | Gigabyte GTX1060 6Gb OC | Asus Xonar DGX | Window 10 Home 64bit | Samsung 256Gb SSD
eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan »

You're using an existing object (South Gate) - once you do that, the script won't save. This is to avoid a situation in which the script is used in a game where that object doesn't exist.
strude
Posts: 1471
Joined: Wed, 3. Aug 05, 08:15
x4

Post by strude »

So I'll need to get the array of stationary objects and select the correct gate that way?
Gaming PC: Gigabyte H270M-D3H | i7 7700 | 16Gb DDR4 | Gigabyte GTX1060 6Gb OC | Asus Xonar DGX | Window 10 Home 64bit | Samsung 256Gb SSD
eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan »

strude wrote:So I'll need to get the array of stationary objects and select the correct gate that way?
I could be totally wrong (I'm a bit rusty) but I think there's a command for dealing specifically with gates.
User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13489
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid »

''find gate....'' under universe and sector commands.


Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
strude
Posts: 1471
Joined: Wed, 3. Aug 05, 08:15
x4

Post by strude »

Thanks for that. I did see that one there, but didn't really know how to use it. I'll check it out
Gaming PC: Gigabyte H270M-D3H | i7 7700 | 16Gb DDR4 | Gigabyte GTX1060 6Gb OC | Asus Xonar DGX | Window 10 Home 64bit | Samsung 256Gb SSD

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