[SCRIPT] Asteroid Relocator v1.00 by Nividium 10/10/2007

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

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

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

[SCRIPT] Asteroid Relocator v1.00 by Nividium 10/10/2007

Post by Nividium » Wed, 10. Oct 07, 11:13

Nividium Asteroid Relocator for X3 Reunion, Script Package.

Name of Script Package Asteroid Relocator
Version Number 1.00
Date Released 10/10/2007
Last Updated n/a
Script Created For X3 Reunion v 2.0.02
File Package Available X3 Script Installer "SPK"

Download the "SPK" file format package here: Asteroid Relocator v1.00

Description:

The Asteroid Relocator was created in response to a forum member user by the name of Thraxwhirl who came up with this idea. The idea is not mine. I volunteered to write the code to turn Thraxwhirl's vision into useable form.

Any of your ships equiped with a Transporter Device and Mineral Scanner can use the Asteroid Relocator software. Except the Playership, you personally cannot use this software.

Select one of your ships (doesn't matter if you are In or Out of Sector), choose the [Piracy]-[Containerize Asteroid] then a pop-up will appear asking you to select an Asteroid. The ship that is executing this command must be within 10km of the desired Asteroid or you will get a "beep" error. So, select the rock. The Asteroid will be de-moleculorized and placed into a "container" within that ship's cargo hold. You can see this "container" in the ship's cargo bay now. Ok, so you can move that ship to another Sector or you can drop the rock in the same Sector. The ship must be at least 10km away from the intended drop position in order for the command to execute, else you will hear another "beep". Choose the [Piracy]-[Unload Asteroid] command and a pop-up will appear asking you to select a Sector Position. Use your key-pad directional keys 4,8,6,2 to move the cursor to the desired positon and press [Enter]. The "containerized" Asteroid will now be unloaded in the exact position you specify. So, be careful where that position is and remember Asteroids are big mothers and you could easily drop it on a station or gate etc. There is no anti-collision code to prevent you from doing just that in this script, so use caution. Hey, if you make a mistake, just "containerize" it again and move it over some. No big whoop I suppose.

A ship can only carry one "container" Asteroid at a time. Yes, I know, I could code a ship to carry the entire Universe in it's cargo bay, but this is the way this particular script is going to work, ok. To prevent you from trying to "containerize" more than one Asteroid at a time, I have coded in a safety ie: the command [Containerize Asteroid] will be greyed - out when you are already carrying one Asteroid. Don't lose that container either, as if you do, you will not be able to unload/get the Asteroid out of it. Do not try to transfer the "container" onto another ship and then try to make that ship "unload" the Asteroid. It will not work. Why? Because I said so. No, because the container is emgram stamped with the Transporter Device serial number, so no other ships can use the container. Helps deter pirates wanting to kill your ship in order to steal the container. Doesn't mean they won't kill your ship anyhow, but for a dif reason.

NOTE: Usual warning applies. This script may not be compatible with other scripts/mods. This script package should not be used when playing the game for the first time or a Plot-Based game. Make a backup of your saves before installing using this script package.

Required Equipment:

- Transporter Device
- Mineral Scanner

Installation: Use the X3 Plugin Manager.

Uninstall: Use the X3 Plugin Manager. There is no internal uninstaller for this.

Version History: Version 1.00 Initial Release.

Command Slots Used:
<t id="657">COMMAND_TYPE_PIRACY_57</t>

<t id="658">COMMAND_TYPE_PIRACY_58</t>

Text File Used: 448091.pck
Last edited by Nividium on Wed, 10. Oct 07, 20:57, edited 1 time in total.

killuminati-ita
Posts: 259
Joined: Mon, 28. Aug 06, 15:50

Post by killuminati-ita » Wed, 10. Oct 07, 11:51

Wow this is a fantastic script!

BTW Nividium.. do you get some sleep sometimes?? :lol:

Great job indeed!
:D
E POI IL PYTHON E' SGRAVO!! ^^

xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

Post by xxbluedragonxx » Wed, 10. Oct 07, 13:00

:lol: you must read my mind! Because I was just thinking of wanting a script like this since it is perfect to work with your mining script too! Thanks! Why is it in piracy though? Can you make new menu and put your mining script and this one in the same menu?? Maybe the mining base one too? Then all in same menu nice :)

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

