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.

Block scripts requests thread

Discussion in 'Programming (In-game)' started by TehGM, Jan 1, 2015.

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

    Messages:
    99
    Wow, did not see that.
    As a special thanks...

    [​IMG]
    [​IMG]
    [​IMG]

    EDIT: And yes, that means it's in stable.
    EDIT #2: Whoops, wrong screenshot was posted.
     
    Last edited: Dec 27, 2016
  2. Wicorel Senior Engineer

    Messages:
    1,262
    When did these get added to In-Game API?
     
    • Agree Agree x 1
  3. Knsgf Junior Engineer

    Messages:
    538
    Less than a week ago.
     
    • Friendly Friendly x 1
  4. AceScottie Trainee Engineer

    Messages:
    2
    Hello. Im looking for a fairly simple script for assemblers and refineries.
    I Have looked on the workshop but most scripts dont work due to beta update and a lot of them are too over complicated for what i need.

    Im looking for a simple script that will take the outputs of refineries and assemblers and put them into sequentially named cargo containers ("cargo 1", "cargo 2" etc.).
    If i request 100 plates they get split into each assembler and it takes me ages to go though the inventories to find them all (i have 30 assemblers, 10 refineries, 50+ cargo containers and 80 reactors along with a few connected ships).

    Additional request (if you have time), for the assemblers to be cleaned out once a job has finished processing.
     
  5. Sinbad Senior Engineer

    Messages:
    2,788
    hello,
    first post? welcome!

    with inventory management, you really cant go past Taleden's Inventory Manager (or TIM).
    http://steamcommunity.com/sharedfiles/filedetails/?id=546825757
    it really is easy to set up, and will do exactly what you want, though you do need need to add simple tags to your containers, like [TIM Ingot] to store ingots. it uses a basic kind of predictive text to help you out, so if you add a tag [tim ing] it will automatically change the tag to [TIM Ingots], so you get a confirmation its working.
    its got a whole bunch of extra stuff as well, but it wont use any of it without a tag. it will be there when you decide you need more features though, ready to help out.
    if all you want is for assemblers to be emptied, with the components going to specific containers, just tag the containers for the component type [TIM SteelPlate], and that container will gather steel plate from any attached inventory.
    from the size of operation that you describe though, you might want to look at the tutorial video on the workshop. its long, but it will open your eyes as to what can be achieved without you having to worry about it happening.
    since i have started using it, i have hidden my refineries and assemblers and large cargo containers. all i worry about is the small cargo containers near my hangers that keep 100 of each component, as well as a little ammo and some bottles (each time i take something, it refills it from the larger containers, if i put something back, it stores the extra out of my way back in the large container) i have yet to need to interfere with assigning production queues, or moving stuff around manually.for comparison, i have 8 refineries (two with full effectiveness for those ores), 16 arc furnaces, 28 assemblers, six O2 generators, 12 large cargo containers, 4 docking ports with various ships attached, as well as 8 gat turrets, 4 missile turrets, 2 large reactors and about 6 small cargo containers that i use as inventory access points for building. everything (except the above mentioned effective refineries) is fully upgraded with production modules for speed. so a comparable sized operation to yours with the exception of cargo containers (you wont need as many with this script as you dont need to remember where anything is, TIM can bring what you want to one access point).
    try it. you will like it.
     
    Last edited: Dec 27, 2016
    • Like Like x 1
  6. AceScottie Trainee Engineer

    Messages:
    2
    Yea first post thank you.

    The script is great, does 99% of what i need it to without interfering with all the others.
    I wanted to get into learning the API for SE but with the way things are changing up and the API system calls, it looks really repetitive.
     
  7. Jon_Winfield Trainee Engineer

    Messages:
    7
     
  8. Sinbad Senior Engineer

    Messages:
    2,788
    You dont even need the reference thrusters. Think of it as intercepting the control cables coming out of the cockpit. Now we can plug them into a computer instead and do all sorts of stuff with them. All the funky work-around contraptions we used to use to sample player input are now irrelevant. We can get them right from a cockpit or remote block.
     
  9. Cadde Trainee Engineer

    Messages:
    99
    Yes, in a sense it does. But you don't need that!

    [​IMG]

    First off, there is no "Utils" class in ingame scripting. Nor is there a "Panels" class.
    This is my own dev environment where i have created such "wrapper" classes because it's easier to use than the GridTerminalSystem.

    Either way, the end result is this:
    [​IMG]

    The top right panel is the output of that snippet of code.
    EDIT: The first two thrusters are atmospheric thrusters. Hence no "current thrust" on them.

    If you need to link certain thrusters with certain mass blocks, you can either check the thrusters orientation or you can name them appropriately. It's all up to you.
    Unfortunately, i will not give you an example script for that right now as i have other things i wanna do.
     
  10. nubeees Trainee Engineer

    Messages:
    83
    It would be really cool to see a WSAD gravity drive script! And if its grabbing information from thrusters, that means it will even work with inertial dampeners, right?
     
  11. GrindyGears Senior Engineer

    Messages:
    1,787
    Hey, So i know this is probably going to be a long shot, and if it's not feasible/ would take too long please just outright say it, but I have a 2 part request.

    If any of you have seen my work, either on the forums or elsewhere, you know I like to build mechanical klang inducing monsters. @Sinbad has been kind enough to write me a comprehensive, easy to modify script that uses digi's control module mod to animate my creations. It works exceptionally well and can be incorporated into almost anything.

    However I am now at a bit of an impasse, it's getting to a point now where i'm having some serious trouble keeping track of my bucket/drill when its in a hole, i could just use third person, but if this is possible, it could be much more immersive.

    Part one which would be the core request: I'm looking to get a graphical output of my bucket position/ orientation, it doesn't have to look like the boom or share the shape, "straight" lines would be just fine, with that i could get a general idea of where my bucket is in relation to the surface without having to go into third person.
    Bonus points if you add a depth indicator.

    For reference, this is approximately the same boom configuraion: 3 segments + bucket.

    [​IMG]

    The second part i suspect would be a little more involved and probably much less possible.
    I'd like to be able to also get a ground read out, so at any given slice i should be able to see a profile of my cut, The boom near the bucket is probably going to be 5 or 7 blocks wide and 30m+ in length, so there is ample space to put in any hardware needed, just tell me what it is, and i'll make it happen

    it's not the best image but something like this (profile only), but less detail:

    [​IMG]

    Thank you in advance to anyone who can or is willing to take this on. When i finish (the excavator) and release it to the workshop you'll get the highest of praise on the page!
     
    Last edited: Jan 1, 2017
  12. Cadde Trainee Engineer

    Messages:
    99
    In regards to the previous post. What we need is a way to draw primitives on LCD's.
     
  13. nubeees Trainee Engineer

    Messages:
    83
    Well, it's not exactly what's being requested, but I'm reminded of that 3D projection script on the workshop. Has anyone else played with that?
     
  14. kcjunkbox Senior Engineer

    Messages:
    1,132
    I'm not a programmer. I am looking for a script to make using all my cameras on my ships much easier. I'm looking for a script that by default has all cameras off, so when scrolling through them I don't have to scroll through ALL of them. Then when I run it with an argument via the hotbar or better yet using the number pad it turns on all cameras in one of the six directions and displays the first available camera. Then I can use the [] keys to switch between all the cameras looking in that direction. The first available is important because offten cameras are the first thing destroyed in battle and I need it to select a working one and then I can scroll through them to find the best view. Since all the other cameras in other directions are off, I will not have to scroll through all of those cameras to find the one I want. Then when i want to select another direction, it shuts the first group off and turns on the group for the new direction and selects a usable camera and views it in that direction and then I can scroll as needed.

    Ideally the number pad would be great to use as it is not a straight line like the hotbar and has "direction" to it that will make selecting the direction you want more intuitive. For example:
    8 is forward cameras
    2 is rear
    4 is port
    6 is starboard
    9 is up
    3 is down
    7 scrolls through cameras one way
    1 scrolls through them the other way
    0 is docking camera
    5 is internal cameras

    Or something that is intuative like above.

    Is this possible and would someone like to write it?
     
  15. Saberwulfy Apprentice Engineer

    Messages:
    292
    Looking for planetary based gyros dumper.
    Cars will fall better on wheels after a jump and walkers will need much less thrusters and manual handling for balance. A balance based in artificial inner ear vestibular system is very efficient.

    This script need detect the ground or downside of gravity, detect the mass, apply after little time a soft and regressive spin to gyro to vehicle still on same position if it isn't.
     
  16. nubeees Trainee Engineer

    Messages:
    83
    This seems pretty useful! Although, I had asked a few weeks ago if it was possible for a script to detect the center of mass of a ship and align a piston accordingly, and apparently there is no way for a programming block to find the center of mass.
    (I'm assuming by mass you mean center of mass, though, I might be misunderstanding)
     
  17. Saberwulfy Apprentice Engineer

    Messages:
    292
    Why it need the center of mass?
    It just need know the mass because more mass more force is needed.

    For your script, if it can't find the center of mass, you can find what's each item is and where it is, so look for a formula to calculate the mass of items from where is and return the center of mass!
     
    Last edited: Jan 14, 2017
  18. Wicorel Senior Engineer

    Messages:
    1,262
    Scripts can only access blocks that are in the Terminal menu. So they cannot detect armor, conveyors, conveyor tubes, etc. So they cannot accurately calculate the center of mass (COM).

    Getting COM is on the 'wish list'; unfortunately, Rexxar said "no' to COM.
     
    • Agree Agree x 1
  19. kcjunkbox Senior Engineer

    Messages:
    1,132
    There are ways to get center of mass, there are two mods that I know of that do and depend on it. Atmospheric Physics and Thruster Physics.
     
  20. Inflex Developer Staff

    Messages:
    397
    In-game scrips have restricted API compared to Modes.
    You can make some estimations based on known blocks and cargo but no reliable way to get exact CoM.
    --- Automerge ---
    There is no black magic going on. It's all about what In-game API allows and what it restricts.

    The Floor plan script you are mentioning here is using this method:
    https://github.com/KeenSoftwareHous...s/VRage.Game/ModAPI/Ingame/IMyCubeGrid.cs#L39

    It simply tells you whether there is a block on given "grid position" or not. True/False, that's all, no more info. So you can simply brute-force all "positions" on given grid and get basic idea where are blocks and what is empty space. But still no info about block type or it's mass. To get such information you would need this method:
    https://github.com/KeenSoftwareHous...s/VRage.Game/ModAPI/Ingame/IMyCubeGrid.cs#L46

    And that one works only for "Terminal blocks". It returns null for all "Non-terminal block" even though there is one on given position.
     
    • Informative Informative x 1
  21. Saberwulfy Apprentice Engineer

    Messages:
    292
    Can't rotors be used to find the center of mass holding it at one or more location and use the rotor force results with area calculation to find the center of mass?
    Like a tire balancing script?

    Sorry about the last post but i already delete before you finish your reply, that post was unsupported
     
  22. nubeees Trainee Engineer

    Messages:
    83
    I had an idea for a pretty useful script that should be possible! (though may be a bit shotty on multiplayer)

    Using the camera raycast you can get the GPS coordinates of a grid.
    Using these GPS coordinates returned every <insert time here>, you can get a position, along with a velocity vector based on how the position changes!
    Using this, you could theoretically make a script that allows for relative inertial dampening!
    There might be easier ways to do this, but I'm working off of what I know for sure can be done.
     
    • Like Like x 1
  23. Sabre One Trainee Engineer

    Messages:
    21
    I think I seen a few examples out there, but stuff was either outdated or they never released the script.

    Looking for a drone escort and or deployment script.

    I would like a remote script that gets a pre-determined distance on my left and right of my ship. This cord then relays back to two drones and gives them positions to move to. Not to worried about any other actions beyond simply going to the side of my ship when pressed.
     
    • Agree Agree x 1
  24. Mattk50 Trainee Engineer

    Messages:
    69
    Right now batteries will use their power before lit solar panels on the grid, meaning extreme micromanaging is neccasarry but possible to sustain a base on just battery and solars with day/night cycle. A script that manually checks if solar panels are at their usage capacity as i've seen automated LCD's mod is capable of and sets batteries to recharge or discharge an an intelligent way would be nice to resolve this. Not really sure how to do this as i dont understand the automated LCD script to begin with.
     
  25. Saberwulfy Apprentice Engineer

    Messages:
    292
    I'm looking for a script to show and advice when a mech arm is shaking to much for prevent break
     
  26. halipatsui Senior Engineer

    Messages:
    1,253
    You could attach antenna to the bucket to see exact position in your hud. Or 2-4 to see the heading.
     
  27. GrindyGears Senior Engineer

    Messages:
    1,787
    I had considered something of that nature, however there is a minor issue with that. When looking in first person, there are a insane number of combinations that could give you for example 42m is it further away in the x axis, and not deep in the y, or is it perhaps the opposite? or even somewhere in between? While i will concede that the second part of the request probably isn't terribly viable I think the first part could be, If i knew how to code it, I would write it something like this: (no actual code, not even pseudo)

    Get points, which would be one rotor of each joint. So (0,0) Would be the cab (+ an offset from a brown line that I'd call the "ground")

    Draw a line from Base (0,0) to the first pivot (segment 1) of length X
    Then from First pivot, to second pivot (First segment to second)
    Second to third.
    Third to Bucket
    and then draw a pair of circles centered about the tip of the bucket to show the right and left click mining radii.

    But i do cede that it's probably a pipe dream, and given keen kinda broke subgrids again I haven't had a chance to even really begin production.[/QUOTE]
     
  28. halipatsui Senior Engineer

    Messages:
    1,253
    [/QUOTE]

    Putting one antenna there that allows you to see exact orientation and distance to the bucket.
    Probably pretty good reault if you think about it results/time
     
  29. GrindyGears Senior Engineer

    Messages:
    1,787
    Putting one antenna there that allows you to see exact orientation and distance to the bucket.
    Probably pretty good reault if you think about it results/time[/QUOTE]

    Now im confused... how exactly do you intend to see its exact position when:
    A) its like 60m subterranean and you don't have LoS
    B) Trying to judge it from first person with some lateral skew because of where the cab is.
    C) how does it give orientation, i genuinely have no idea....
     
  30. halipatsui Senior Engineer

    Messages:
    1,253
    Now im confused... how exactly do you intend to see its exact position when:
    A) its like 60m subterranean and you don't have LoS
    B) Trying to judge it from first person with some lateral skew because of where the cab is.
    C) how does it give orientation, i genuinely have no idea....[/QUOTE]

    With one antenna.
    You can see the where the antenna is with its signal. We could say you get the vector towards the bucket.
    Antenna itself provides you also with distance to the bucket. In other words you have all the information to know exactly where the bucket is.

    With 2 or more antennas

    You can get very rough estimation about the angle by comparing the positions of the 2 signals. Gor example if you see the signal dots on top of each other you know the bucket is aligned with vector going trough your line of sight.

    But i think piston muscles or rotors would give you better data of alignment of the bucket.
     
Thread Status:
This last post in this thread was made more than 31 days old.