Is it possible to add Stations to Warelists?
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
Is it possible to add Stations to Warelists?
I just created a warelist that only contained a station. I then tried making the Job for the Lifter in the moon sector use this warelist, but when I went into the game the station wasn't in the lifters cargo. Is this just not possible, or even with one object is it not 100% chance of adding the ware?
- apricotslice
- Posts: 14129
- Joined: Sun, 16. May 04, 13:01
Yes its ST. Tried it again this time adding in three stations to the list and adjusting the front number, and making sure the line number up top had also been adjusted. No luck...
I am trying to add stations to TLs around the galaxy so that one could end up getting enemy race stations by piracy. I tried to run a script to do it, but it ran into problems because when I tried to check to make sure I wasn't adding a station to a TL that already had one the check would fail, because the stations weren't being considered ware objects so it would return that there weren't in any ST sized objects in the hold even if there was a station in there...
I am trying to add stations to TLs around the galaxy so that one could end up getting enemy race stations by piracy. I tried to run a script to do it, but it ran into problems because when I tried to check to make sure I wasn't adding a station to a TL that already had one the check would fail, because the stations weren't being considered ware objects so it would return that there weren't in any ST sized objects in the hold even if there was a station in there...
Last edited by RoverTX on Wed, 12. Dec 12, 06:42, edited 1 time in total.
- apricotslice
- Posts: 14129
- Joined: Sun, 16. May 04, 13:01
I added them via script and the stations did seem to dispersal after a while, so maybe there cargo is getting wiped at some point.
It would go from 5 in their holds to 0, and I could never figure out why... Well will try it out on some other TLs when I get a chance then...
Thanks that was a good point!
It would go from 5 in their holds to 0, and I could never figure out why... Well will try it out on some other TLs when I get a chance then...
Thanks that was a good point!
- DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
Good idea, RoverTX!RoverTX wrote:I am trying to add stations to TLs around the galaxy so that one could end up getting enemy race stations by piracy.
A script is more compatible than modifying jobs and warelists. If the stations disappear over time, then that is OK, right? It creates more randomness. If you are using TL's that already have jobs scripts attached to them then it is possible that GoD uses them for other tasks. See !god.tl.deliver.factory.
I tried the following test code and it produced expected results. Perhaps it will help you?:
Code: Select all
$PageID = <your number here>
$target = get player tracking aim
$factory.type = {Pirates Incendiary Bomb Launcher Forge}
$amt = $target-> get free amount of ware $factory.type in cargo bay
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$msg = 'Available Space before adding = ' + $amt
write to log file $PageID append=1 value=$msg
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if $amt
= $target-> add 1 units of $factory.type
end
$amt = $target-> get amount of ware $factory.type in cargo bay
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$msg = 'Number in cargo hold = ' + $amt
write to log file $PageID append=1 value=$msg
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$amt = $target-> get free amount of ware $factory.type in cargo bay
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$msg = 'Available space after adding = ' + $amt
write to log file $PageID append=1 value=$msg
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return null
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Going off what ya'll said I came up with the following al script. Still working on it but the general idea is there.
https://s3.amazonaws.com/forums-rover/stcap.zip
It runs every 5 minutes. It first finds all the shipyards for each race. Then gets from them all the factories for sale from each race. It then finds every TL in the universe and adds stations to them from their respective race, but it wont add more then one station at the moment.
It also tries to weight the food and bio factories used by player stations so they show up more often sense you need more of them, even though they only make up a fraction of all the different type of factories.
Haven't tested it all together just yet, but some feed back on the structure of the plugin would be cool!
PS: It should work with custom factories as long as they are for sale some where, and it shouldn't pick up non-complex-able Terran facts, because its only going off what is being sold. It also doesn't pick up Docks or Trading Posts atm because they aren't of the class Factories.
https://s3.amazonaws.com/forums-rover/stcap.zip
It runs every 5 minutes. It first finds all the shipyards for each race. Then gets from them all the factories for sale from each race. It then finds every TL in the universe and adds stations to them from their respective race, but it wont add more then one station at the moment.
It also tries to weight the food and bio factories used by player stations so they show up more often sense you need more of them, even though they only make up a fraction of all the different type of factories.
Haven't tested it all together just yet, but some feed back on the structure of the plugin would be cool!
PS: It should work with custom factories as long as they are for sale some where, and it shouldn't pick up non-complex-able Terran facts, because its only going off what is being sold. It also doesn't pick up Docks or Trading Posts atm because they aren't of the class Factories.
- DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
That all sounds pretty good, RoverTX.
IMHO, it should not include factories that are not for sale (other than maybe a rare IBL Forge).
I will take a look at your code later, but it sounds as though you are on the right track.
IMHO, it should not include factories that are not for sale (other than maybe a rare IBL Forge).
I will take a look at your code later, but it sounds as though you are on the right track.
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
- DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
Your code looks basically sound, as well, RoverTX.
You will be adding stations to Casinos and Hospitals, in addition to other TL's, of course. You are not making the stations rare -- you are just making them available, in case the race will not sell them, right? I think that will be a huge help to those playing pirate or race-response games!
A possible option would be to include a few rare stations that are not sold at shipyards, such as IBL Forges or Ghoul Missile Manufacturing Plants. I am sure that you would make some new friends if you did that! An easy way to let the player choose whether to use an option is to put it into the t file.
If you are looking for tips:
- While loops should always have a WAIT.
- In-game text, such as the description string, should really come from a language file since this is an international game.
- file names should really be plugin.stcap... rather than al.stcap... except for the actual al script which should be named al.plugin.stcap... (These are EgoSoft's published naming conventions).
- If you are looking for formatting and naming ideas, then take a look at al.plugin.bw.organic.hulls.event (part of Organic Boron Hulls) for a good example.
You will be adding stations to Casinos and Hospitals, in addition to other TL's, of course. You are not making the stations rare -- you are just making them available, in case the race will not sell them, right? I think that will be a huge help to those playing pirate or race-response games!
A possible option would be to include a few rare stations that are not sold at shipyards, such as IBL Forges or Ghoul Missile Manufacturing Plants. I am sure that you would make some new friends if you did that! An easy way to let the player choose whether to use an option is to put it into the t file.
If you are looking for tips:
- While loops should always have a WAIT.
- In-game text, such as the description string, should really come from a language file since this is an international game.
- file names should really be plugin.stcap... rather than al.stcap... except for the actual al script which should be named al.plugin.stcap... (These are EgoSoft's published naming conventions).
- If you are looking for formatting and naming ideas, then take a look at al.plugin.bw.organic.hulls.event (part of Organic Boron Hulls) for a good example.
Last edited by DrBullwinkle on Thu, 13. Dec 12, 06:10, edited 1 time in total.
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
- apricotslice
- Posts: 14129
- Joined: Sun, 16. May 04, 13:01
Where are they specified ? I've never seen them.DrBullwinkle wrote: - file names should really be plugin.stcap... rather than al.stcap... except for the actual al script which should be name al.plugin.stcap... (These are EgoSoft's published naming conventions).
Besides, I ignore that on the basis that I want all my scripts easily identifiable as mine, and dont want them mixed up in the general plugin ones. Too easy to lose a script that way.
- DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
The clearest definition is on the L3+ forum under instructions for submitting scripts. But not everyone has L3 access, so another source is page 11 of the MSCI Programmer's Handbook.apricotslice wrote:Where are [the naming conventions] specified ? I've never seen them.
And here is another reminder from KlausM: Contact persons for signing scripts and .... rules.
Last edited by DrBullwinkle on Thu, 13. Dec 12, 06:12, edited 1 time in total.
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
- apricotslice
- Posts: 14129
- Joined: Sun, 16. May 04, 13:01
- DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
There may be a better answer, but here is my approach:
Loops should have a minimum of 1 ms WAIT to allow other scripts to interrupt.
Loops running on many ships should be slower than loops running on a single object (or running globally, as in an Artificial Life Plugin).
Also, I think I read somewhere that "WAIT Randomly" gives more flexibility to the scheduler, although that might be more important for a script running on multiple objects.
So, in this case, I would try: "WAIT Randomly from 100 to 200 ms". Test it, and see how it works. The script should do its job well before the 300 second AL timer, and you should see no lag from your script, even under heavy combat conditions.
Loops should have a minimum of 1 ms WAIT to allow other scripts to interrupt.
- (There are some rare exceptions, but not in your script.)
Loops running on many ships should be slower than loops running on a single object (or running globally, as in an Artificial Life Plugin).
Also, I think I read somewhere that "WAIT Randomly" gives more flexibility to the scheduler, although that might be more important for a script running on multiple objects.
So, in this case, I would try: "WAIT Randomly from 100 to 200 ms". Test it, and see how it works. The script should do its job well before the 300 second AL timer, and you should see no lag from your script, even under heavy combat conditions.
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)