Post by Thraxwhirl » Wed, 10. Oct 07, 13:02

Thanks for this one, Nividium. Groovy.

Sounds to me like you read the thread I started last night, Sir, in which I asked for this very facility.

I am endebted to you, Nividium, and will test this out later this evening when I get home... from the dreaded dentist. Gaaaahhhhh!! :shock:

Wish me luck, people; think I'd rather face the Kha'ak. :khaak:

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

Post by Thraxwhirl » Wed, 10. Oct 07, 13:04

xxbluedragonxx wrote::lol: you must read my mind! Because I was just thinking of wanting a script like this since it is perfect to work with your mining script too! Thanks! Why is it in piracy though? Can you make new menu and put your mining script and this one in the same menu?? Maybe the mining base one too? Then all in same menu nice :)
If I may say so, I personally would rather we DON'T have it moved out of Piracy and into another menu, simply because Piracy is one of the least used, and therefore least likely to have any conflicts.

You should see how many commands I have under Combat, Custom and General. :o

User avatar
Bertone
Posts: 868
Joined: Fri, 15. Jun 07, 07:07
x3

Post by Bertone » Wed, 10. Oct 07, 13:35

Nividium, my personal congratulations...

You'll become famous as "The Instant Scripter"!

:D

dpadula
Posts: 242
Joined: Tue, 15. Aug 06, 18:47
x4

Post by dpadula » Wed, 10. Oct 07, 13:55

This sounds really cool and I am going to try it out. I thought it interesting that I could destroy stations with it though. Might make some of the XI missions much easier. :twisted:
-----
Dell Precision 3600
12 gb ram
Nvidia 1060
256 gd boot ssd and 1 tb data ssd
Windows 10

User avatar
DeadZone
Posts: 98
Joined: Fri, 26. Sep 03, 09:44
x4

Post by DeadZone » Wed, 10. Oct 07, 18:02

With no anti-collision in it, could be an interesting weapon to place next to gates or stations docks... :twisted:

Pogi
Posts: 522
Joined: Thu, 13. Apr 06, 12:35
x2

Post by Pogi » Wed, 10. Oct 07, 18:46

:D ..Outstanding!
X3..The most fun a man can have...With his clothes on.

Gammel
Posts: 668
Joined: Tue, 10. Jul 07, 08:07

Post by Gammel » Wed, 10. Oct 07, 22:53

Oooh, with this script my ideas to do incursions into Kha'ak space to steal their roids may well just be on again. :twisted:
!!! Caution!!!
Signature lost!
Please contact your Admin!

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

Post by Nividium » Wed, 10. Oct 07, 22:57

dpadula wrote:This sounds really cool and I am going to try it out. I thought it interesting that I could destroy stations with it though. Might make some of the XI missions much easier. :twisted:
"Despite my peaceful and well intention intent", you managed to turn a peaceful harmless function into a deadly weapon! Nice one. :lol:

Got any competitors that are in your way, Asto em, Xenon K getting you down Asto em :lol:

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

Post by Thraxwhirl » Thu, 11. Oct 07, 01:18

Hi, Nividium.

Just trying out the script now. Like an idiot, the very first thing I did was get into the TL and go to the Piracy menu only to find it greyed out. Then I re-read your post and noted the "no Playership" capability. Doh! Lol!

May I ask why that is? Would it be a problem if one collected 'roids whilst IN the ship? Just wondering, as I quite like to do these things "hands on" if at all possible, but obviously if it's something likely to break the game, I can live with it how it is.

Second question: You were saying that once you've collected a 'roid, that same ship can never collect another(and no OTHER ship can unload it) until that same TL has re-deployed it.

Again, I have been wondering if it MIGHT be at all possible to have a work-around for this, as I had a quite revolutionary(well, quite new at least) idea about using 'roids as tradeable wares, both as a source of minerals AND for ship-building.

