[Mod] Apricot Salvage Mod (Beta)

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

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

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

[Mod] Apricot Salvage Mod (Beta)

Post by apricotslice » Mon, 15. Oct 07, 10:06

Apricot Salvage Mod
by Apricotslice


In the Office of John Slice, CEO, Apricot Mapping Service

Ah, pilot, come in, sit down.

I have all your scores here in front of me, and I was at a loss what to do with you. You are an average pilot, useless marksman, overuse the auto pilot, tend to damage ships for no particular reason, useless mechanic, should I go on ? Hmmmm, no.

The question was what to do with you.

Well, that answer came this morning on my way to work. Your going to clean this universe up !

No, wipe that smirk off your face, it doesnt mean your going to be sheriff. I mean your going to be a janitor to the whole universe and clean up all the debris, derelict ships, containers and whatnot that are left lying around all over the place.

I'm sick to death of having all this debris cluttering up the space ways and making coming to work a hazard instead of a joy. Your going to clean it up for me !

We've outfitted a Disco for you with some pretty nifty software.

Your ship will be updated with the locations of all known derelict ships, and a new command has been added to take you right there so you can salvage the ship. Its up to you what you do with them, but get them off the space lanes !

You have also been given software to help you claim without leaving your ship, up to a distance of 5km.

Also, you have been entrusted with the software to automate a ship into clearing the debris in the asteroid fields. And the new advance in HQ software that allows stations to be set up within the HQ instead of complexing them.

Ok pilot, you have a lot of work to do, get out there and do it !

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

Download : http://circleofatlantis.com/games/X3/salvage.html

Install using Cycrows X Plugin Manager.
Uses 10cat/10.dat.
Copy the 00.save file in the X3 directory to your save file directory.

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

Apricot Salvage Mod.

Task 1 : Collect Derelict Ships.

The X universe is a very dangerous place. But one of its oddities is that only ships being fired apon by the player will be abandonned by their pilot. This just isnt real. In reality, all sorts of reasons would have all sorts of pilots abandonning ship on a constant basis. So with this in mind, .....

Every time the game is started, 12 derelict ships will be created in random locations with random damage and fittings. This can be altered by either copying the main setup script in the script editor a few more times to get more, or deleting a few to get less - 1 ship per script.

A new command is on the Nav menu to jump your ship to a random derelict ship. Apricot Mapping Service makes no warranty about soiled underwear should you find yourself in a sea of red dots all of a sudden. The command is rinky dink, and does not check for the existance of a jumpdrive or enough ecells. If you dont have them, you dont go anywhere, simple as that. Where you go, is entirely random ! What you do when you get there is your problem.

Task 2 : Asteroid Debris Clearing.

Since 1.4, the universe has been filled with debris that makes flying around sectors dangerous.

So your job is to assign ships to clear the debris and sell it or stockpile it.

Task 3 : Container Clearing.

There is garbage being dropped all over the universe by careless ships that manage to get themselves destroyed through sheer stupidity. Make sure it all gets collected up and disposed of efficiently.

Scripts Included :

Apricot Beamdock (Apricot's private version)
Apricot Jump to Derelict Ship
Apricot mess up the universe with derelict ships
Cycrow System Override Software Mk2
Auto Debris Harvestor v2.0 by Nividium
Install Station to PHQ by MJALowe

Mod Included :

PHQ with 50 Mil in storage space, but no blueprints.

Save Included :

00.sav

Start Position :

The save game bypasses the Aspiring Explorer Start, putting you in a Disco in CBSE, with a few extra goodies in the cargo hold. You are just 1 jump away from your first salvage operation.


Beta version and my first attempt at a spk distrubution file, so please let me know if it works ok.


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

Original OP follows :

I just want to make a quick and dirty script that will find all ships in the universe with a neutral race, and print the sector onto the logbook. Position in sector optional.

I can learn how to embellish the message later, but for now, I just need the code to just find the ships and display in the log the sector they are in.

Anyone help ? Much appreciated if you can. :)
Last edited by apricotslice on Fri, 19. Oct 07, 08:17, edited 3 times in total.

User avatar
LV
Sith Lord
Posts: 6358
Joined: Wed, 6. Nov 02, 21:31

Post by LV » Mon, 15. Oct 07, 10:31

Code: Select all

007   $input.array =  array alloc: size=0
008   $ships =  get ship array: of race Neutral class/type=Moveable Ship
010   
011   $as =  size of array $ships
016   
017   while $as > -1
018    $single = $ships[$as]
019    if $single -> exists
020     $sec = $single -> get sector
023      append $single to array $input.array
024      append $sec to array $input.array
028    end
029 @  = wait 1 ms
030    dec $as = 
031   end
032   

write to logbook $input.array
That will return each ship and it's sector to log

for pos use get x,y,z in second general menu (press page down 2x to find)
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

User avatar
Nividium
Posts: 695
Joined: Tue, 21. Aug 07, 01:31

Post by Nividium » Mon, 15. Oct 07, 10:46

Here's my version of the find abandon ships code:

Code: Select all

001   $ship.array =  get ship array: of race Neutral Race class/type=Moveable Ship
002   $ship.array.size =  size of array $ship.array
003   while $ship.array.size > 0
004    dec $ship.array.size = 
005    $ship = $ship.array[$ship.array.size]
006    $x = $ship -> get x position
007    $y = $ship -> get y position
008    $z = $ship -> get z position
009    $sector = $ship -> get sector
010    write to player logbook: printf: fmt='Ship = %s, Sector = %s, X = %s, Y = %s, Z = %s', $ship, $sector, $x, $y, $z
011 @  = wait 2 ms
012   end
013   
014   
015   return null

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

