Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Transfer Item behaves strangely?!

Discussion in 'Programming Questions and Suggestions' started by mze9412, May 7, 2016.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. mze9412 Junior Engineer

    Messages:
    791
    Hi,

    this is one for the item management wizards among us ;)

    I am tryting to transfer items from one cargo to another and write some debug logging for that.

    This is in my log:
    Code:
    Moving item MyObjectBuilder_Ingot_Stone from Base_Cargo_6 to Base_Cargo_2 [Ingots]. Done.
    Moving item MyObjectBuilder_Ingot_Silicon from Base_Cargo_6 to Base_Cargo_2 [Ingots]. Done.
    Moving item MyObjectBuilder_Ingot_Iron from Base_Cargo_6 to Base_Cargo_2 [Ingots]. Done.
    Moving item MyObjectBuilder_Ingot_Gold from Base_Cargo_6 to Base_Cargo_2 [Ingots]. Done.
    
    But items do not end up where they should be. In the end the Silicon ingots are in Base_Cargo_3 [Components] and such things?!

    Can someone enlighten me a bit? O_o

    Thanks!
    --- Automerge ---
    Somehow it started working by just calling the script often enough *confused*
     
  2. d4rky1989 Apprentice Engineer

    Messages:
    332
    Ensure there are no other game objects that are moving items (e.g. sorter with "drain all" enabled). If you need full control over item movement you have to turn off "use conveyor system" on all blocks.
    Of course there can still be a bug in you script. If turning off "use conveyor system" does not help, than you might post your script so people can check it for errors
     
  3. mze9412 Junior Engineer

    Messages:
    791
    Thanks, my internet stopped working on Saturday -.- My scripts works now properly :)
     
  4. mze9412 Junior Engineer

    Messages:
    791
    Could someone maybe enlighten me how I managed to get negative inventories? -.-

    See also: here
     
  5. Phoera Senior Engineer

    Messages:
    1,713
    there was bug report about negative ship mass, may these are connected, anyway, create bug report.
     
  6. mze9412 Junior Engineer

    Messages:
    791
    Thank you, I found the bug entry and added a comment there :)
     
  7. XkyDiver Apprentice Engineer

    Messages:
    360
    Speaking from the limited, confused experience I had getting an Inventory script to work last weekend, I can say that you want to be very careful about what numbers you're sending to the TransferItemTo and TransferItemsFrom lines. I resorted to using Math.Abs(value) to make sure I didn't transfer any negatives around. :)

    Once I glitched my ship's inventory so badly I had to force-quit the game... ;)
     
  8. mze9412 Junior Engineer

    Messages:
    791
    Good idea, and always check if amount is not higher than the available one, right?
     
    • Friendly Friendly x 1
Thread Status:
This last post in this thread was made more than 31 days old.