specific color for abandoned ship???

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

Archaryon
Posts: 6
Joined: Tue, 30. Apr 13, 18:02

specific color for abandoned ship???

Post by Archaryon » Sat, 4. May 13, 13:36

Hi,

is there a script to have name of abandoned ship in a different color in the sector map menu??

I know that with X3TC XTC (and its scripts included), the abandoned ships appeared in blue, which was convenient to identify them, but I play with X3AP XRM right now and I don't have this "option"

Lord Dakier
Posts: 2842
Joined: Fri, 8. Dec 06, 14:45
x4

Post by Lord Dakier » Sat, 4. May 13, 14:23

I imagine you can create a script for this just like X-Tended did. I don't know personally though.

User avatar
apricotslice
Posts: 13737
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice » Thu, 16. May 13, 15:32

In my mod, they appear in orange. I'd have to look to see which script does it, as it was a long time ago it was written for me.

Its not inherently difficult to do though, using a text file.

edit : found it. This checks the sector and automatically changes all abandonned ships to an orange colour. You can run it manually, or call it from a script you do run regularly.

Code: Select all

001   $PageID = 9915
002   load text: id=$PageID
003   
004   $array.ship =  get ship array: of race Neutral Race class/type=Ship
005   $size =  size of array $array.ship
006   
007   while $size > 0
008   |dec $size = 
009   |$ship = $array.ship[$size]
010   |$is.renamed = $ship -> get local variable: name='AS.Is.Renamed'
011   |if $is.renamed != [TRUE]
012   ||$ship -> set local variable: name='AS.Is.Renamed' value=[TRUE]
013   ||$old.name = $ship -> get name
014   ||$new.name = sprintf: pageid=$PageID textid=100, $old.name, null, null, null, null
015   ||$ship -> set name to $new.name
016   |end
017   |skip if not $size == ( $size / 20 ) * 20
018 @ ||= wait 100 ms
019   end
020   return null
021   
022   
023   
And the text file is ....

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<language id="44">

 
 <page id="9915" title="Messages" descr="Info Nom">

    <t id="100">\033O%s\033x</t>
  
 </page>
</language>

User avatar
joelR
Posts: 1996
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Thu, 16. May 13, 19:25

@apricotslice

Are there any rules to naming a script? Can I name the script to whatever I want?

Thanks for this by the way.

User avatar
Vayde
Posts: 843
Joined: Fri, 6. Feb 04, 22:02
x3tc

Post by Vayde » Thu, 16. May 13, 20:03

Perhaps you could link it to fire on chage sector?
Still life in the old dog yet...

qwizzie
Posts: 561
Joined: Thu, 1. Jun 06, 12:17
x4

Post by qwizzie » Thu, 16. May 13, 22:20

very nice script Apricotslice .. thanks for putting it in this post.

For my own use i changed ''Ship'' to ''Moveable Ship'' in line 004 so astronauts will be excluded from the ''paintjob'' :)

Code: Select all

004   $array.ship =  get ship array: of race Neutral Race class/type=Ship

To get your script (which i named ''Colored.xml'') going on in the background you could use for example this MD code
(which needs to be put in the directory folder) :

Code: Select all


<?xml version="1.0" encoding="ISO-8859-1" ?>

<?xml-stylesheet href="director.xsl" type="text/xsl" ?>
<director name="Colored Claimable Ships" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="director.xsd">
  
<documentation>
<author name="qwizzie" />
<content name="Colored Claimable Ships" description="Installs Colored Claimable Ships" />
<version number="1.0" date="16/05/13" status="active" />
</documentation>
  
<cues>
<cue name="Colored Claimable Ships">
      
<condition>
<check_all>
<check_age value="{player.age}" min="1s" />
</check_all>
</condition>
<action>
<do_all>
          
<run_script script="Colored" />

<cues>
<cue name="restart MD">
<timing>
<time exact="180s" comment="180 sec delay"/>
</timing>
</cue>
</cues>
                             
 <reset_cue cue="Colored Claimable Ships"/>
 
 </do_all>
      
