[SCRIPT] IFTSOS - Install Factory to Station or Ship
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 3144
- Joined: Sun, 19. Dec 04, 02:41
-
- Posts: 23
- Joined: Sat, 5. May 07, 06:38
Eight seconds for every 100 isn't so bad. I don't think I've ever had more than 10 TL's running around doing things. M1's that can actually carry factory class cargo seem to be few and far between. If ships got out of hand would it be viable to split the array in half and run them 30 seconds apart from each other? It's still a 60 second interval for each subgrouping.
-
- Posts: 461
- Joined: Fri, 5. Jan 07, 06:27
let me re word the timeing...when i ran the timeing test i ran it on the script that fills the global array with the default data...(only runs once per game normally)...i ran it 1000 times and it took 80 seconds...(80ms per run)
the timed part of the script should actually run faster, but i had no real way to time it....didnt fancy creating 1000 pHQs and loading them all with a single factory - or one of each
edit: this was basically why in the orginal post i was asking for some scripters to look over the code and do some testing...
edit2: just did a major test of the TL/M1 stuff...i modded a TL to have an insanly huge cargo...put 20 different factories in it and all the goods it should need for 10 runs (edited the factories to run every 60 seconds for this test) then i used a clone ship script (dont remember which one...just had to make sure that all the cargo would be there and it was)...made 100 ships....no noticable performance impact...
note: im running a 3.4ghz p4 945d and a 8800gtx video...very doubtful to me that this test would be representative for other peoples performance...but 100 ship not even having a "skip" id say was pretty good
if you are using this script please post a reply with observed "lag" and "skips" that could be caused by this script, also any interface feed back is appreciated...even if i obviously dont want to do certain things (like have it use a command button) i will still read the feedback, and if i can figure a way to do it and stay within my current design rules i will do so
the timed part of the script should actually run faster, but i had no real way to time it....didnt fancy creating 1000 pHQs and loading them all with a single factory - or one of each
edit: this was basically why in the orginal post i was asking for some scripters to look over the code and do some testing...
edit2: just did a major test of the TL/M1 stuff...i modded a TL to have an insanly huge cargo...put 20 different factories in it and all the goods it should need for 10 runs (edited the factories to run every 60 seconds for this test) then i used a clone ship script (dont remember which one...just had to make sure that all the cargo would be there and it was)...made 100 ships....no noticable performance impact...
note: im running a 3.4ghz p4 945d and a 8800gtx video...very doubtful to me that this test would be representative for other peoples performance...but 100 ship not even having a "skip" id say was pretty good
if you are using this script please post a reply with observed "lag" and "skips" that could be caused by this script, also any interface feed back is appreciated...even if i obviously dont want to do certain things (like have it use a command button) i will still read the feedback, and if i can figure a way to do it and stay within my current design rules i will do so
-
- Posts: 461
- Joined: Fri, 5. Jan 07, 06:27
-
- Posts: 463
- Joined: Fri, 20. Feb 04, 17:30
Nah thats easy (MJALowe wrote:so, my next script task is gona be a script that runs in conjunction with this and has a TS/TP act as a supplier....this is gona take a long time for me to figure out how to do...

But seriously, you could get an array of all products in the PHQ ($var1), then wait x mins and get the array again ($var2). Then go:
(For $curproduct) -dont know the wording off hand but you get the idea right?
If $var1 > $var2
Append $curproduct to array $prodarray
End
Then tell your freighters to get one of the products in the $prodarray
OK so I didn't write it so well, but the general idea is that if a product is counted ($var1) then x secs later is counted again ($var2) and is less, then chances are it's a resource. Then send out the freighters.
Obviously you'd have to check that $curproduct isn't a weapon/shield/missile/(other product that isn't used as a resource)

Station Freight Transporter
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..
-
- Posts: 461
- Joined: Fri, 5. Jan 07, 06:27
ok...to get a TL mobile power plant
a) install script (duh)
b) start a game...should be able to be a game in progess
c) enable the script editor if it isnt already *i think this essential even if you dont want to change it
d) open up the script editor and scroll down to al.iftsos.eventhandler
e) un comment line 28 (thats press the "," key while on line 28
f) save the script
g) put a solar power plant in the cargo of a TL and wait < 1 minute...you should get a message saying it was installed
h) there wont be an out of resources message, so to get it running be sure you have enough resources for it or it will just sit there
i) assuming you had the resouces when it runs the 1 minute mark it should "consume" said resources and at the 2 minute mark it should give you some e-cells
note: obviously this could result in a first minute super efficiency...but what they hey (this would assume you put it in the cargo at like the 50sec mark...
note2: the cycle time on power plants is 118 seconds, so every so often you will get "bonus" production...meaning at the one hour mark it will produce double (i think its the 1 hour) those 2 seconds arent lost every cycle, they are stored as a time bonus for the next cycle...get 60 seconds of time bonuses for a bonus production kinda thing...
a) install script (duh)
b) start a game...should be able to be a game in progess
c) enable the script editor if it isnt already *i think this essential even if you dont want to change it
d) open up the script editor and scroll down to al.iftsos.eventhandler
e) un comment line 28 (thats press the "," key while on line 28
f) save the script
g) put a solar power plant in the cargo of a TL and wait < 1 minute...you should get a message saying it was installed
h) there wont be an out of resources message, so to get it running be sure you have enough resources for it or it will just sit there
i) assuming you had the resouces when it runs the 1 minute mark it should "consume" said resources and at the 2 minute mark it should give you some e-cells
note: obviously this could result in a first minute super efficiency...but what they hey (this would assume you put it in the cargo at like the 50sec mark...
note2: the cycle time on power plants is 118 seconds, so every so often you will get "bonus" production...meaning at the one hour mark it will produce double (i think its the 1 hour) those 2 seconds arent lost every cycle, they are stored as a time bonus for the next cycle...get 60 seconds of time bonuses for a bonus production kinda thing...
-
- Posts: 461
- Joined: Fri, 5. Jan 07, 06:27
@heretic
well, being that the station/ship will already have a list of all the factories installed that is updated every minute...
and being that i could use this to calculate how much is need and what the cycle times are...blah
because its so complicated what im gona do is this:
script runs on pHQ and effects homebased TP/TS/M6/M7
what ware do you want supplied
how much of ware do you want in pHQ cargo at all times
any other wares i should be aware of?
ofcoarse, i want to do this as a single command button (want it to be no buttons but that might be asking a bit much), and id really like to be able to remove ware...probably means i want an interactive message sent to the player...
anyways...i dont really know how to do any of that, the actual functionality of my script really really stretched my programing ability (orginally was gona do a two dimensional array but couldnt wrap my mind around it)
...its still gona take alot of effort on my part just to wrap my mind around the needed concepts and maths (i suck at math, well...not so bad...im up to precal but i still hate math)
someone want to do this for me? please please? my brains gona explode!
well, being that the station/ship will already have a list of all the factories installed that is updated every minute...
and being that i could use this to calculate how much is need and what the cycle times are...blah
because its so complicated what im gona do is this:
script runs on pHQ and effects homebased TP/TS/M6/M7
what ware do you want supplied
how much of ware do you want in pHQ cargo at all times
any other wares i should be aware of?
ofcoarse, i want to do this as a single command button (want it to be no buttons but that might be asking a bit much), and id really like to be able to remove ware...probably means i want an interactive message sent to the player...
anyways...i dont really know how to do any of that, the actual functionality of my script really really stretched my programing ability (orginally was gona do a two dimensional array but couldnt wrap my mind around it)
...its still gona take alot of effort on my part just to wrap my mind around the needed concepts and maths (i suck at math, well...not so bad...im up to precal but i still hate math)
someone want to do this for me? please please? my brains gona explode!
-
- Posts: 7
- Joined: Sat, 11. Feb 06, 21:49
-
- Posts: 563
- Joined: Sat, 9. Dec 06, 19:19
MJALowe, would you mind if I have a look it to see if I can make it run faster? Or I can just suggest to you, rather than running the whole 300 everytime on the HQ, what you should do is create an array of the stations ware, then find wares of main type 5 and 6 (these are all the available factorys) and create an array from them (you can make sure there is only one in the array by using find index. Then you have a list of all the station types in the HQ, then all you need to do is use find index on them again but with your factories list and get ware count like before. This should be alot faster. Only if the player has over 300 different ware types would it be slower (and not that many people do)
-
- Posts: 148
- Joined: Wed, 11. Apr 07, 04:25
-
- Posts: 461
- Joined: Fri, 5. Jan 07, 06:27
being i havent actually played the game much (maybe 2 hours of actual play and few hundred of "testing") im not entirly sure what trade docks and equipment docks that are player owned actually do...if someone could explain what they do and how (with timers and all) i might be able to add them in...or make another script that does that...
note: using the EMP mod or Cyrows Script installer i could add new factories (that dont come with the game by default) by just adding a new ware to place in the HQ
@shovinus it runs the "300" (really alot less) so as to check if the factories are installed or not and install them...then it just goes ok factory is isntalled, run it...or...oh no factory...skip this section then
by stations ware do you mean the wares the factories consume/produce? or the factories themselves
most of what you wrote is going right over my head...
note: using the EMP mod or Cyrows Script installer i could add new factories (that dont come with the game by default) by just adding a new ware to place in the HQ
@shovinus it runs the "300" (really alot less) so as to check if the factories are installed or not and install them...then it just goes ok factory is isntalled, run it...or...oh no factory...skip this section then
by stations ware do you mean the wares the factories consume/produce? or the factories themselves
most of what you wrote is going right over my head...
-
- Posts: 461
- Joined: Fri, 5. Jan 07, 06:27
yes it would, you would just have to add the needed entires to a local array or the global array (if you wanted it to work for everything)
easiest way would be the global array...
let me give you an example:
ware = the ware name of the factory
the rest are pretty much self explanatory, enter a 0 (not a null) if something isnt used
currently it would be a bad idea to enter a 0 for the produce or the first resource, though you could enter a zero for thier amounts without problem...
all the variables currently used are:
that leaves 2 empty variables per factory (assigned a 0 by default)
easiest way would be the global array...
let me give you an example:
Code: Select all
else if $factnum == 215
$ware = Teladi Typhoon Missile Factory ST_17500
$produce = Typhoon Missile
$pamount = 1
$resource1 = Energy Cells S_1
$ramount1 = 216
$resource2 = Nostrop Oil L_3
$ramount2 = 144
$resource3 = Ore XL_8
$ramount3 = 36
$cycletime = 864
else if $factnum == 216
the rest are pretty much self explanatory, enter a 0 (not a null) if something isnt used
currently it would be a bad idea to enter a 0 for the produce or the first resource, though you could enter a zero for thier amounts without problem...
all the variables currently used are:
Code: Select all
$factorysettings [ $spot0 ] = $factnum
$factorysettings [ $spot1 ] = $ware
$factorysettings [ $spot2 ] = $produce
$factorysettings [ $spot3 ] = $pamount
$factorysettings [ $spot4 ] = $resource1
$factorysettings [ $spot5 ] = $ramount1
$factorysettings [ $spot6 ] = $resource2
$factorysettings [ $spot7 ] = $ramount2
$factorysettings [ $spot8 ] = $resource3
$factorysettings [ $spot9 ] = $ramount3
$factorysettings [ $spot10 ] = $cycletime
$factorysettings [ $spot11 ] = $factoriesinstalled
$factorysettings [ $spot12 ] = $cycleprogress
$factorysettings [ $spot13 ] = $factoriespayedfor
$factorysettings [ $spot14 ] = $cargofullbonusproduction
$factorysettings [ $spot15 ] = $factoriesproducing
$factorysettings [ $spot16 ] = $cycleprogressbonus
$factorysettings [ $spot17 ] = $cycletimerun
-
- Posts: 461
- Joined: Fri, 5. Jan 07, 06:27
i tried that first...but it generates lag (lots of lag...imagine the game freezeing for 15 seconds every minute with just 1 HQ that has 50 different factories)...and makes it less customizable...this way if i really think an SPP should produce in 60 seconds instead of 118 i can change it...or add new things
and for time taken to produce the script...ya it woulda been alot easier...
note: creating and storing arrays and reading data from them generates almost no overhead...its built in functions that generate overhead...for instance the built in function that generates a list of all player owned headquarters...or the function that gets the presence of a ware in the cargo hold (the first one runs once per minute with this script and the second one runs once for each factory per minute for each HQ, if the factory ware in my listing is 0 it skips the check)
note2: those two functions i mentioned dont generate much overhead compared to some
and for time taken to produce the script...ya it woulda been alot easier...
note: creating and storing arrays and reading data from them generates almost no overhead...its built in functions that generate overhead...for instance the built in function that generates a list of all player owned headquarters...or the function that gets the presence of a ware in the cargo hold (the first one runs once per minute with this script and the second one runs once for each factory per minute for each HQ, if the factory ware in my listing is 0 it skips the check)
note2: those two functions i mentioned dont generate much overhead compared to some
-
- Posts: 845
- Joined: Mon, 2. Jun 03, 11:53
-
- Posts: 461
- Joined: Fri, 5. Jan 07, 06:27
if by containment area you mean docked...
well...it should be possible...i just dont know how to create a ship and have it be pre-docked....
would end up being a seperate script
other question would be how to determine what ships it can create...
would there be an EMP ware for "M3 Fighters" or would there be an EMP ware for "Nova"...either way it should be possible (once i figure out the comand for creating the ship and get a list of "construction" values (ware for specific fighter would be what i would use...otherwise you wouldnt be able to tell what ship you would get...then ofcoarse, one would probably run out of wares...so id use the cyrows script installer wares to be on the safe side....hmm....good idea for another project
well...it should be possible...i just dont know how to create a ship and have it be pre-docked....
would end up being a seperate script
other question would be how to determine what ships it can create...
would there be an EMP ware for "M3 Fighters" or would there be an EMP ware for "Nova"...either way it should be possible (once i figure out the comand for creating the ship and get a list of "construction" values (ware for specific fighter would be what i would use...otherwise you wouldnt be able to tell what ship you would get...then ofcoarse, one would probably run out of wares...so id use the cyrows script installer wares to be on the safe side....hmm....good idea for another project
-
- Posts: 683
- Joined: Fri, 17. Feb 06, 20:54
This is a very novel idea. So, if I understand correctly, this scriptset enables TLs to work as kind of mobile Complexes, yes? So factories aboard them interlink - place a Crystal Fab and an SPP inside a TL and they feed each other, right?
Then, what happens to the produce? Is that stored inside the factories themselves until they can hold no more, and the excess then goes into the TL's remaining cargo space?
Reckon you ought to ensure that the TL has external docking ports so that you can ferry that produce to other stations.
You know what would be ultra cool? If you could get this script to work for Shovinus' Player-owned Shipyard. Place an Argon Federal inside your TL, and connect it up to the necessary supplying factories, and before you know it, it's rattling out fighters that end up in your empty docking slots. Lol.
Mind you, it'd probably burst if you told the SY to produce another TL or M1 inside it. Ha ha!
Then, what happens to the produce? Is that stored inside the factories themselves until they can hold no more, and the excess then goes into the TL's remaining cargo space?
Reckon you ought to ensure that the TL has external docking ports so that you can ferry that produce to other stations.
You know what would be ultra cool? If you could get this script to work for Shovinus' Player-owned Shipyard. Place an Argon Federal inside your TL, and connect it up to the necessary supplying factories, and before you know it, it's rattling out fighters that end up in your empty docking slots. Lol.
Mind you, it'd probably burst if you told the SY to produce another TL or M1 inside it. Ha ha!
Last edited by Thraxwhirl on Wed, 9. May 07, 18:48, edited 1 time in total.