Space Engineers

Space Engineers

MArmOS (Mechanical Arm Operating System) v3.1
SHADOW RELAX 18 May, 2023 @ 9:21am
Why am I getting a compilation error?
Hello, I wrote a simple code in which I simply declare the Rotor

new Rotor( Name: "ARMRotor1", Axis: "Z", OriMode: 0 );
pochle got this:

Originally posted by program block:

Exception encountered during script execution: Cannot cast object of type 'Sandbox.Game.Entities.Blocks.MyProgrammableBlock' to type 'Sandbox.ModAPI.Ingame.IMyShipController'.
in Program.UserControl.GetKeyboardInput()
in Program.UserControl.GetInputs()
in Program.Controller.Update (string argument)
in Program.Controller.UpdateControllers (string argument)
in Program.Main (string argument)
at Sandbox.Game.Entities.Blocks.MyProgrammableBlock.<>c__DisplayClass42_0.<ExecuteCode>b__0(IMyGridProgram program)
at Sandbox.Game.Entities.Blocks.MyProgrammableBlock.RunSandboxedProgramActionCore(Action`1 action, line and response)
< >
Showing 1-4 of 4 comments
K-Duke 18 May, 2023 @ 12:23pm 
Well there is no declaration. Only the creation of an object of class Rotor into the nothingness of space.
Either you're not copy pasting everything or you just gotta write
var myRotor = new Rotor( Name: "ARMRotor1", Axis: "Z", OriMode: 0 );

Also is this code wrapped into a function call?
SHADOW RELAX 18 May, 2023 @ 1:18pm 
Originally posted by K-Duke:
Well there is no declaration. Only the creation of an object of class Rotor into the nothingness of space.
Either you're not copy pasting everything or you just gotta write
var myRotor = new Rotor( Name: "ARMRotor1", Axis: "Z", OriMode: 0 );

Also is this code wrapped into a function call?
The problem was that the software block falls on the platform on which the rotor is fixed.
I moved my program block to the blocks that are on the rotor and it all worked
Doctor WHO 3 Jan, 2024 @ 11:20pm 
Originally posted by GG WP:
Originally posted by K-Duke:
Well there is no declaration. Only the creation of an object of class Rotor into the nothingness of space.
Either you're not copy pasting everything or you just gotta write
var myRotor = new Rotor( Name: "ARMRotor1", Axis: "Z", OriMode: 0 );

Also is this code wrapped into a function call?
The problem was that the software block falls on the platform on which the rotor is fixed.
I moved my program block to the blocks that are on the rotor and it all worked


so... the program block wasn't don the same grid ? or like to separate from the rotor ?
Doctor WHO 3 Jan, 2024 @ 11:29pm 
Originally posted by GG WP:
Hello, I wrote a simple code in which I simply declare the Rotor

new Rotor( Name: "ARMRotor1", Axis: "Z", OriMode: 0 );
pochle got this:

Originally posted by program block:

Exception encountered during script execution: Cannot cast object of type 'Sandbox.Game.Entities.Blocks.MyProgrammableBlock' to type 'Sandbox.ModAPI.Ingame.IMyShipController'.
in Program.UserControl.GetKeyboardInput()
in Program.UserControl.GetInputs()
in Program.Controller.Update (string argument)
in Program.Controller.UpdateControllers (string argument)
in Program.Main (string argument)
at Sandbox.Game.Entities.Blocks.MyProgrammableBlock.<>c__DisplayClass42_0.<ExecuteCode>b__0(IMyGridProgram program)
at Sandbox.Game.Entities.Blocks.MyProgrammableBlock.RunSandboxedProgramActionCore(Action`1 action, line and response)


I just got the same, today
< >
Showing 1-4 of 4 comments
Per page: 1530 50