Script Engine Changes

The place to discuss scripting and game modifications for X³: Farnham's Legacy

Moderators: Moderators for English X Forum, Scripting / Modding Moderators, Moderators for the X3:FL Forums

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21291
Joined: Mon, 15. Nov 04, 00:26
x4

Re: Script Engine Changes

Post by Cycrow » Fri, 10. Dec 21, 18:41

Deniskos wrote:
Fri, 10. Dec 21, 17:47
As far as I understand, before you extract something using

Code: Select all

$Ret = get abbreviation text: type = 0, key = $Value
$Ret = get abbreviation description: type = 0, key = $Value
need to add something with

Code: Select all

add encyclopedia abbreviation: type = 0, key = $Value, value page = 0, value id = 0, data page = 0, data id = 0
You can also get some of the existing abbreviations as well, as they are added in the same way, you just need to know the key's for them
Deniskos wrote:
Fri, 10. Dec 21, 17:47
For script command

Code: Select all

$Object -> attach event script: events = 0, script = 'ScriptName'
there is really not enough event like [Event.SetHomebase]))
The events are just the existing internal events that are used for things, so it only made these events available via scripts too. the MD uses the same events for some of its cue's as well
Deniskos wrote:
Fri, 10. Dec 21, 17:47
But what this script command is for, I didn't understand something at first glance

Code: Select all

add script event: name = 'String', script = 'ScriptName'
What is it for?
This allows you to create a new event that you can watch for via other scripts and the MD
There is a script command that can trigger these events

the name is the way to identify each event, and you can attach multiple scripts to the same event. So for example, you could trigger some event somewhere, and have any number of scripts that listen for that and do something. This can allow better collaboration between different mods and the MD

its actually used by the explorers guild script to trigger the Terran Plot from the comm script

Deniskos
Posts: 92
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Fri, 10. Dec 21, 19:21

In general, events in SE are a big plus in the performance of the game engine. Rather than creating loops to track events, it is better to use calls or signals in the desired events.
Where were you guys before, respect to you!

Deniskos
Posts: 92
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Tue, 21. Dec 21, 12:42

How do I get the return value in a script command?

Code: Select all

<RetVar> <RefObj> -> open menu script: <scriptname>
It always returns null for me.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21291
Joined: Mon, 15. Nov 04, 00:26
x4

Re: Script Engine Changes

Post by Cycrow » Tue, 21. Dec 21, 13:01

There is more information here
https://www.egosoft.com:8444/confluence ... =102368099

but you return an array from the "arguments" event, and this becomes the return value

Deniskos
Posts: 92
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Sun, 23. Jan 22, 13:11

What does this script command do?

Code: Select all

<RefObj> get docking port class string: flags=<Var/Number>
Spoiler
Show
Image
Maybe it should look like this -

Code: Select all

<RefVar> get docking port class string: flags=<Var/Number>
Also I can't figure out what this script command does?

Code: Select all

<RetVar/If><RefObj> get ship in docking port: port=<Var/Number>
It always returns null for me.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21291
Joined: Mon, 15. Nov 04, 00:26
x4

Re: Script Engine Changes

Post by Cycrow » Sun, 23. Jan 22, 18:55

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

Deniskos
Posts: 92
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Wed, 11. May 22, 08:43

How to use this script command correctly?

Code: Select all

$asteroid-> add asteroid hidden ware: ware={Ware}, amount=0, discovery points=0
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

discovery points=0

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21291
Joined: Mon, 15. Nov 04, 00:26
x4

Re: Script Engine Changes

Post by Cycrow » Fri, 13. May 22, 14:11

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

Deniskos
Posts: 92
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Sat, 14. May 22, 04:06

Cycrow wrote:
Fri, 13. May 22, 14:11
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?
Yes.

Post Reply

Return to “X³: Farnham's Legacy - Scripts and Modding”