Script Engine Changes
Moderators: Moderators for English X Forum, Scripting / Modding Moderators, Moderators for the X3:FL Forums
-
- Moderator (Script&Mod)
- Posts: 22254
- Joined: Sun, 14. Nov 04, 23:26
Re: Script Engine Changes
it should be RetVar rather than RefObj. But it basically it converts the dockport.flags into a string. The string is simply read from the text files.
the get ship in docking port command should return the ship thats docked at a given port. Note that this only works for external docks, where the ship physically takes a slot while docked
the get ship in docking port command should return the ship thats docked at a given port. Note that this only works for external docks, where the ship physically takes a slot while docked
-
- Posts: 161
- Joined: Wed, 11. Jun 08, 21:40
Re: Script Engine Changes
How to use this script command correctly?
After its execution, when shooting at an asteroid, containers with goods are endlessly created. Is that how it should be?
What does this parameter set?
Code: Select all
$asteroid-> add asteroid hidden ware: ware={Ware}, amount=0, discovery points=0
What does this parameter set?
Code: Select all
discovery points=0
-
- Moderator (Script&Mod)
- Posts: 22254
- Joined: Sun, 14. Nov 04, 23:26
Re: Script Engine Changes
It should just create the crate when the asteroid is destroyed. Are you saying its producing these when you attack but not kill the asteroid?
the discovery points parameter assigns a number of discovery points to the crate when you collect it
the discovery points parameter assigns a number of discovery points to the crate when you collect it
-
- Posts: 161
- Joined: Wed, 11. Jun 08, 21:40
-
- Posts: 161
- Joined: Wed, 11. Jun 08, 21:40
Re: Script Engine Changes
Unoffical Patch : V1.3.5 : 2023-04-01
In x3story.obj code for commands:
incorrect parameters are set. It costs 10(Var/Number), but should be 7(Script Name) and 11(Var/String), respectively.
In x3story.obj code for commands:
Code: Select all
<t id="3180">unregister god event script: script=%0</t>
<t id="3182">unregister god event script: scriptname=%0</t>
-
- Posts: 161
- Joined: Wed, 11. Jun 08, 21:40
Re: Script Engine Changes
Code: Select all
<t id="3210">%1%0 get sector colour</t>
<t id="3211">%0 set sector colour: %1</t>
But I would like these script commands to work here too http://dna.su.kg/images/f/fb/2.png
here http://dna.su.kg/images/4/4a/1.png
and here http://dna.su.kg/images/1/10/3.png
Last edited by X2-Illuminatus on Thu, 13. Apr 23, 18:56, edited 3 times in total.
Reason: Removed img links, as they don't work on urls starting with http. anymore. Must be https now.
Reason: Removed img links, as they don't work on urls starting with http. anymore. Must be https now.
-
- Moderator (Script&Mod)
- Posts: 22254
- Joined: Sun, 14. Nov 04, 23:26
Re: Script Engine Changes
The images are not displaying?
-
- Moderator (Deutsch)
- Posts: 24969
- Joined: Sun, 2. Apr 06, 16:38
Re: Script Engine Changes
Works for me, when clicking on the image links. (I removed the img-tags, since they won't work on http urls, anymore. It must be https now.)
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
-
- Posts: 161
- Joined: Wed, 11. Jun 08, 21:40
Re: Script Engine Changes
What are these tags:
\053\062\060
What are they for?
\053\062\060
What are they for?
-
- Moderator (Script&Mod)
- Posts: 22254
- Joined: Sun, 14. Nov 04, 23:26
Re: Script Engine Changes
They are ascii escape characters
It equals, +20
The + character doesn't work correctly when exporting from the text dB so it's replaced with \053
When adding a number on the end the game treated the whole thing as an escape character so didn't work correct, so the 20 was also converted
It equals, +20
The + character doesn't work correctly when exporting from the text dB so it's replaced with \053
When adding a number on the end the game treated the whole thing as an escape character so didn't work correct, so the 20 was also converted
-
- Posts: 92
- Joined: Tue, 14. Feb 17, 10:06
Re: Script Engine Changes
Hi Cycrow,
I've run into a spot of bother while updating my Colour By Race plugin and I'm hoping you can help.
I'm trying to swap out the old [SIGNAL_CHANGESECTOR] with the new [SIGNAL_CREATED] to save some CPU cycles in Farnham's Legend. [SIGNAL_CREATED] will trigger for newly created stations but not ships. I've tried a few different variations of class, race, priority etc but to no avail. I'm using the command:
I can't find any documentation on [SIGNAL_CREATED] and couldn't find any examples of it being used to compare with my own code. I'm running your unofficial patch 1.3.8. Is it correct behaviour for [SIGNAL_CREATED] to only trigger for stations? Have I perhaps found a bug? Or am I doing something stupid?
-----------------------------
On another subject - does the new signal [SIGNAL_OWNERCHANGED] work for sectors? My initial experiments suggest that it doesn't but I'm curious how it works.
Now with the command we have an easy way to run through the universe setting race coloured sectors. But I'm wondering if there's a way to trigger the event of a sector's owner changing so it can be immediately recoloured.
I've run into a spot of bother while updating my Colour By Race plugin and I'm hoping you can help.
I'm trying to swap out the old [SIGNAL_CHANGESECTOR] with the new [SIGNAL_CREATED] to save some CPU cycles in Farnham's Legend. [SIGNAL_CREATED] will trigger for newly created stations but not ships. I've tried a few different variations of class, race, priority etc but to no avail. I'm using the command:
Code: Select all
global secondary signal map: add signal
-----------------------------
On another subject - does the new signal [SIGNAL_OWNERCHANGED] work for sectors? My initial experiments suggest that it doesn't but I'm curious how it works.
Now with the
Code: Select all
%0 set sector colour: %s
I made a couple of X3 mods | Colour By Race | True Relations
-
- Moderator (Script&Mod)
- Posts: 22254
- Joined: Sun, 14. Nov 04, 23:26
Re: Script Engine Changes
SIGNAL_CREATED should work for ships as well. What are you setting as the class ?
setting Class to "Ship" and race to "null" should work for all ships. At least its working fine for me when i tried.
Signals dont work on Sectors as sectors are not event objects.
However, in 1.3.9, you will be able to attach events to sectors. You still wont be able to use signals though (signals only work for objects that scripts can run on, this is limited to ships and stations). But you can use the Event.SetOwner, when used with $sector -> attach event script.
You will have to do it for each sector, just cycle through all sectors and attach the event script, then it'll trigger on any owner change.
setting Class to "Ship" and race to "null" should work for all ships. At least its working fine for me when i tried.
Signals dont work on Sectors as sectors are not event objects.
However, in 1.3.9, you will be able to attach events to sectors. You still wont be able to use signals though (signals only work for objects that scripts can run on, this is limited to ships and stations). But you can use the Event.SetOwner, when used with $sector -> attach event script.
You will have to do it for each sector, just cycle through all sectors and attach the event script, then it'll trigger on any owner change.
-
- Posts: 92
- Joined: Tue, 14. Feb 17, 10:06
Re: Script Engine Changes
Yep that worked. It also works if I set a more specific class such as [M3]. But setting a specific race causes it to fail. That's not the end of the world if it's intended behaviour but setting a specific race works fine for station classes.
As an example I currently have a signal specific to pirate M7s to check for Pirate Guild Mob Bosses. It would waste a few CPU cycles to have to perform this check for every race.
But now a bigger problem reveals itself - SIGNAL_CREATED behaves differently between stations and ships. When triggered for a station I get the owner race along with a fully formed name, sector location etc. When it triggers for a ship it seems to be earlier in the process because the ship has no race applied, no name apart from ship type, no job etc. Is this intended behaviour? Because if so I'll have to stick with SIGNAL_CHANGESECTOR for my use case - I need to be able to query the race and name.
That's awesome, looking forward to trying it out!Cycrow wrote: ↑Wed, 31. May 23, 20:36Signals dont work on Sectors as sectors are not event objects.
However, in 1.3.9, you will be able to attach events to sectors. You still wont be able to use signals though (signals only work for objects that scripts can run on, this is limited to ships and stations). But you can use the Event.SetOwner, when used with $sector -> attach event script.
You will have to do it for each sector, just cycle through all sectors and attach the event script, then it'll trigger on any owner change.
Last edited by FriendlyFirePhoenix on Thu, 1. Jun 23, 16:08, edited 1 time in total.
I made a couple of X3 mods | Colour By Race | True Relations
-
- Moderator (Script&Mod)
- Posts: 22254
- Joined: Sun, 14. Nov 04, 23:26
Re: Script Engine Changes
im guessing this is mainly an issue with how the jobs engines creates its ships.
the signal is sent from the ship creation, so it works for all created ships. But the jobs engine creates a default ship, then applies the settings afterwards, so the signal will be fired before this happens.
you could start a new script with a delay to allow those settings to be applied.
i may look into refiring the created signal for job ships so you will get it twice for job ships once for the actual creation and once after the initilisation. This is also why the race filter wasn't working, as its being fired before the race is set.
the signal is sent from the ship creation, so it works for all created ships. But the jobs engine creates a default ship, then applies the settings afterwards, so the signal will be fired before this happens.
you could start a new script with a delay to allow those settings to be applied.
i may look into refiring the created signal for job ships so you will get it twice for job ships once for the actual creation and once after the initilisation. This is also why the race filter wasn't working, as its being fired before the race is set.
-
- Posts: 92
- Joined: Tue, 14. Feb 17, 10:06
Re: Script Engine Changes
Thanks, that makes sense. I've tried using waits in signal scripts before and it was a bit of schemozzle. If I opened a sector map, the map would wait to appear on screen about the same amount of time as the sum of the waits for the civilian ships being spawned there. This was in AP, not FL but generally seems likes a bad idea based on that behaviour.
Note that I was simply using the "wait %s ms" and "wait randomly from %s to %s ms" commands. If there's a better way to do it I'm all ears.
Having the signal fire twice would work for me. Is there actually any utility of firing the signal before the jobs engine has gotten to it? Why not just move it?
Note that I was simply using the "wait %s ms" and "wait randomly from %s to %s ms" commands. If there's a better way to do it I'm all ears.
Having the signal fire twice would work for me. Is there actually any utility of firing the signal before the jobs engine has gotten to it? Why not just move it?
I made a couple of X3 mods | Colour By Race | True Relations
-
- Moderator (Script&Mod)
- Posts: 22254
- Joined: Sun, 14. Nov 04, 23:26
Re: Script Engine Changes
You shouldn't wait in signal scripts generally, especially if they are secondary signals.
Instead you create a seperate script with a wait in and run that
$task = [THIS] -> get next available task: starting=[Task.Custom]
[THIS] -> start task ....
Then in that script you add the wait and do the rest
Instead you create a seperate script with a wait in and run that
$task = [THIS] -> get next available task: starting=[Task.Custom]
[THIS] -> start task ....
Then in that script you add the wait and do the rest
-
- Moderator (Script&Mod)
- Posts: 22254
- Joined: Sun, 14. Nov 04, 23:26
Re: Script Engine Changes
The reason for not moving it is that the jobs engine is not the only place that creates ships.
So to move it elsewhere would require finding and adding it in all places that creates the ships, and also mean it wouldn't work with any scripts that also create ships
So to move it elsewhere would require finding and adding it in all places that creates the ships, and also mean it wouldn't work with any scripts that also create ships
-
- Posts: 161
- Joined: Wed, 11. Jun 08, 21:40
Re: Script Engine Changes
The script command
returns task numbers one greater.
Does this mean that 1 must be subtracted from the returned value, or is this a bug in the code?
Code: Select all
<t id="2429">%1%0get all tasks with script on stack=%2</t>
Does this mean that 1 must be subtracted from the returned value, or is this a bug in the code?
-
- Posts: 161
- Joined: Wed, 11. Jun 08, 21:40
Re: Script Engine Changes
What flags does this command use?
Code: Select all
<t id="2972">%0set override name flags: %1</t>
-
- Posts: 161
- Joined: Wed, 11. Jun 08, 21:40
Re: Script Engine Changes
I don’t understand how I can assign several hot keys to one executable script?
This used to work with register hotkey 'String' to call script name 'String' but doesn't work now.
This used to work with register hotkey 'String' to call script name 'String' but doesn't work now.