Posted: Wed Mar 14, 2007 6:49 am
Add a removeCargo-method as an inverse to awardCargo. I stumbled on that one yesterday during playtesting.
You can use awardCargo: with a negative number, but it is impracticable, as on my pretty fast computer (2 GHz Intel Core Duo) it takes about 15 seconds to process that command, and the fan went mad during that time! Here's a log-file-example from what I tried out yesterday. Have a look at the time-string at the beginning of each line:
And speaking of cargo-handling, I would very much like to have more influence on that in a script, apart from awardCargo, useSpecialCargo and removeAllCargo.
E.g. it would be nice to have methods to query the available cargospace of the player's ship and the amount of cargo currently taken. The latter one would be perfect if there would be not only a single counter for the cargospace used, but counters for every commodity.
So it could be cargospace_number, which returns an integer expressing the still available cargospace in tons,
cargo_number, which returns an integer expressing the filled cargospace in tons, and
food_number, textiles_number etc. up to gemStones_number and alienItems_number, integers expressing the current amount of all these items in their respective scale.
And as removeAllCargo doesn't remove Gold, Platinum or Gem Stones (they are kept in the safe in your cockpit, not in the cargo bay (BTW what kind of safe is that? I sometimes carry 150 kg of Gold and 1057 kg of Platinum with me--pretty spacious safe in my cockpit, it seems!)) a method like removeAllValuables would be nice, just to do the same to these.
You can use awardCargo: with a negative number, but it is impracticable, as on my pretty fast computer (2 GHz Intel Core Duo) it takes about 15 seconds to process that command, and the fan went mad during that time! Here's a log-file-example from what I tried out yesterday. Have a look at the time-string at the beginning of each line:
On the frontend it looks like the program has frozen completely. And it doesn't matter how big the amount is. "-1 Gold" takes the same time to add as "-1000 Gold".2007-03-13 23:29:29.329 Oolite[1981] SCRIPT debug messages ON
2007-03-13 23:29:29.330 Oolite[1981] DEBUG ::::: scriptAction: "awardCargo: -10 Gold"
2007-03-13 23:29:29.330 Oolite[1981] DEBUG ::::: after expansion: "awardCargo: -10 Gold"
2007-03-13 23:29:29.330 Oolite[1981] DEBUG ..... Going to award cargo -10 x 'Gold'
2007-03-13 23:29:45.411 Oolite[1981] DEBUG ::::: scriptAction: "awardCargo: -10 Platinum"
2007-03-13 23:29:45.411 Oolite[1981] DEBUG ::::: after expansion: "awardCargo: -10 Platinum"
2007-03-13 23:29:45.411 Oolite[1981] DEBUG ..... Going to award cargo -10 x 'Platinum'
2007-03-13 23:30:01.246 Oolite[1981] DEBUG ::::: scriptAction: "awardCargo: -10 Gem-Stones"
2007-03-13 23:30:01.246 Oolite[1981] DEBUG ::::: after expansion: "awardCargo: -10 Gem-Stones"
2007-03-13 23:30:01.246 Oolite[1981] DEBUG ..... Going to award cargo -10 x 'Gem-Stones'
2007-03-13 23:30:17.457 Oolite[1981] DEBUG ::::: scriptAction: "setMissionImage: none"
And speaking of cargo-handling, I would very much like to have more influence on that in a script, apart from awardCargo, useSpecialCargo and removeAllCargo.
E.g. it would be nice to have methods to query the available cargospace of the player's ship and the amount of cargo currently taken. The latter one would be perfect if there would be not only a single counter for the cargospace used, but counters for every commodity.
So it could be cargospace_number, which returns an integer expressing the still available cargospace in tons,
cargo_number, which returns an integer expressing the filled cargospace in tons, and
food_number, textiles_number etc. up to gemStones_number and alienItems_number, integers expressing the current amount of all these items in their respective scale.
And as removeAllCargo doesn't remove Gold, Platinum or Gem Stones (they are kept in the safe in your cockpit, not in the cargo bay (BTW what kind of safe is that? I sometimes carry 150 kg of Gold and 1057 kg of Platinum with me--pretty spacious safe in my cockpit, it seems!)) a method like removeAllValuables would be nice, just to do the same to these.