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. TehGM Apprentice Engineer

    Messages:
    321
    As programmable blocks came to SE, and not all players are programmers, I guess a thread with block requests is reasonable.

    Basically, if you want a script on your block, post explanation here. Other programmers and I (Although I'm generally a busy person so maybe not often) will be more than happy to program it for you. Of course I still suggest you to learn programming, but you might not want to, and it's all fine. Other people like other things.
    (Yes, I wanted to create website for that, but things irl started kicking and didn't find time for that, sorry. I'll pick some people later and get on it, unless someone else does it earlier.)
    (Yes, I used forum search, but if such topic exists and I didn't notice, sorry.)
     
    Last edited by a moderator: Jan 1, 2015
  2. rottielover Apprentice Engineer

    Messages:
    481
    One of the things that I think many of us wanted / though of when talking about program blocks was the ability to sort inventory.

    So, if this is even possible....

    I would like a way to sort my inventory.

    Possible example: If I rename Cargo Containers to the item I want stored in it, then the program block will start moving that item into that container (should assume I've tubed and conveyred up everything).

    So If I setup a connector collector system the program block could somehow move just the item I want to the proper connector might be another way to accomplish this.



    Of course this assumes the ability to move inventory's and search them.
     
  3. Textor Junior Engineer

    Messages:
    775
    After reading the official documentation for blocks, there is currently no way to look at inventory inside of blocks. This will likely be implemented later. So, I know this will be a popular request, but for the moment it isn't possible.
     
  4. Bad_Idea Apprentice Engineer

    Messages:
    498
    I've been trying to figure out how to declare the maxLength - and by extension other floats - of a Piston. Anyone have this figured out?
     
  5. Thedevistator Senior Engineer

    Messages:
    1,942
    Could you make a code combination lock for doors? I want to try to learn coding myself, but I might as well have some examples, besides it will take awhile to learn anyways.
     
  6. Locko1997 Trainee Engineer

    Messages:
    17
    I must say i love your signature hahahahah

     
    • Agree Agree x 1
  7. Textor Junior Engineer

    Messages:
    775
    From what I'm seeing, the values on pistons/rotors/lights/other blocks with sliders have "increment" methods, but aren't explicitly able to be set (yet. They really should let us.)
     
  8. Leadfootslim Senior Engineer

    Messages:
    1,300
    Is there a way to check distance from a given antenna? If so, a simple "if distance > x, turn on inertial dampeners" would be great...
     
  9. Martinineter Senior Engineer

    Messages:
    2,253
    If that is possible, I would like to request having a ship follow another ship on a said distance (just like the sensor drones do, but in a more compact fashion).
     
  10. Bad_Idea Apprentice Engineer

    Messages:
    498
    I was afraid of this... that's very sad, if true.
     
  11. pipakin Apprentice Engineer

    Messages:
    182
    Just in case someone didn't see the other thread (I know you did Textor), this is actually possible, though it wouldn't be a small script.
     
  12. AutoMcD Senior Engineer

    Messages:
    2,369
    a few that might be possible depending on information available:

    -(as already mentioned a million times) inventory sorting / stacking

    -battery manager, make batteries actually act like batteries automatically

    -update a beacon name to display location (i was on a server that used a mod to do this once, name it "pos:" and it would fill in the rest with coordinates)

    -antenna relay / decluttering, have antenna only turn on when "requested" to via beacon/antenna name signal
    a few ideas to that effect:
    if you have a daisy-chain of antennas to relay signals along, only show the nearest ones
    if you have a nearby outpost with lots of small craft near it, only show the outpost/large antenna until you get closer.. but still be able to access the small craft remote control..
    -perhaps you have a base but want it to stay hidden unless you get lost, could turn signal on remotely to get home

    -can we save data in any way? even if it's encoded in naming a part or placing inventory in an encoded way. perhaps we could make notes and waypoints this way?

    -compass / navigation directional tools. perhaps using the button panel to point the ship along X/Y/Z axis, or autopilot back to a particular coordinate.

    hope i got a few of your gears turning. ;)
     
    Last edited by a moderator: Jan 1, 2015
  13. Cuber Apprentice Engineer

    Messages:
    262
    I don't know which namespaces are accessible, but System.IO ain't one of them so I doubt we can use file operations. Could make an antenna name storage system ;>
     
  14. Skeloton Master Engineer

    Messages:
    4,069
    I would not want to come across as demanding but Ive made a small beacon marker device. If/when its possible I would like for it to rename the beacon from "ShivaNet-" to "ShivaNet-<insert detected ores here>"

    Infact even finding out if that's possible would be nice to know :p
     
  15. Cuber Apprentice Engineer

    Messages:
    262
    Did you forget a sentence? Are you asking if it's possible to change the beacons name according to an Ore Detector's detected ores? :confused:
     
  16. Skeloton Master Engineer

    Messages:
    4,069
    I did not :p

    That is what I'm asking, Im also asking for the more programme gifted to help (read: do it for me) me.
     
  17. Shiliski Apprentice Engineer

    Messages:
    290
    Right now you can't program anything that you can't also do through buttons and timer blocks. You can't even fire rockets at the moment, though you can still launch player-made torpedos and turn turrets off and on.

    I hope that they will change this in the future because this is exactly the kind of thing I'd like to have. Ideally I'd want to be able to have a drone turn towards and track an ore signal.

    You mean they're private variables? I find that really strange since the user can just outright set those through the K menu. I hope there's some function in the future that just lets us set them to a float of our choosing.
     
    Last edited by a moderator: Jan 1, 2015
  18. Cobra Apprentice Engineer

    Messages:
    204
    For automated inventory sorting check this mod:
    http://steamcommunity.com/sharedfiles/filedetails/?id=321588701&searchtext=

    I use it on my server and it works great
     
  19. pipakin Apprentice Engineer

    Messages:
    182
    If you have access to the server settings this really is a great mod.
     
  20. Fragman Apprentice Engineer

    Messages:
    294
    Walking code for 2legs / 4legs robots.
     
  21. shimonu Apprentice Engineer

    Messages:
    394
    Code:
    var piston = GridTerminalSystem.GetBlockWithName(zxc) as IMyPistonBase;
    var n = piston.MaxLimit;
    antenna.SetCustomName(n);  
    
    Question is. Is it possible to get float to string?
     
  22. DDP-158 Master Engineer

    Messages:
    3,748
    I second this one. I suck with timer blocks and sadly I also only have limited VB experience and not C++ even though I have like 15 books on the subject (When I worked for HP, Engineers would occasionally clean out their cubicle and put books to throw away by the break room. I would go through and snatch anything I thought would be useful for later purposes).
     
  23. Textor Junior Engineer

    Messages:
    775
    I'll work on this. I managed to make a script that looks for stone and kicks it to an ejector/connector block for removal, so this seems like it'd take a bit of work, but is possible. You'd need to either have a timer set up to run the script periodically or a button to manually run it (or both), since infinite loops aren't allowed.
     
  24. Bad_Idea Apprentice Engineer

    Messages:
    498
    Technically you should be able to use anything as a String/Boolean storage system by either changing its name or checking if it is on/off.

    Heck, you could use block names for a lot of storage tasks.
     
  25. TehGM Apprentice Engineer

    Messages:
    321
    Yes.
    Code:
     piston.MaxLimit.ToString(); 
    Same goes for integers, booleans, etc etc. Actually for anything, but most things will return type name.
     
  26. Textor Junior Engineer

    Messages:
    775
    No, they are read-only properties (I.E. they don't have a set property on them).

    For those confused by what I'm saying (Not necessarily you, Shiliski):

    So, in C#, you have variables and properties. In a class:

    Code:
    private class MyClass
    {
        private int myVariable;
    
    /*...truncated.*/
        public int MyVariable /*This is a property, rather than a variable.*/
        {
            get { return myVariable;}
        }
    
        public void IncrementMyVariable()
        {
            myVariable++;
        }
    }
    
    So, in this example, you have an int called myVariable (we will assume it is initialized in the constructor. If you don't know what that means, ignore it, it isn't important).

    When I make a new MyClass object, it will have myVariable in it, but you can't directly access myVariable, you have to read it through the MyVariable property:

    Code:
    MyClass example = new MyClass();
    example.myVariable = 0; /* THIS IS NOT ALLOWED-- myVariable is a "private" variable and therefore can't be seen outside of the MyClass definition. */
    example.MyVariable = 0; /* THIS IS NOT ALLOWED-- MyVariable does not have a "set" function, so can only say what the value is, it cannot set the value.*/
    example.IncrementMyVariable(); /*PERMITTED. This will add 1 to the total of myVariable*/
    
    So, it isn't that the max on pistons is private or static, it is that it isn't writable outside doing the increment actions that are programmed into the block.

    That being said, I think they should add the set{} bits to any player-modifiable values on a block.
     
    Last edited by a moderator: Jan 2, 2015
  27. Borg Trainee Engineer

    Messages:
    12
    http://steamcommunity.com/sharedfiles/filedetails/?id=367386248

    You need:
    programmable block x1
    timer x1
    Extra container for unsorted items x1

    If you want to use this script, load it into your programmable block, connected to the grid. Then set a timer block to run the program every two seconds and start countdown again. Name one container "#OTHER". This container will collect items that cannot be sorted and will act as an intermediate container.

    If you want to make a cargo container sortable, it name must start with "$" and contain names of the items you want to store there. For example, "$Gold Iron Thrust LargeTube" will collect Gold, Iron, Thrust and Large Tube from other containers, while will drop other items to the "#OTHER" container(name of the extra container can be changed in the script).
    Containers whose names don't start with "$" won't be sorted.

    There are maybe some bugs, and you need to know the exact item name. Feel free to ask any questions.
     
  28. Volfram Senior Engineer

    Messages:
    1,564
    Can I get a look at this? I did a little messing around earlier today but didn't think of a lot of ideas I wanted to actually mess with.

    I will probably be upgrading my courier drone.

    Question answering time!
    Disclamier: If I say something is "not possible" or that there is "no way" to do something, that means there is now way THAT I KNOW OF, not that it is impossible. Someone else may figure something out, and I'll be happy to see what they've got. In the realm of computer programming, there's actually very little that is truly impossible.

    Antenna blocks do not have a "distance" value, though if you're on the same grid it would be possible to check the relative coordinates of the antenna and the programming block and calculate the straight-line distance. As-per the video, there is currently no way to access off-grid blocks. I haven't checked whether blocks through a Connector, Rotor, or Piston count as "off-grid."

    The Ore Detector is currently able to tell you what its range is and whether it is set to broadcast ores it finds via attached antennas. There's currently no way for the programming block to be informed what ores those may be.

    I would need more specifics on the robot design.

    Actually, better to talk to Spets about this one, though I'd be happy to work with him on a design.

    And the big one.
    See above, Textor is apparently onto something(and I'd REALLY like to take a look.)

    Reactors and solar panels do not currently output their power capacity. Batteries can tell you whether they have any charge left, but not how much. Trying to find the limits by turning power sources on and off can't work because the Programming block requires power to run.(I assume)

    Beacons can be set with their relative coordinates in the grid they're on. I assume this is relative to the grid pivot(haven't checked). There's a way to make this into a GPS system where all beacons are relative to the same grid pivot, but it's a pain in the neck, and the hard part isn't programming-related.

    Hmm. Can't detect automated requests because wireless communication isn't currently possible via block commands(what you use for timers, buttons, hotkeys, and now programming), but you could use a set of sensors and other on-system devices to let the programming block know whether it needs to update, and it can then turn beacons/antennas on/off and set their labels.

    Absolutely! You can store strings in part names or beacon text, and there's plenty of metadata you can access. Rotor positions and bounds, for example. I can see a rotor(possibly a headless one, will need to experiment) being used as a fairly extensive piece of nonvolatile data storage.

    Hmm. You might be able to gimball up a set of gyros to lock them into an orientation. Actual rotor angles can not currently be read directly, but a set of sensors could be used to detect positions on the orrery.
     
  29. Forgemasterhd Junior Engineer

    Messages:
    612
    It isn't right now, however if we can control ore detector returns and such, this could easily become possible, at least, once we (Read: I) could figure out how to change a name of a beacon or antenna.
     
    Last edited by a moderator: Jan 2, 2015
  30. Danzarlo Apprentice Engineer

    Messages:
    182
    Cargo Inventory sorter
    http://steamcommunity.com/sharedfiles/filedetails/?id=367386248&searchtext=
     
Thread Status:
This last post in this thread was made more than 31 days old.