[script] How to find and destroy Station Debris (script included)

The place to discuss scripting and game modifications for X³: Reunion.

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

AalaarDB
Posts: 2282
Joined: Thu, 29. Jan 04, 08:19
x3tc

[script] How to find and destroy Station Debris (script included)

Post by AalaarDB » Thu, 29. Dec 05, 05:20

Destroy Station Debris
Please extract to your X3 scripts folder. Manually run this in the sector you want the debris destroyed.

For my Salvage Mod I am adding the ability to salvage Station Debris. However, there is no 'find debris' command or anything that will easily return it. So, I wrote this code that checks for wares of mainType 30. Each subtype corresponds to a station - so there is a wreck for each station type. The mainType 20s are station debris found in Presidents End. They are slightly different.

Code: Select all

001   * EDIT HERE
002   $destroyRegularStationDebris = [TRUE]
003   $destroySpecialStationDebris = [TRUE]
004   
005   $maxID = [PLAYERSHIP] -> get SectorObject ID
006   $maxID = $maxID + 10000
007   while $maxID
008    dec $maxID = 
009    $wareType =  get ware type of SectorObject $maxID
010    if $wareType
011     $mainType =  get maintype of ware $wareType
012     if $mainType == 30 AND $destroyRegularStationDebris == [TRUE]
013      $object =  get object from SectorObject $maxID
014      $object -> destruct: show no explosion=[TRUE]
015     else if $mainType == 20 AND $destroySpecialStationDebris == [TRUE]
016      $subType =  get subtype of ware $wareType
017      if $subType >= 38 AND $subType <= 42
018       $object =  get object from SectorObject $maxID
019       $object -> destruct: show no explosion=[TRUE]
020      end
021     end
022    end
023   end
024   return null
This is the only way I know how to do it. Obvious limitations are that you can only find any debris in the sector the player is in. The ID range may need work to be more efficient, but I can't really narrow the range and be assured that the results are accurate. I'm just posting this for other people's reference.

The previous code found objects that are Station Containers ST sized, but not stations. It did not detect the station debris which was in PE so I've updated it.

If anyone really wants, you can destroy ship debris by checking for maintype 20 subtypes 20, 30 or 43, and destroy destroyed stations with subtypes 57 and 58
Last edited by AalaarDB on Thu, 2. Feb 06, 03:17, edited 3 times in total.

User avatar
NumNuts
Posts: 166
Joined: Tue, 20. Jul 04, 16:43
x3tc

Post by NumNuts » Fri, 30. Dec 05, 09:59