I wrote a post on it, which you may find interesting, and I could show you what I've had in mind. I've been doing quite a bit of thinking in this regard, and I know that SOME of the coding(the ship-based mineral yield part) is stuff I could write(indeed I already have), if you're up for a bit of discussion about it? :)

The plan is to allow the player to build Mobile Nividium Mines, that are actually M1s or TLs, with weapons, that can fly/jump from sector to sector and deliver Nividium wherever needed.

It would require use of a ship model(I use Balogt's Privateer-style Mining Base), Shovinus' Player-owned Shipyards script(with a slight adjustment, I can approach him about this), and the ability to use collected 'roids as tradeable wares, very much like stations that are still in "kit" form at SYs.

What do you think?

As I say, I wrote another post on it which elaborated on some of my thoughts.

If you like the idea, we could have a talk about it. Potentially it COULD utterly revolutionise and enhance the X economy(particularly the Player's part in it), because you could not only make your Mines(the bedrock of X's industry) more productive and mobile(not to mention well-defended) but also trim down the number of 'roids needed throughout your galaxy maps(thus saving some fps-lag).

Sound interesting? As I say, I could script SOME of this.

Fancy chatting about it?

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

Post by Nividium » Thu, 11. Oct 07, 04:52

Thraxwhirl wrote:Hi, Nividium.

Just trying out the script now. Like an idiot, the very first thing I did was get into the TL and go to the Piracy menu only to find it greyed out. Then I re-read your post and noted the "no Playership" capability. Doh! Lol!

May I ask why that is? Would it be a problem if one collected 'roids whilst IN the ship? Just wondering, as I quite like to do these things "hands on" if at all possible, but obviously if it's something likely to break the game, I can live with it how it is.

Second question: You were saying that once you've collected a 'roid, that same ship can never collect another(and no OTHER ship can unload it) until that same TL has re-deployed it.
Again, I have been wondering if it MIGHT be at all possible to have a work-around for this, as I had a quite revolutionary(well, quite new at least) idea about using 'roids as tradeable wares, both as a source of minerals AND for ship-building.

I wrote a post on it, which you may find interesting, and I could show you what I've had in mind. I've been doing quite a bit of thinking in this regard, and I know that SOME of the coding(the ship-based mineral yield part) is stuff I could write(indeed I already have), if you're up for a bit of discussion about it? :)

The plan is to allow the player to build Mobile Nividium Mines, that are actually M1s or TLs, with weapons, that can fly/jump from sector to sector and deliver Nividium wherever needed.

It would require use of a ship model(I use Balogt's Privateer-style Mining Base), Shovinus' Player-owned Shipyards script(with a slight adjustment, I can approach him about this), and the ability to use collected 'roids as tradeable wares, very much like stations that are still in "kit" form at SYs.

What do you think?

As I say, I wrote another post on it which elaborated on some of my thoughts.

If you like the idea, we could have a talk about it. Potentially it COULD utterly revolutionise and enhance the X economy(particularly the Player's part in it), because you could not only make your Mines(the bedrock of X's industry) more productive and mobile(not to mention well-defended) but also trim down the number of 'roids needed throughout your galaxy maps(thus saving some fps-lag).

Sound interesting? As I say, I could script SOME of this.

Fancy chatting about it?

This is required, because you cannot assign a local variable to the Playership. This script uses 1 local variable to hold the "containerized" Asteroid data.
EDIT: I worded that badly. It's not that you cannot assign a local variable to the Playership, it is just that I, in this case, did not want the Player to be involved with the function (personal pref). You can make it run on the Playership if you want. Sorry, for the screw up in my writing.


This is required, because the Asteroid data is stored in a local variable which is created by the ship that "containerized" the Asteroid.
EDIT: You could transfer the container and the value of the local variable over to another ship, but I did not in this case because it requires more code than I cared to apply to this excercise. You can of course transfer the values and the container over to another ship if you write the code to do that. Sorry to mislead you there on this point as well.


Why do you need a dif Shipyard arrangement?

A problem with that though is there is no real way to "valuate" an Asteroid. If you have a Nividium/Ore/Silicon Asteroid of say Yield 40, what is it's equivalent ware numbers...100, 500, 1000, 10,000 ?? I know when I wrote the Auto Debris Harvestors, I examined and spent the day shooting apart Rock Debris Clusters of all kinds in order to come up with some sort of "equivalent" per unit ware numbers. But, big mother Asteroids, I have no clue what their "equivalent" might be with the dif Yields involved etc. You see if a big Asteroid is actually 100,000 units or more, you would be hard pressed to put that many Silicon/Ore/Nividium into a TL. Could be done using equal value "containers" though, say 1 container = 10,000 units of ware and when needed, you decompress them etc. Then you could store millions of individual "containers" on one ship no problem.

But, all in all. This is your "baby" Thraxwhirl and it would probably be best if you work the project yourself. Post a new forum posting and then just add threads with any questions you have along the way. Then all the great scripter here can post their response to your questions ie: broader involvement with the community, but it is your project alone. I will try to help if I can and post suggestions, but I must decline from personally getting involved with your wonderful idea. Best of luck to you Thraxwhirl, I know this is going to be a great script from you. :D

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

Post by Thraxwhirl » Thu, 11. Oct 07, 15:15

Hi again.

Well I've read your reply and that all sounds fine. If you're fairly confident that it won't break the game for me to allow the [PLAYERSHIP] to run the command(s), I think I'll make that minor change if that's ok with you. :)

Now then, on the subject of this idea of mine. Well, yes, I think I'll be able to code it myself, given a bit of time, BUT...

...I can only envisage one way of doing it, and I have two important considerations:

1) Obviously I want it to be compatible with your scriptset, because the ability to collect and use asteroids will be paramount to the entire process. So, effectively, if I'm able even to start on this, your Asteroid Relocator will be a "Requirement" scriptset.

I hope that's ok, as I don't see any other way I could script it.

2) As a result of point 1, I would need to ask you first of all if you would be at all willing to make a little adjustment to it. This is kind of vital, as I need the "Collected" 'roids to be differentiated.

