First off, I'm new here, and I apologize for asking for help without posting much of anything else, but this problem is driving me crazy.
Here's the situation. I'm scripting up a mod that will allow a player to "order" any items he wishes and have them delivered to a ship of his choosing. In order to even "deliver" the items, a check must be made to ensure that the ship will be able to carry the items ordered. The check goes as follows (in pseudocode):
test = can ship carry item class? (an M5 can't carry a Gamma PPC)
totalvolume = get volume of item * quantity (a TS can't carry 10,000 units of anything)
if test == null
write to logbook "ware is too big"
else if totalvolume > ship->freevolume
write to logbook "not enough free space"
else
(code for adding items here)
Here's my problem. Sometimes the script works and sometimes it doesn't. Most of the time, the wierdest thing happens. I will get a "not enough free space" error and will suddenly have 9 Gamma PPC's, 6 Beta PPC's, and 3 Alpha PPC's added to my ship! Most of the time, I try to order energy cells so I don't have to get out of my ship to dock at a SPP. Free weapons are great, but I have no idea where they're coming from.
I've traced through the code and the comparer runs and then skips down to the final return statement. Can anyone think of a reason why these specific items are instantly added to my inventory almost every time? An additional brain-teaser is that I am creating a ship off in space to simulate delivery time. Only when the ship reaches the selected receiver is ANY add item command called. To put it short, a bunch of PPC cannons are thrown into my ship (if they can fit) and I don't even call an "add item to ship" command at all. Any ideas? Maybe my savegames are corrupted or something. Perhaps it's the 1.2 patch. I am stumped. All that work for nothing is really angering.
A peculiar scripting problem. Any guesses?
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 114
- Joined: Wed, 3. Dec 03, 18:37
Re: A peculiar scripting problem. Any guesses?
Eh... This is weird... I've written such a script and I don't have this problem.runner1891 wrote:First off, I'm new here, and I apologize for asking for help without posting much of anything else, but this problem is driving me crazy.
Here's the situation. I'm scripting up a mod that will allow a player to "order" any items he wishes and have them delivered to a ship of his choosing. In order to even "deliver" the items, a check must be made to ensure that the ship will be able to carry the items ordered. The check goes as follows (in pseudocode):
test = can ship carry item class? (an M5 can't carry a Gamma PPC)
totalvolume = get volume of item * quantity (a TS can't carry 10,000 units of anything)
if test == null
write to logbook "ware is too big"
else if totalvolume > ship->freevolume
write to logbook "not enough free space"
else
(code for adding items here)
Here's my problem. Sometimes the script works and sometimes it doesn't. Most of the time, the wierdest thing happens. I will get a "not enough free space" error and will suddenly have 9 Gamma PPC's, 6 Beta PPC's, and 3 Alpha PPC's added to my ship! Most of the time, I try to order energy cells so I don't have to get out of my ship to dock at a SPP. Free weapons are great, but I have no idea where they're coming from.
I've traced through the code and the comparer runs and then skips down to the final return statement. Can anyone think of a reason why these specific items are instantly added to my inventory almost every time? An additional brain-teaser is that I am creating a ship off in space to simulate delivery time. Only when the ship reaches the selected receiver is ANY add item command called. To put it short, a bunch of PPC cannons are thrown into my ship (if they can fit) and I don't even call an "add item to ship" command at all. Any ideas? Maybe my savegames are corrupted or something. Perhaps it's the 1.2 patch. I am stumped. All that work for nothing is really angering.
Alex.
-
- Posts: 632
- Joined: Wed, 13. Aug 03, 15:45
Re: A peculiar scripting problem. Any guesses?
Worked fine for me too... maybe you check volume space only but not volume size? also a ship being able to transport a weapon type doesn't mean it can actually use it... I'd dcheck my scriptxSiNx wrote:Eh... This is weird... I've written such a script and I don't have this problem.runner1891 wrote:First off, I'm new here, and I apologize for asking for help without posting much of anything else, but this problem is driving me crazy.
Here's the situation. I'm scripting up a mod that will allow a player to "order" any items he wishes and have them delivered to a ship of his choosing. In order to even "deliver" the items, a check must be made to ensure that the ship will be able to carry the items ordered. The check goes as follows (in pseudocode):
test = can ship carry item class? (an M5 can't carry a Gamma PPC)
totalvolume = get volume of item * quantity (a TS can't carry 10,000 units of anything)
if test == null
write to logbook "ware is too big"
else if totalvolume > ship->freevolume
write to logbook "not enough free space"
else
(code for adding items here)
Here's my problem. Sometimes the script works and sometimes it doesn't. Most of the time, the wierdest thing happens. I will get a "not enough free space" error and will suddenly have 9 Gamma PPC's, 6 Beta PPC's, and 3 Alpha PPC's added to my ship! Most of the time, I try to order energy cells so I don't have to get out of my ship to dock at a SPP. Free weapons are great, but I have no idea where they're coming from.
I've traced through the code and the comparer runs and then skips down to the final return statement. Can anyone think of a reason why these specific items are instantly added to my inventory almost every time? An additional brain-teaser is that I am creating a ship off in space to simulate delivery time. Only when the ship reaches the selected receiver is ANY add item command called. To put it short, a bunch of PPC cannons are thrown into my ship (if they can fit) and I don't even call an "add item to ship" command at all. Any ideas? Maybe my savegames are corrupted or something. Perhaps it's the 1.2 patch. I am stumped. All that work for nothing is really angering.
Alex.
-
- Posts: 1225
- Joined: Thu, 27. Feb 03, 20:44