Still not working for me. :( The Presidents End debris.
The "Destroy Station Debris" link above is the same file as posted in that other thread:
Looking for debris removing script
Is the code above just for reference so the punters can edit your downloadable script and add what youve posted?
The download link above has some, but not all of the code you have posted above: this is the download script I got from the above link:

Code: Select all

001   $maxID = [PLAYERSHIP] -> get SectorObject ID
002   $maxID = $maxID + 10000
003   while $maxID
004    dec $maxID = 
005    $object =  get object from SectorObject $maxID
006    skip if $object
007     continue
008    skip if not $object -> is of class Ship
009     continue
010    skip if not $object -> is of class Station
011     continue
012    
013    $ware = $object -> get ware type code of object
014    $transportClass = get transport class of ware $ware
015    if $transportClass == Station Containers ST
016     $object -> destruct: show no explosion=[TRUE]
017    end
018   end
019   return null
Sorry to be a pain. :(
I know you said to just change the False to True, but it's not there to change. :?

AalaarDB
Posts: 2282
Joined: Thu, 29. Jan 04, 08:19
x3tc

Post by AalaarDB » Fri, 30. Dec 05, 10:06

That's the old code. I deleted the old zip and uploaded the new with the same name, but my file hoster kinda sucks (why I have to rename them to .renametozip etc). I'll change the name and reupload.

OK it's being really finnicky, here's a temp link:
temp

User avatar
NumNuts
Posts: 166
Joined: Tue, 20. Jul 04, 16:43
x3tc

Post by NumNuts » Fri, 30. Dec 05, 10:32

Thankyou kindly!

User avatar
NumNuts
Posts: 166
Joined: Tue, 20. Jul 04, 16:43
x3tc

Post by NumNuts » Fri, 30. Dec 05, 11:06

Did you say you tested this in Presidents End?
I got the right file, edited the

Code: Select all

003   $destroySpecialStationDebris = [FALSE]
to [TRUE], saved it, ran it while I was in Presidents end and all the debris is still there. :?
Is that debris GOD protected or something?
Or am I just clueless by not selecting a ship/station with the 1st argument?
I know you have lot on your plate, reply at your leisure!

AalaarDB
Posts: 2282
Joined: Thu, 29. Jan 04, 08:19
x3tc

Post by AalaarDB » Fri, 30. Dec 05, 11:36

Try now. I had it working, made a small change, and didn't test the change.

User avatar
NumNuts
Posts: 166
Joined: Tue, 20. Jul 04, 16:43
x3tc

Post by NumNuts » Fri, 30. Dec 05, 12:34

Great - Sweet - Beautiful - Awesome!
Thanks a million! :)

Grumble314
Posts: 16
Joined: Sat, 22. May 04, 18:39
x3

Post by Grumble314 » Thu, 2. Feb 06, 02:45

I assume NumNuts got it working from his reaction I'm within 1.5k of station debris in PE and execute the script after having changed the one statement to true and get nothing.

Color me stupid but what am I doing wrong? Seleceted nul didn't select a ship and tried doing it selecting the ship I was in neither did anything :(

hmm never mind had two version of the file the one modified on the 29th didn't work the one on the 30th did :)

BTW go the 29th version from the link that listed a collection of AalaarDB's Scripts not the link in this post.

Brodie
Posts: 760
Joined: Tue, 10. Feb 04, 00:10
x4

Post by Brodie » Sat, 6. May 06, 19:46

Destroy Station Debris
Please extract to your X3 scripts folder. Manually run this in the sector you want the debris destroyed.
Im a total noob when it comes to modding etc. Never done anything before. Would someone be kind enough to give me a step by step on how to remove station debris in Presidents End

madpenguin
Posts: 91
Joined: Fri, 3. Dec 04, 06:16
x3

Post by madpenguin » Fri, 24. Nov 06, 20:46

Can this thread be updated a little?

The download link is broken. Is the code in the first post all there is and up to date? If so, what do you save that as? a .txt file?

Is it compatable with 2.x?

A bit confused here because I don't script I guess. Thanks...

User avatar
Stevio
Posts: 2271
Joined: Sat, 4. Jun 05, 10:36
x3tc

Post by Stevio » Fri, 24. Nov 06, 21:04

You use the internal script editor Rename your pilot to Thereshallbewings"

and then go to "command console -> Script editor"

madpenguin
Posts: 91
Joined: Fri, 3. Dec 04, 06:16
x3

Post by madpenguin » Fri, 24. Nov 06, 21:24

Thanks. I understand that, but there is no script to execute once I get there that removes station debri.

I assume thats what the code up top is for. My scripts/ folder is empty so I'm not sure what to save the stuff from above as (extension). Also, is the code up to date? Does that snip of code still work? I suppose I'll find out if I just know what to save it as...

Thanks again.

User avatar
Stevio
Posts: 2271
Joined: Sat, 4. Jun 05, 10:36
x3tc

Post by Stevio » Fri, 24. Nov 06, 22:10

Just ope the Script editor and create a new script
name it anything you want i.e. "Destroy.debris" or something

Use the script editor to find and select the commands you need with the code above

and then save it the script editor will save it automatically to your scripts folder as <scriptname>.xml

once you have finished the script execute it by highlighting the script in the script editor and pressing r, enter, enter

-----------------

it might be worth checking this out first
http://ircwhore.co.uk/x3/scripts/help/index.html

madpenguin
Posts: 91
Joined: Fri, 3. Dec 04, 06:16
x3

Post by madpenguin » Fri, 24. Nov 06, 23:26

Stevio wrote:Use the script editor to find and select the commands you need with the code above
Your kiddin right? There is no ingame text editor to manually type it out? Using this script editor is like trying to to type a 5 page report by just copy/pasting from a character map instead of using the keyboard. How remarkably unproductive...

I use bash and perl most of the day at work and if I was forced to work like this I'd get fired. The scripting launguage is extremely easy to read and understand. I don't see why you'd have to jump thru hoops for something so simple.

Please, if I'm overlooking something, slap me upside the head with it. Otherwise I'll just live with the debris in Presidents End...

I tried pasting the top code into notepad and saved it as an .xml but it's not showing up. That's not xml code anyway so no suprise there.

Sure would be nice if that linked worked. All that is saved is a .jpeg that says 'file not found'... Ah well... thanks anyway...

User avatar
moggy2
Posts: 5505
Joined: Wed, 6. Nov 02, 20:31
x3ap

Post by moggy2 » Sat, 25. Nov 06, 00:03

the readable XML part of the script is only for humans. The game reads the bit in the codearray at the bottom. If you don't edit that bit the game will never see the changes.

richardthesane
Posts: 33
Joined: Thu, 10. Nov 05, 18:27
x3

Post by richardthesane » Fri, 1. Dec 06, 20:07

Does anyone have the destroy debris xml laying around? I could do with getting a copy to clear out PE

Thraxwhirl
Posts: 683
Joined: Fri, 17. Feb 06, 20:54
x3ap

Post by Thraxwhirl » Sat, 17. Feb 07, 15:37

Aye.

I'd welcome a copy of the script too. Links(both of 'em) are broken. :(

Lazerath
Posts: 860
Joined: Tue, 22. Mar 05, 06:31
x4

Post by Lazerath » Sat, 17. Feb 07, 23:17

I would like a copy of it as well.. I want to set up my HQ in Presidents End but want to get rid of the station debris first or at least be able to tractor beam them into a different place! :(
COMPUTER SPECS
[Mobo] SABERTOOTH 990FX R2.0
[CPU] AMD FX-9370 8 Cores 4.4 - 4.7GHZ 16MB DDR3-1866
[Cooling] Corsair Hydro Series H80I CPU Cooler System
[Video] Evga 970 GTX SC 3.5Gb Ram ==> [Ram] G-Skills Ripjaws X 16GB
[Harddrive] (2) x Samsung 850 Evo 250GB SSD
[Harddrive] Samsung 840 Series 120GB SSD ==> [Harddrive] WD BLACK 1TB 64MB 7200RPM
[Disc Player] LG 14X BLU-RAY BURNER ==> [Case] Thermaltake A71 Chaser [Windows 7 Pro]

User avatar
klaatu
Posts: 316
Joined: Fri, 21. Nov 03, 17:23
x4

Post by klaatu » Mon, 19. Feb 07, 17:20

richardthesane wrote:Does anyone have the destroy debris xml laying around? I could do with getting a copy to clear out PE
Try here: http://klaatu.dyndns.org/x3/Destroy.Debris.xml

I don't leave the machine on all the time, but it's up at least a few hours every day and most all weekends.

Lazerath
Posts: 860
Joined: Tue, 22. Mar 05, 06:31
x4

Post by Lazerath » Tue, 20. Feb 07, 05:18

Sweet... I grabbed it!

Thank you a lot d00der!!! :D :D :D
COMPUTER SPECS
[Mobo] SABERTOOTH 990FX R2.0
[CPU] AMD FX-9370 8 Cores 4.4 - 4.7GHZ 16MB DDR3-1866
[Cooling] Corsair Hydro Series H80I CPU Cooler System
[Video] Evga 970 GTX SC 3.5Gb Ram ==> [Ram] G-Skills Ripjaws X 16GB
[Harddrive] (2) x Samsung 850 Evo 250GB SSD
[Harddrive] Samsung 840 Series 120GB SSD ==> [Harddrive] WD BLACK 1TB 64MB 7200RPM
[Disc Player] LG 14X BLU-RAY BURNER ==> [Case] Thermaltake A71 Chaser [Windows 7 Pro]

Post Reply

Return to “X³: Reunion - Scripts and Modding”