Allow me to explain:

In order to use collected 'roids for this purpose, it is vital that we have not one but three different wares. At present, any collected 'roid is simply stored as "Container" in the Cargo Hold, and has a volume of 1.

Could that be changed so that what you actually find in your hold is this:

"Asteroid (Nividium)", "Asteroid (Ore)" or "Asteroid (Silicon)"...

...with a Ware Class of XL(unless EQdocks can stock ST, but I don't think they can), and a much higher Volume(maybe 20,000).

I appreciate that this is asking for more work, but it is vital for me that the three different 'roid types are three different wares, based on their resource.

What I then envisage is that such 'roids can be sold at Eqdocks, where they become tradeable commodities(this way, I can write an AL Plugin which will keep stocking them up at eqdocks every now and again)...

...OR, should they be deposited at HQs(and I'll be AL-spawning some random AI-owned HQs), the Plugin will, whenever it finds one in stock, break it down into its minerals.

The quantity that is generated from breaking down the 'roid will just have to be a SEMI-random calculation, since the AI will produce tradeable 'roids at Eqdocks and these will NEVER have been REAL 'roids, and never held any resource value. Thus they couldn't be redeployed.

Once the 'roids are a tradeable ware, they could then be placed in Player-SYs and used as resources for building Mobile Mines.

Thing is, would you be willing to make the different 'Roids 3 different wares whilst in the cargo hold?

If you are, I believe I can write this. :)

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

Post by Nividium » Thu, 11. Oct 07, 22:43

Thraxwhirl wrote:Hi again.

Well I've read your reply and that all sounds fine. If you're fairly confident that it won't break the game for me to allow the [PLAYERSHIP] to run the command(s), I think I'll make that minor change if that's ok with you. :)


Yes, it is fine with me. Within the "setup" file, you will need to replace the command that makes ref to the check scripts. One of the check scripts checks to see if "ship" is the Playership. Remove that command and the corresponding "plugin.asteroid.relocator.check or check2 (don't remember). Then you will need to modify the scripts by taking out arguments named "ship". Then you will need to add one line at the top of scripts like this: $ship = [THIS] (this will save you from changing all ref to the variable $ship and changing it to [THIS] )


Now then, on the subject of this idea of mine. Well, yes, I think I'll be able to code it myself, given a bit of time, BUT...

...I can only envisage one way of doing it, and I have two important considerations:

1) Obviously I want it to be compatible with your scriptset, because the ability to collect and use asteroids will be paramount to the entire process. So, effectively, if I'm able even to start on this, your Asteroid Relocator will be a "Requirement" scriptset. I hope that's ok, as I don't see any other way I could script it.