Post by apricotslice » Mon, 15. Oct 07, 11:01

Thankyou :)

TycHouse
Posts: 486
Joined: Wed, 6. Nov 02, 21:31

Post by TycHouse » Mon, 15. Oct 07, 12:11

Could i just point out that in LV's script the 'dec $as' statement on line 030 should be on line 018 ie before the '$single = $ships[$as]' statement.

Edit: also noticed that the 'while' statement should just be 'while $as' (or perhaps 'while $as > 0').

Reasons ? An array of 4 elements is actually element [0] - [3] therefor you need to decrement the count before you assign the ship object otherwise you are trying to perform '$single = $ships[4]' in the first iteration which is clearly wrong.

{sorry LV, not trying to insult you just thought i'd clear that up for others reading}
AMD FX-8350 Eight-Core 4.0GHz Processor
ASrock Extreme 3 R2.0 Motherboard
8Gb memory
2 x AMD HD7770 Graphics (Crossfire not enabled)
Windows Vista Ultimate 64bit SP2

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

Post by apricotslice » Mon, 15. Oct 07, 12:45

This is what I hate about this editor.

I know what to put, but where do I find the stupid line ?
$ship.array = get ship array: of race Neutral Race class/type=Moveable Ship
The only thing remotely like it is in universe but logic dictates it should be in general, arrays.

But nothing seems to allow this line to be built as written.

:oops:

HELP !

This call for help was brought to you by the Apricot Salvage Service, a wholey owned subsiduary of the Apricot Mapping Service.

User avatar
Carlo the Curious
Posts: 15622
Joined: Mon, 5. Mar 07, 23:03

Post by Carlo the Curious » Mon, 15. Oct 07, 12:53

Further down in Universe/Sector commands.

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

Post by apricotslice » Mon, 15. Oct 07, 12:58

I found that one, but it doesnt construct the same line.

It wants a variable, so I type in ship.array, then it wants an object of some kind, and thats it. Nothing about race or class.

I cant find any other command line that has get ship array in it.

User avatar
Carlo the Curious
Posts: 15622
Joined: Mon, 5. Mar 07, 23:03

Post by Carlo the Curious » Mon, 15. Oct 07, 13:00

There's more than one variant in Universe commands - look harder!

I think there is an external editor around someplace, but I don't have the link.

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

Post by apricotslice » Mon, 15. Oct 07, 13:03

External editor ????????

Where, gimme gimme gimme

:)

Edit :

Yay, crowd goes wild :)

Yes it was further down. The manual didnt say there were 2 variations either. :(

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

Post by apricotslice » Mon, 15. Oct 07, 13:30

Touch down !!!!

Crowd goes absolutely berzerk !

Next problem :)

What do I change to get it to print to an external file ?

Damn thing came back with more than I expected and I really need to print them out. :)

B-O'F
Posts: 719
Joined: Sat, 21. Feb 04, 03:15

Post by B-O'F » Mon, 15. Oct 07, 13:47

Hi apricotslice,

Use the command:-


write to log file #<Var/Number> append=<Var/Number> printf: fmt=<Var/String>, <Value>, <Value>, <Value>, <Value>, <Value>

instead of the:-

write to player logbook: printf: fmt=<Var/String>,<Value>,<Value>,<Value>,<Value>,<Value>

It needs a numeric input for the 'log file #<Var/Number>' - I normally use the date, like 1015.

The rest of the information can be the same as used in the write to logbook command (you can pretty it up later).

Then just alt-tab out of the game and look for 'log1015.txt' in the reunion folder - it should have all your data ready for word processing or printing.

Hope that this helps,

Boron - Ol Fh'art
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

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

Post by apricotslice » Mon, 15. Oct 07, 14:04

Thanks. Got that working :)

Only thing thats not working now is putting a heading and footing on it. Do I need to do that in onother script and call this one from it ?

Just putting the heading at the top and footing at the bottom printed the heading half way down the report and no footing at all.

Hey, I'm learning this ! :)

B-O'F
Posts: 719
Joined: Sat, 21. Feb 04, 03:15

Post by B-O'F » Mon, 15. Oct 07, 17:56

Hi apricotslice,

Headings and footings can be handled in the same script as the rest.

script

$message1 = 'string of stuff for the heading'
$message2 = 'string of stuff for the footing'

* write the heading
* change the TRUE to FALSE to start a new log
write to log file # 1015 append=[TRUE] value= $message1

the rest of your script to write stuff out

* write the footing
write to log file # 1015 append=[TRUE] value= $message2

End of script

You can make things easier by defining $log.id = 1015, and then using $log.id instead of entering 1015 in the write to log commands - this means that you can write data from each run to a different log file just by changing the $log.id = command. This is handy if you want multiple versions.

You can prettify things by using correct spacing - this works for a log file as it is monospaced - have a quick look at Prices of all wares for examples of spacing.

Any help,

Boron - Ol Fh'art
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

User avatar
LV
Sith Lord
Posts: 6358
Joined: Wed, 6. Nov 02, 21:31

Post by LV » Mon, 15. Oct 07, 22:52

TycHouse wrote:Could i just point out that...
No worries, i've written every script that i have in that format because if it aint broke......

I know how arrays work now but it's down to the fact it works for me as i always have null checks
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

Post Reply

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