Modding Help Open inventory and scriptCanvas with one interact

Discussion in 'Starbound Modding' started by FireFlyForLife, May 22, 2016.

  1. FireFlyForLife

    FireFlyForLife Aquatic Astronaut

    I am trying to make a mod where you can interact with a console object and it will open its ui with the players inventory next to it. Similar to how chest interfaces look. The UI lib that I am using is penguingui. But I cant figure out how to open the player inventory when you interact with the object.

    My project can be found on Github.
     
  2. FireFlyForLife

    FireFlyForLife Aquatic Astronaut

  3. Inf_Wolf14

    Inf_Wolf14 Parsec Taste Tester

    Sorry, personally I stay away from the UI elements of the game (Too much restriction for my creative mind currently).

    Maybe a thread bump can find some knowledgeable people?
     
  4. Peelz

    Peelz Giant Laser Beams

    I've been messing around with GUIs myself and I don't think that we have a way currently of opening the inventory through Lua. GUI moddability is still woefully slim. I could be totally wrong though, and if you find a way to do this, please let me know!
     
  5. TheWall

    TheWall Phantasmal Quasar

    After looking at the files (Stable), I came to the same conclusion as Peelz. There are some other windows you can open, and it might be possible to create a workaround by opening a trade window (which might also open your inventory), but I did not see any simple way to open inventory from LUA, it seems to be hard-coded into the Container objectType.
     
  6. FireFlyForLife

    FireFlyForLife Aquatic Astronaut

    thank you both for responding!

    That is quite disappointing, however I may be able to work around this however I don't quite know how to implement this so maybe you guys can point me in the right direction? :3
    For the workaround I would need to:
    - know how to give a player an item.
    - know how to get all the items in a players inventory.

    Is this possible in the current lua api?
     
  7. The | Suit

    The | Suit Agent S. Forum Moderator

    We should be getting a documented Lua API hopefully in a few months.
    I know it is not the answer you want to hear, but the documentation will help a lot since so much as changed from the existing documentation.
     
  8. TheWall

    TheWall Phantasmal Quasar

    Actually, I want to make a correction to my previous statement. I believe I have found how you can do it. Although the inventory open seems to be directly related to the objectType "container", there is actually an example of a crafting station that uses the "container" objectType in order to open your inventory, and it then uses the storage location as the input for the crafting.

    There are actually a couple, but the simplest is going to be the Repairo. It is the NPC in the outpost that you repair your vehicle controllers at. Note that the inventory is not opened in the .lua script, but because the "NPC" is actually an object of type "container" and not actually a real NPC.

    In the *.object file it opens another interface, which is the actual crafting station interface, and the *.lua file handles that. To make the inventory open, you only need to use the objectType "container"
     
  9. Inf_Wolf14

    Inf_Wolf14 Parsec Taste Tester

    A lot of custom "crafting" stations use this setup. Where the station is nothing more than a container where an associated .lua file manipulates the contents to read the input and "craft" the item. (Or at least generate output in some fashinon meant to differ from standard crafting.)

    The Repairo uses the same functionality modders have used for a whie, but it looks prettier.

    If @FireFlyForLife 's GUI can function solely from a few item grids and/or images, then his idea is possible. But instead of reading the player's inventory as a whole, they would need to input the items to be read and determine what to give the player. (I'm not entirely sure if an inventory check can be accurately called from the object's script... If that's the case, then you only need to include an output slot in the UI. I'll check this later today.)
     
  10. FireFlyForLife

    FireFlyForLife Aquatic Astronaut

    Very interesting, will check out the Repairo and see if I can do something with that.
     

Share This Page