1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

MoveIT Script V2.0: one script to rule them all

Discussion in 'Programming Released Codes' started by Brenner, Jun 14, 2015.

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

    Brenner Junior Engineer

    Messages:
    609
    To V1.0 users: Version 1.0 is terminally broken because Keen decided to remove one of function in the API. To fix, just update to V2.0 (just edit your programmable block and insert it from workshop again). All your old commands should still work with V2.0.

    Version 2.0 notes
    Version 2.0 is here! The new version allows you to set pretty much every slider in the game, for example allowing you to change the color of lights, grav gen dimensions and

    loads of other stuff. Also setting text and exchanging images in text panels. See video #1 for some examples.
    The V1.0 features - setting piston length, rotor angle, thruster override are of course still there.

    Summary

    This script aims to fix some weaknesses in SEs User Interface: it allows you to set a piston to a exact height, turn a rotor into a exact angle, set the acceleration of grav

    gens and set the override of thrusters and gryoscope to an exact amount.
    Hopefully Keen will at some day add this things directly to the User Interface, but until then this script will act as workaround.

    You only need a single programmable block on your ship or station to handle *all* rotors and pistons etc.

    See video #1 for some new examples showing off some of the new V 2.0 features.


    See video #2 for some older example usages, based on script version 1.0. (Everything shown there is still supported in V2.0, command parameters are the same too)


    Installation / Updating from V1.0

    You only need to place only one programmable block running the MoveIT script on any ship or station (no matter how many rotors, pistons etc. you want to operate) .

    Download from Steam Workshop, build the programmable block, hit edit in the blocks menu, click the "Browse Workshop" button and select the MoveIt Script.
    Now Save & Exit the script.

    To update from V1.0: just do the "Insert from Workshop" routine I just described to your existing programmable blocks.

    Command Line usage

    This script heavily uses command parameters. Command parameters tell the script which blocks to manipulate and what to do with them. Whenever you pull a programmable block into a button panel, a cockpit action or a timer block, you get asked for a command parameter.

    The command Parameter vary from target block to target block, but the general form looks like this:

    "My awesome rotor" 45

    The first part is always the name of the block or the group you want to control by the script. If its a groupk, the script will try apply the command to all blocks in the group.
    If the group or block name has spaces or semicolons in it, you must enclose it in double quotes.
    If the group or block name is only one word without any spaces in it, you can omit the quotes.

    The second part is the primary argument: for rotors, this is the angle to set, for pistons that is the length they should extend or retract too etc.

    Some blocks also support additional, secondary arguments (some do actually ONLY support secondary arguments). For example:

    "MyRotor" +10 LowerLimit 0 UpperLimit 90

    The "MyRotor" is the block name and the +10 is the desired amount of degrees to add to the angle. The additional parameters "LowerLimit" and "UpperLimit" tell the rotor to stick between this two angles.

    Examples:

    "MyRotor" 45 correct
    MyRotor 45 correct
    My awesome rotor 45 wrong. First argument must either be one word or enclosed in double quotes.


    Import note: if you get the command parameters wrong, nothing will seem to happen. See if your programmable block prints out any exception. If so, hit "Edit", then "Remember&Exit" to restart the programmable block and get it working again.
    After that try setting up the command parameter again and try again.


    General Arguments available in all blocks

    There are 4 standard things that can be set in ANY block, basically the 4 on / off things at the top of the UI: Turn Block on or Off, Show In Terminal, Show In ToolbarConfig, Show On Hud.

    Secondary Arguments: OnOff,ShowInTerminal,ShowInToolbarConfig,ShowOnHUD

    Examples: "My Rotor" OnOff 1 Turns the Rotor named "My Rotor" On
    "My Rotor" OnOff 0 Turns the Rotor named "My Rotor" Off
    "My Rotor" ShowInTerminal 0 Hide the Rotor named "My Rotor" from the UI

    You can set those 4 things in ALL blocks. I won't list them in the secondary arguments of the different blocks (like Rotor) anymore, because I don't want to sound like a broken record.

    Rotor

    Import note: to preprare a rotor for proper use by the script, set the upper limit and lower limit of the rotor to 0 (I mean the Lower and Upper Limits of the game, not the

    command arguments described below)

    "MyRotor" 45 rotate a rotor named "MyRotor" to exactly 45 degrees
    "MyRotor" +45 rotate by exactly 45 degrees
    "MyRotor" -22.5 rotate by exactly -22.5 degrees (22.5 in the other direction, that is)

    "MyRotor" +10 LowerLimit 0 UpperLimit 90 rotate by 10 degrees, but make sure you keep inside the limit of 0° to 90°
    "MyRotor" LowerLimit 0 UpperLimit 90 Normal case: don't rotate at all. If the rotor is out of the limit of 0° to 90°, moves it back to one of them

    The rotor supports following secondary arguments, for setting the velocity of the rotor and such:
    Velocity,Displacement,BrakingTorque,Torque

    Piston

    "MyPiston" 5 extend or retract the piston called "MyPiston" to 5 meters
    "MyPiston" +5 extend the piston by 5 meters. (the plus means: add 5 meters)
    "MyPiston" -5 retract the piston by 5 meters.


    Note: Space Engineers makes sure you can't exceed the piston range limits. So if you try to set +100 , a large vanilla piston will still only extend to 10 meters and thats it.

    Secondary arguments:

    Velocity,UpperLimit,LowerLimit

    Note: if you set the UpperLimit and LowerLimit AND you also use the primary arguments (for example MyPiston 10 UpperLimit 5) the primary argument wins, the piston will still extend to 10 meters.


    Grav Gen

    "Grav gen 1" +9.81 set Acceleration of Grav Gen to 9.81 m/s (=1 g)
    "Grav gen 1" -4.91 set Acceleration of Grav Gen to -4.91 m/s (=-0.5 g)
    "Grav gen 1" Depth 10 Height 10 set the Height and Depth of the grav field to 10 meters

    Following secondary arguments are possible, allowing you for setting the dimensions: Width,Height,Depth

    Thruster

    Allows you to set thruster ovveride to exact values or return the thruster to normal operation again.

    "MyThruster" 5000 enable thruster ovveride and set the thruster to the specificied output.
    "MyThruster" +5000 enable thruster ovveride and increase thruster ovveride by the specificied output.
    "MyThruster" 0 set thruster ovveride to 0 and returns Thruster to normal mode (so it contributs to interial dampeners and such again)

    Secondary Arguments: none.

    Text Panel / LCD

    This one is rather complex and interesting. There are a lots of Sliders that you can set, plus you can also add or set text to a text panel (or a group of text panels).
    You can also add and remove images, and determine which thing you want to view: Public Text, Private Text or the Image(s).
    Using this Abilites in Timer Blocks, you can for example make a display that switches between texts or images (like those giant Digital billboard you can see in some bigger real life cities)

    Examples:

    MyLCD SetText "Lorem Ipsum" FontColor 255,0,0 Set the text to "Lorem Ipsum" and also make the font red
    MyLCD AddText "Blabla<br>" Adds the text "Blabla" to the text panel, followed by a line break.
    MyLCD AddImages "Cross","Danger" Adds the images Cross and Danger to the Selected Images
    MyLCD SetImages "Cross","Danger" Adds the images Cross and Danger to the Selected Images. If any other Images are selected, remove them from the list.
    MyLCD Show Public Show the Public Text (other possible choices: private or texture)

    Secondary Arguments:

    SetText Sets some Text in the Text Panel, deletes current content. Important: the text must be enclosed in double quotes. To add a linebreak, write <br>
    AddText Same as SetText, except the text gets added to the end of existing text in the panel.
    FontSize FontSize. For example 10.
    FontColor The text color. For example set to 0,0,255 for blue color.
    BackgroundColor The background color. For example set to 0,0,0 for black.
    AddImages For example "Cross","Danger". Adds the specified Images to the Selected Images. See the list of possible images in the menu of any text panel.
    SetImages For example "Cross". Same as AddImages, except all other selected images are unselected (if there are any, that is)
    RemoveImages For example "Cross","Danger". Removes the images from the List of Selected Images
    Show Can be Public, Private or Texture. With this you can specify what you want to see on the display: the public text, the private text or the image?


    Lights (both Spotlights and Interior Lights)

    You can set any slider of a Light Block. Allowing you to change the color, and everything else like Radius etc. too.
    Used in combination with timer blocks, you can for example build a warning light that constantly switches between yellow and red (or whatever colors you desire).

    Examples:
    "MyLight" Color 255,0,0 Turns the specified Light Red
    "MyLight" Radius 5.5 Intensity 2.5 Sets radius to 5.5m and Intensity to 2.5

    Secondary Arguments:

    Color (must be specified as something like 255,255,255. This is the value for red,green and blue)
    Falloff
    Intensity
    Radius
    Blinklength (Blinklenght works too)
    Blinkoffset
    Blinkinterval

    Projector

    You can change the rotation and Offset of the projected thing.

    Secondary Arguments: x, Y, Z, RotX, RotY, RotZ

    Gyro

    "Gyro" Yaw +0.15
    "Gyro" Roll +0.15
    "Gyro" Roll +0.15 Yaw +0.15 +Pitch +0.15
    "Gyro" Roll 0 Yaw 0 Pitch 0

    Sensors

    You can only set the dimension of Sensors right now.

    Secondary Arguments:

    Left,Right,Top,Bottom,Back,Front

    Sound block

    Secondary Arguments: VolumeSlider,RangeSlider,LoopableSlider

    Space ball

    Secondary Arguments: Restitution,Friction,VirtualMass

    Landing Gear

    Secondary Arguments: BreakForce


    Timer

    Secondary Arguments:

    TriggerDelay Determines how long the timers block countdown is.

    Turret

    Secondary Arguments: Range

    Warhead

    Secondary Arguments: DetonationTime

    Steerable Wheel

    Secondary Arguments: Power, MaxSteerAngle,SteerSpeed,SteerReturnSpeed,Damping,Strength,Height,Travel


    Advanced option: executing multiple commands

    If you want to execute multiple commands with one press of a button, you can always just use a timer block and as many commands as you desire to it.
    HOWEVER, if you want to save timer blocks, you can also execute multiple command by seperating them with a semicolon. For example:

    "MyRotor" +45 ; "MyPiston" 10

    With one press of a button you can turn the Rotor named "MyRotor" by another +45 degrees and extend the Piston "MyPiston" to 10 meters.
    As I said, you could also do the same thing by using a timer block and adding two calls to your programmable block containing the MoveIt script.
    Action 1 would be "MyRotor" +45 and Action 2 would be "MyPiston" 10


    Expert option: executing actions

    If you really want, and you happen to know the internal name of the action from coding your own scripts, you can also call any action on any block by using the "Action" parameter.

    Example: "MyAirVent" Action Depressurize Will depressurize the Airvent named MyAirVent.
    "myDoor" Action Open will Open or Close the door named myDoor

    The only reason why you should even consider this option is in combination with the "Executing multiple commands" feature (see above), if you want to really, really, REALLY

    save some timer blocks. No clues why you would want to do it otherwise, you can call all actions already via the normal UI.


    Troubleshooting - typical problems with this script

    If you have followed the Setup Steps above, and nothing happens please check the following things:

    - Does the programmable block print out any exception in the menu? If so, this might help you to find the problem. To get a programmable block working again after a exception you also need to hit "edit" and "remember & exit".

    - Check the name of the rotor/piston/grav gen/whatever in the programmable block arguments. If its spelled wrong, stuff won't work and a expection is printed in the programmable blocks menu

    - Ownership issues. The rotor and the programmable block must have the same owner (or maybe access via share options). Otherwise the programmable block can't do anything with the rotor.

    - Are ingame scripts enabled? In Single Player, please check the "In-Game Scripts" checkbox in Edit Settings -> Advanced of your savegame. In multiplayer: some servers have

    ingame scripts disabled. Unless you are the admin, you are out of luck.

    Future development

    I think this version covers pretty much everything I wanted to cover with it. That being said, I'm always open to suggestion.
    Its also very likely that I will add some smaller updates in the futures, adding forgotten blocks or settings in blocks, or some bugfixing.

    Demo World

    I also made a demo world where you can try out the features of the script:
    https://steamcommunity.com/sharedfiles/filedetails/?id=443002413

    "License"
    Feel free to use this script in any of your SE creations.
    In case you upload them on the Steam Workshop: a link to this page in your own description would be welcome.
    Thats all!

    Download from Steam Workshop

    Special thanks goes to LordDevious for adding the command parameter feature to the game. This script (and many others I suppose) would not have been possible without it.
     
    Last edited: Jul 18, 2015
    • Like Like x 4
  2. Brenner

    Brenner Junior Engineer

    Messages:
    609
    Update: I just uploaded Version 2.0 of MoveIT.
    New functions:
    - Set pretty much any slider in the game via button panel, cockpit action or timer block
    - Change light color
    - Set or add text to text panels
     
    • Like Like x 2
  3. torgo

    torgo Apprentice Engineer

    Messages:
    188
    Now if I can just make a 16 (or even an 8) button elevator cabin, I'm all set! Thanks for the quick update.
     
  4. Mornedhel

    Mornedhel Trainee Engineer

    Messages:
    35
    Is it possible to add a delay between certain actions, so you can start some sort of sequence?
    For example: "Door1" Action Open ; "Light1" BlinkInterval 0.5 ; "Piston1" 10 ; Delay 10 ; "Door1" Action Open ; "Light1" BlinkInterval 1;
     
  5. Brenner

    Brenner Junior Engineer

    Messages:
    609
    Hmm, not really.

    Right now the only reliable way to delay something is using a timer block, and I can't think of a really good solution that involves MoveIT somehow using a timer block to do the delays.
    I'm hoping for Keen to integrate this into the game, I think with that addition to the game it would be easily possible to add a delay function to a command chain in MoveItT.
    Its a pull request by @LordDevious , giving programmable blocks the option to call itself again in the next tick.
     
  6. Mornedhel

    Mornedhel Trainee Engineer

    Messages:
    35
  7. Mr B

    Mr B Trainee Engineer

    Messages:
    6
    I got a good one.

    For grav gens, a reverse option. I have a grav drive where I want to have all of them change at once, but they are facing different directions.

    So I can't set them all to a certain accelleration, a reverse option would sort that. I can do various workarounds, but this would be something easy to add to the code, I think!
     
  8. nubeees

    nubeees Trainee Engineer

    Messages:
    83
    I'm having an issue. I would like to take a gyroscope override value and make it add a value to the override every time I press a button. Is this possible?
    Also, how do you differentiate between subtracting a number and setting a negative number with rotor velocity?
     
  9. Brenner

    Brenner Junior Engineer

    Messages:
    609
    Not possible right now. The only things that can be set as a relative number are piston length and rotor angle.

    I might add this in a future version, maybe. Using plus and minus signs won't really cut it there, as many of those values can be negative.
    So maybe I'll have to use something like "Gyro" Yaw -0.5R , with the R meaning Relative.
     
  10. Odious T

    Odious T Apprentice Engineer

    Messages:
    229
    Hi.
    I'd like to know the command to reset rotor upper or lower limits and allow free rotation.
    Couldn't see it in the instructions but perhaps i'm overlooking it. I tried "MyRotor" upperlimit Unlimited but no banana.. :/

    And I'm also having trouble with spherical GG radius. Is it settable?
     
    Last edited: Aug 11, 2015
  11. Spets

    Spets Master Engineer

    Messages:
    3,214
    how do I make a rotor to rotate -90 degrees? because if I use that it goes to 270 instead, and I want to rotate 90 degrees but in reverse
     
  12. Odious T

    Odious T Apprentice Engineer

    Messages:
    229
    use rotor speed and set limits.
     
  13. Spets

    Spets Master Engineer

    Messages:
    3,214
    ok, going to try that
     
  14. Taranis

    Taranis Trainee Engineer

    Messages:
    16
    I'm trying to change the pictures on a LCD like you described, but I get the following error:
    Caught exception during execution of script:Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
    Am I doing something wrong? too many LCD Pictures installed maybe?
     
  15. Animal 22

    Animal 22 Trainee Engineer

    Messages:
    25
    One problem with Rotors. Can't seem to set an exact negative velocity
     
  16. Psygo

    Psygo Trainee Engineer

    Messages:
    8
    I keep getting an error saying index was out of range, using LongPiston -0.1 retract where LongPiston is a group of 5 small ship pistons, I've tried plenty different now but I can't seem to get it going, any ideas?
     
  17. galacticon

    galacticon Apprentice Engineer

    Messages:
    440
    Can this work with suspension height offset?
     
  18. Captain Awesome

    Captain Awesome Trainee Engineer

    Messages:
    27
    Ok, I'm having an issue I just can't seem to fathom.... I'm trying to create a boot up sequence. I have a group of LCD's name LCD Screens, and I tell a timer block to run "LCD Screens" Show Texture. Then 10 seconds later I call another timer to run "LCD Screens" Show Public. ... how ever this doesn't seem to work and can't figure out why. I'm calling the group, but do the lcd screens still have to be named MyLCD?
     
  19. artiedee

    artiedee Trainee Engineer

    Messages:
    27
    The only issue I have with this script is that we need a system to remember all these commands like:

    "Door1" Action Open ; "Light1" BlinkInterval 0.5 ; "Piston1" 10 ; Delay 10 ; "Door1" Action Open ; "Light1" BlinkInterval 1;

    Once you type that into ur argument thats it, its lost forever.


    What you can do is introduce a text panel to be used as a reference for these commands.

    In private text you can write:

    @MyAction{
    "Door1" Action Open ; "Light1" BlinkInterval 0.5 ; "Piston1" 10 ; Delay 10 ; "Door1" Action Open ; "Light1" BlinkInterval 1;
    }

    Then you run an argument in PB:

    Run:<MyAction>

    I think this will really push the script functionality further.
     
  20. Papi62

    Papi62 Trainee Engineer

    Messages:
    7
    1. This is the best script in the whole workshop :)
    2. Sorry for my english, it's from Google Translator and my poor English skills.
    3. Finally the question: Is it possible text on an LCD to be centered? <center> does not work.
     
  21. Dr. Fuzenstein

    Dr. Fuzenstein Trainee Engineer

    Messages:
    31
    As much as I hate to render this script obsolete, I feel that I must inform the author and all viewing this thread that it is entirely possible to set specific and precise values using the in-game interface. If you ctrl+click a slider button, a window will pop up and have you enter the precise number desired. This is a rather unknown feature in the community. I have about 1200 hours in SE, and I only learned about it a couple months ago. I don't mean to insult the author, but in my humble opinion, it is much easier to use the in-game interface than use a script to set specific values. I haven't actually tested this script for myself, so if it has more function than setting values, it is not entirely obsolete.
     
    • Disagree Disagree x 1
  22. d4rky1989

    d4rky1989 Apprentice Engineer

    Messages:
    332
    There is a reason why these kind of scripts exists: you can automatize things with just a single press of a (ingame) button.
     
  23. Riverey

    Riverey Trainee Engineer

    Messages:
    5
    Awesome script.
    Only one question - it's still impossible to change tracks in the sound block, isn't it?
    I'd absolutely love to be able to do that - this way it would be possible to add sounds to all events in the ship using just one sound block...
     
  24. SKDrake1

    SKDrake1 Trainee Engineer

    Messages:
    81
    How do I get a Rotor to Turn -20 degrees? I have tried
    "RotorFront" 20 ; "RotorRear" Velocity -10 LowerLimit -20 UpperLimit 0 ; "RotorForward" OnOff 1
    "RotorFront" 20 ; "RotorRear" -20 Velocity -10 LowerLimit -20 UpperLimit 0 ; "RotorForward" OnOff 1
    "RotorFront" 20 ; "RotorRear" -20 ; "RotorForward" OnOff 1

    None work
     
  25. Krypt

    Krypt Junior Engineer

    Messages:
    584
    How can I operate multiple blocks without groups? Wildcards is supported?
    ---
    Answer: not supported. Please, fix it :)
     
    Last edited: Feb 21, 2016
  26. Badwolff101

    Badwolff101 Trainee Engineer

    Messages:
    1
    Could you please add a "SetPublicTitle" or SetPrivateTitle" command for the LCDs? I have an Idea to use it with MMasters Configurable LCD script so I could easily change screens. Awesome script man keep up the good work!!
     
  27. Bobisback

    Bobisback Trainee Engineer

    Messages:
    6
    I fixed it for stable 1.144!!!!!! hell ya. I am not sure if I am going to re-upload his mod. Not sure what the rules are on that. (Not to mention not sure how to do that)

    In the mean time you guys can fix it manually. Go to line 522. Change that function from this:

    List<IMyTerminalBlock> GetGroupBlocks(string name)
    {
    var grou p = GetGroup(name);
    return group!=null?group.Blocks:new List<IMyTerminalBlock>();
    }

    To this:

    List<IMyTerminalBlock> GetGroupBlocks(string name)
    {
    var group = GridTerminalSystem.GetBlockGroupWithName(name);
    var groupBlocks = new List<IMyTerminalBlock>();
    if (group != null)
    {
    group.GetBlocks(groupBlocks);
    }
    return groupBlocks;
    }

    This will get his script working again. You can also delete the "GetGroup" function as it is not needed any more, but if you have no idea what I am talking about do not worry about it.

    P.S This was the post that showed me what I needed to change.
    https://forum.keenswh.com/threads/solved-fixing-my-group-renamer.7386418/
     
  28. William Eric Thomas

    William Eric Thomas Trainee Engineer

    Messages:
    7
    I have tried the fix and in the current 1.157 Stable it works once then stops. I have to exit the game completly then reload the game then reload and recompile from the workshop to get it to work once. Is there anything I can do to get this to work again as it is kind of a big part of the elevator design in the base im working on as well as for other functions?
     
  29. OmegaConstruct

    OmegaConstruct Trainee Engineer

    Messages:
    23
    Hi, any chance this script will be updated/supported for the new DEV 1.165 build?
     
  30. mojomann71

    mojomann71 Senior Engineer

    Messages:
    2,005
    The version I had posted now no longer works.
    Just removing the link I had to it in this post.

    :(
     
    Last edited: Mar 7, 2020
Thread Status:
This last post in this thread was made more than 31 days old.