When I try to save the code with all lines active, it will ask if I want to save as normal, but it will not save. What is odd is that I can run the code as written, and can reaccess it in the game, but the game will not update the .xml file, so the next time I play the game, the script is not there.
A few of the lines of script have been commented out, and now I can save the file, so I was wondering what is with those few lines that is causing this issue.
Lines 12,14,15,17,19, and 34 are the lines of issue. Commented out, the script will save properly, but uncommented, it will not.
001 $myship = get player ship
002 $sector = $myship -> get sector
003 $loop = 0
004 $counter = 0
005 $credits = 0
006 $Stationarray = $sector -> get player owned station array from sector
007 * Creates array of all player owned ships in sector.
008 $arraysize = size of array $Stationarray
009 * Calculates the number of stations listed in the array.
010 while $loop < $arraysize
011 $station = $Stationarray[$loop]
012 *if $station == Bacon Corporation Shipyard(Bala Gi's Joy)
013 * This station exempt from deposits
014 *else if $station == Bacon Corp. Savings and Loan(Bala Gi's Joy)
015 *$Bank = $station
016 * This station serves as bank, thus exempt from depositing.
017 *else if $station == Bacon Corp. Trading Station(Bala Gi's Joy)
018 * This station exempt from deposits
019 *else
020 $Deposit = $station -> get money
021 * Any other station - gets station balance.
022 if $Deposit > 0
023 * If the station balance is greater than 0, continue.
024 $credits = $credits + $Deposit
025 * Adds station balance to total deposits.
026 write to player logbook: printf: fmt='%s has deposited %s credits.', $station, $Deposit, null, null, null
027 * Writes station name and amount transferred to player logbook
028 $Deposit = 0 - $Deposit
029 $station -> add money: $Deposit
030 * Subtracts deposit from station, leaving zero balance
031 inc $counter =
032 * Counter used to keep track of how many stations have deposits.
033 end
034 *end
035 inc $loop =
036 end
037 $Bank -> add money: $credits
038 $Deposit = $Bank -> get money
039 write to player logbook: printf: fmt='%s stations have deposited %s credits. %s holds %s credits.', $counter, $credits, $Bank, $Deposit, null
Thank you for any assitance provided.
Need help with script not saving
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
-
- Moderator (Deutsch)
- Posts: 24969
- Joined: Sun, 2. Apr 06, 16:38
You mustn't reference specific objects that might only be present in your current save game. In your case that are the Bacon Corp. stations.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
-
- Posts: 7
- Joined: Thu, 19. Feb 04, 01:44
-
- Posts: 571
- Joined: Sat, 23. Feb 08, 12:38
Just to be sure - Bacon Corporation Shipyard(Bala Gi's Joy), Bacon Corp. Savings and Loan(Bala Gi's Joy) and Bacon Corp. Trading Station(Bala Gi's Joy) are not from vanilla X2, these stations are from X3.planetx32 wrote:012 *if $station == Bacon Corporation Shipyard(Bala Gi's Joy)
013 * This station exempt from deposits
014 *else if $station == Bacon Corp. Savings and Loan(Bala Gi's Joy)
015 *$Bank = $station
016 * This station serves as bank, thus exempt from depositing.
017 *else if $station == Bacon Corp. Trading Station(Bala Gi's Joy)
Maybe you posted in wrong forum ?
P. S. Unfortunately, I don't know about scripting, so can't help with scripting.
-
- Moderator (Deutsch)
- Posts: 24969
- Joined: Sun, 2. Apr 06, 16:38
Sure, you just have to search for these stations more generally. Meaning, check for their object classes, their waretype code or their subtype. For the latter an example could look like:Is there any sort of work-around to this so that I can still exclude certain stations?
Code: Select all
001 $sector = get sector from universe index: x=1, y=3
002 $stat.arr = $sector -> get station array from sector
003 $size.stat.arr = size of array $stat.arr
004 while $size.stat.arr
005 dec $size.stat.arr =
006 $station = $stat.arr[$size.stat.arr]
007 $subtype = get subtype of ware $station
008 if $subtype == 48462
009 * do something
010 end
011 end
012 return null
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
-
- Posts: 7
- Joined: Thu, 19. Feb 04, 01:44