Yes, you can use the code, modify/strip/change or whatever to suit your needs. But, given the objectives or goal you have in mind. That code or scriptset is probably not going to work with your goal. The code is narrow focused and limits the user to only 1 Asteroid and 1 container. This is not going to work with your idea. So, it would be best to write a "new" script based upon your overall goals rather than try to make something into something else.


2) As a result of point 1, I would need to ask you first of all if you would be at all willing to make a little adjustment to it. This is kind of vital, as I need the "Collected" 'roids to be differentiated.

Allow me to explain:

In order to use collected 'roids for this purpose, it is vital that we have not one but three different wares. At present, any collected 'roid is simply stored as "Container" in the Cargo Hold, and has a volume of 1.

Could that be changed so that what you actually find in your hold is this:

"Asteroid (Nividium)", "Asteroid (Ore)" or "Asteroid (Silicon)"...


Not using conventional means. There are no existing wares with those names. So, you would have to use Cycrows stuff to do that or the EMP. I have not used any of those external devices and cannot comment on thier suitability for your purpose. But, I am sure they would work just fine. But, I cannot help this those, because I have never used them and shy away from the EMP as I heard people get odd "ReadText" showing up in their game etc.



...with a Ware Class of XL(unless EQdocks can stock ST, but I don't think they can), and a much higher Volume(maybe 20,000).

I appreciate that this is asking for more work, but it is vital for me that the three different 'roid types are three different wares, based on their resource.

What I then envisage is that such 'roids can be sold at Eqdocks, where they become tradeable commodities(this way, I can write an AL Plugin which will keep stocking them up at eqdocks every now and again)...

...OR, should they be deposited at HQs(and I'll be AL-spawning some random AI-owned HQs), the Plugin will, whenever it finds one in stock, break it down into its minerals.

I would not use an Artificial Life script approach to this. Just use a Global Process to watch the Stations. Also, you are talking about searching for a ware within a Station and then replacing it with another ware that has huge quantities associated with it. You would need to check the Stations empty cargo hold limits before unpacking etc. I can easily see this goal becomeing extremely complicated and the level of code writing becoming very high level and demanding to make it work safely and properly.



The quantity that is generated from breaking down the 'roid will just have to be a SEMI-random calculation, since the AI will produce tradeable 'roids at Eqdocks and these will NEVER have been REAL 'roids, and never held any resource value. Thus they couldn't be redeployed.

Once the 'roids are a tradeable ware, they could then be placed in Player-SYs and used as resources for building Mobile Mines.

Thing is, would you be willing to make the different 'Roids 3 different wares whilst in the cargo hold?

As mention above, this cannot be done using conventional means. You would need to introduce a Custom ware and or EMP and I don't use them and cannot advise you on them. Sorry.



If you are, I believe I can write this. :)

Gammel
Posts: 668
Joined: Tue, 10. Jul 07, 08:07

Post by Gammel » Thu, 11. Oct 07, 23:15

If your going to make it so you can buy asteroids from Equipment Docks, you may as well just skip the whole going-to-the-EqDock bit and use Fud's Asteroid Creator.
Sure, that probably wont work too well with your mobile mine, but yeah.

I like the whole moving asteroids idea. If the Paranid were able to do it in Trinity Sanctum, then the player should be able to do it too. :D
!!! Caution!!!
Signature lost!
Please contact your Admin!

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

Post by Thraxwhirl » Sat, 13. Oct 07, 06:35

Hi, Nividium.

Thank you for your explanation of the details and so forth. That was very enlightening. Though it does seem that, from what you've told me, this project of mine will not really be possible. Sadly.

I'm sure I'm not telling you anything you won't have figured out yourself by now of course, but without "distinctions", as it were, between various 'roids once collected, alas I don't see any way to do it. :(

It is a great shame, but be that as it may, I am of course grateful to you for taking the time to read my long posts, writing out replies that explain a lot, and most importantly, writing the Relocation script in the first place.

I may not have tradeable or "usable" roids(usable as wares, you understand), but thanks to you I am able to move 'roids from one sector to another, and that, when all's said and done, is what I'd originally hoped for.

So you have my thanks.

I don't know much about this Asteroid purchasing creation script that you mention, Gammel. I'll certainly take a look at it and see how it operates. IF it uses custom wares as deployable asteroids, put into your cargo hold or station, then I could use that as the basis of my project. But if however what it does is spawn one at a location in space, then sadly, no, you're right, it won't enable me to trade them or build ships with them.

But I'll take a look anyway. :)

As for the Playership command-thingy, yes, I reckon I'll try to change that so that I can drive the TL that collects and deploys(I kind of like doing it "hands-on"). Also, and if you've no objection, I was thinking about the business of the TLs location...

It can't collect the 'roid if it's further than 10km away, right? Nor can it deploy if it's within 10km.

You happy with me coding it so that the ship actually moves to the desired location and then carries out the action?

Moving it too the 'roid to pick it up is easy. I reckon I can do that, no trouble. Determining where it needs to go to if it's too close to deploy might not be so easy. If I can figure that out, I'll code it. If not, I'll get it to send an incoming message telling you that the location is too close to your ship.

I might even try to get it to check if there are other ships and stations within, say, 5km of the chosen location, and then forbid deployment if there are.

Would you be ok with me doing that?

Which script(s) check(s) the location(s) for collection and deployment?

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

Post by Nividium » Sat, 13. Oct 07, 08:28

The script is set up to "require" that a ship be "within" 10km before it can pickup a Roid, so that is already done for you. You don't want to get any closer than that to a Roid anyhow.

The dropoff "requires" that you are at least 10km away from the Sector Postion selected for dropoff. Again for safety reasons.

Thraxwhirl, yes go ahead and change whatever code you want with the script pack. But remember, you don't need to use a TL to be "hands on" you can use any small ship and still do the Asteroid pickup/drop off.

Yes, I have written an anti-collision script that would prevent it from being dropped on a Gate, Station or another Roid. I posted that script somewhere in this forum, but don't know where, you would have to search for it. It is generic, so you can use it for anything.

You ask which scripts checks for locations re collection and deployment. There are only 2 main scripts in the pack one called "pickup" the other called "drop".

Have fun, hope it works out for you.

Pogi
Posts: 522
Joined: Thu, 13. Apr 06, 12:35
x2

Post by Pogi » Sat, 13. Oct 07, 16:38

@Gammel..I agree with you..Every time I come across a tool like this script to make the game more "hands on", to where I can delete some "I am GOD watch me create this" script, I grab it...the one thing I have noticed from players of this game the most, is that they want to be 'hands on"...Well most anyway. :D
X3..The most fun a man can have...With his clothes on.

Gammel
Posts: 668
Joined: Tue, 10. Jul 07, 08:07

Post by Gammel » Mon, 29. Oct 07, 23:18

I'm having a little issue with this.
I tried to take the 64yield Silicon roid from Antigone Memorial and put it in Bala Gi's Joy (As I want to build a complex in the nice cosy sector, but there are no roids there at all) Anyway, despite the fact you can use just about any ship, I chose to use my TL cause its my big freighter, it carries big things. :P I picked up the roid, no problems there, I could see the container in the cargo bay. I jumped to Bala Gi's Joy and attempted to put it down, but no luck. It just kept giving me the error beep. My placement wasn't out of range, I even tried putting the roid right on top of my TL. But no matter where I tried to put the roid, it just wouldn't unload. :(
Any ideas?
!!! Caution!!!
Signature lost!
Please contact your Admin!

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