</action>
    
</cue>
  
</cues>

</director>


User avatar
apricotslice
Posts: 13737
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice » Fri, 17. May 13, 03:58

The script was written originally by Logain Abler, for a specific situation. I call it from various places, such as my jump to derelict script, so that the first thing that happens after jumping to a new sector with a derelict ship in it, is that all such ships turn orange on the nav map.

I deliberately left astronuts in the script, so I could see immediately how many there were, since for a long time, I used to collect them all.

User avatar
joelR
Posts: 1996
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Fri, 17. May 13, 04:19

Ignore my previous question. I see why the script didnt work. I was copy/pasting your code into notepad++ and saving it as an XML instead of using the in game editor.

This has been a good lesson in scripting the game which I have been putting off!

User avatar
apricotslice
Posts: 13737
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice » Fri, 17. May 13, 04:59

Sorry, I missed your question.

You can name scripts anything you like, but setup at the beginning is only for scripts that run on startup, and ! on the beginning refers to egosoft core scripts.

The only way you can cut and paste code is to use excriptor or the other external script editor. Otherwise, yes, you need to use the internal editor to script in each line of code from scratch. Major pain, but as you said, it is a lesson in scripting. :)

User avatar
joelR
Posts: 1996
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Fri, 17. May 13, 08:26

apricotslice wrote:Sorry, I missed your question.

You can name scripts anything you like, but setup at the beginning is only for scripts that run on startup, and ! on the beginning refers to egosoft core scripts.

The only way you can cut and paste code is to use excriptor or the other external script editor. Otherwise, yes, you need to use the internal editor to script in each line of code from scratch. Major pain, but as you said, it is a lesson in scripting. :)
I keep getting this error in Exscriptor when I try to save the script. Any idea why?

Saving file...
Save failed because of compilation errors - please compile again
Save failed due to compilation errors!
- Error on line 4 - Unrecognised symbol in expression: get
- Error on line 8 - Unrecognised symbol in expression: dec
- Error on line 9 - Error in expression: expected a number, [constant], 'string', {literal}, null, or (subexpression) but found |.
- Error on line 10 - Unrecognised symbol in expression: get
- Error on line 11 - Error in expression: expected a number, [constant], 'string', {literal}, null, or (subexpression) but found |.
- Error on line 12 - Unrecognised symbol in expression: set
- Error on line 13 - Unrecognised symbol in expression: get
- Error on line 14 - Unrecognised symbol in expression: sprintf
- Error on line 15 - Unrecognised symbol in expression: set
- Error on line 16 - Unrecognised symbol in expression: end
- Error on line 17 - Error in expression: expected a number, [constant], 'string', {literal}, null, or (subexpression) but found |.
- Error on line 18 - Unrecognised symbol in expression: wait

Warnings:
Variable array.ship is being used on line 5 before being assigned to.

User avatar
apricotslice
Posts: 13737
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice » Fri, 17. May 13, 08:29

Can you do a screen dump of what excripter is showing ?

Easier to help when we can see what you see.

User avatar
joelR
Posts: 1996
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Fri, 17. May 13, 08:44

apricotslice wrote:Can you do a screen dump of what excripter is showing ?

Easier to help when we can see what you see.
Heres a link:

http://i.imgur.com/LzaTTdm.png

User avatar
apricotslice
Posts: 13737
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice » Fri, 17. May 13, 08:47

No idea. That looks fine to me.

User avatar
joelR
Posts: 1996
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Fri, 17. May 13, 09:14

Alright. Thanks anyhow. Must be something buggy with exscriptor.

User avatar
DrBullwinkle
Posts: 5704
Joined: Sat, 17. Dec 11, 02:44
x3tc

Post by DrBullwinkle » Fri, 17. May 13, 10:16

Did you copy and paste that code into Exscriptor?

It looks as though you have tab characters (which are not allowed).

Post Reply

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