Quantcast
Channel: Programming (In-game)
Viewing all 903 articles
Browse latest View live

[Solved] Rare exception when compiling code.

$
0
0
Whenever i try to make this:
Code:
List<IMyTerminalBlock> ListName = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlockGroupWithName("Group of blocks to get").GetBlocks(ListName);
That gets all the items in a certain group and puts them into a list. I get an execution exception that displays the following: Object reference not set to an instance of an object.

I know this error is common in C# when you put:
Code:
List<var> ListName;
instead of
Code:
List<var>...
[Solved] Rare exception when compiling code.

[Solved] IMyInventory.CanItemsBeAdded usage

$
0
0
Some time have passed since last question about it so I wonder if today exists any possibility to use a method IMyInventory.CanItemsBeAdded and how to do that. This metod requires an argument of type "VRage.ObjectBuilders.SerializableDefinitionId" which can be build from a string and another argument of type "VRage.ObjectBuilders.MyObjectBuilderType".
It seems that a type SerializableDefinitionId is permitted in ingame scripts, but MyObjectBuilderType is not. Is there any way to obtain...

[Solved] IMyInventory.CanItemsBeAdded usage

Costum sound in scripts

$
0
0
Hello, I have a game script,where I want to add costum sounds can anyone help me?


//red alert
alertArgs[1] = "red";
alertNames[1] = "Red alert";
lightColor[1] = new Color(255, 50, 50);
blinkInterval[1] = 2f;
blinkLength[1] = 50f;
closeBlastDoors[1] = 1;
soundName[1] = "SoundBlockAlert2";

I dont know how to

File: SpaceEngineers/Mods/StarTreksounds/Audio/TNG - Red Alert 1.xwm

I Need a little Debug Help

$
0
0
My code is below this Line, the Error I get is in the instance I'm not able to call the MyGrid Program terminal block stuff.. any advice or knowledge would be great... thanks. also most of the code shown here is not needed to trouble shoot but I wanted to give you the whole program so you can see if its a cascading problem that I just missed..


Code:
//This is the Mark VIII version of this script the focus of this revision is on the HMI and Stability.

public int FZI(string ZN)//Find Zone...
I Need a little Debug Help

Programmable Block script help

$
0
0
hi i had an idea but i dont know how to go about implementing it

my idea is to create a script that updates other programmable blocks through block name

Check altitude

$
0
0
Hi,

I try to make a drone who get in space and then come back to land.

I usually use "Visual Script Builder" to make my scripts and it's work fine.
But I want something that isn't possible with this site.

To go down on the planet I shutdown all the engine from my drone.
This to not use too much fuel, and because of the speed bug in gravity.

I need something like "If altitude < 1500m do start all engine".

I have find this script :...

Check altitude

Gravity Acceleration formula help.

$
0
0
Hello community.

Iam trying to write a script for, lets say, sub-orbital aproach with less fuel consumption possible. The goal is to have a shuttle/pendling cargo ship from ground of the planet to an orbital station bounded to the asteroid, but still inside gravitational field of the planet. Idea is to use natural gravity to slow down aproach naturaly and have at the target altitude as less velocity, as possible. Iam incorporating orbital launch script to have ship speed-up and climbing...

Gravity Acceleration formula help.

New Camera Raycast and Sensor API (Update 01.162 DEV)

$
0
0
by Rexxar:
--------------------------------------------------------------------

This week brings several big changes to the programmable block API. The major features are:
  • IMyRemoteControl.GetFreeDestination has been removed
  • IMySensorBlock.LastDetectedEntity no longer returns an IMyEntity reference, instead returns MyDetectedEntityInfo
  • IMyCameraBlock has new raycast functions to replace GetFreeDestination
  • New MyDetectedEntityInfo struct to contain information...

New Camera Raycast and Sensor API (Update 01.162 DEV)

CybillAI Update Thread

$
0
0
Because Steam only allows so many characters in the description and it can be tough to find
update posts in the comments section I am going to keep the updates to the script here in
this post.

Update 1:



It has been a few weeks since I made CybillAI available on my workshop, I see that quite a few
people have already subscribed. Today's update adds important optimization to Cybill's power
management and turret control code.

*Battery blocks are now...

CybillAI Update Thread

Would this work - working to reduce char count in a Visual Script Builder code

$
0
0
I put together a script to run a hangar airlock system on with the script builder at Visual Script Builder.(so much faster than typing it out myself. I repair syntax and smooth out logic after the fact in Notepad++.)
I am using four different blocks and the tool assembles a "function" for each separate one, so I'm looking to cut down the size by making an actual function that works for all four.
Here are my block declarations.
IMyDoor doorIn =...

Would this work - working to reduce char count in a Visual Script Builder code

Block scripts requests thread

$
0
0
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,...

Block scripts requests thread

Camera overlay in the View mode

$
0
0
In the View mode, in the upper left corner of the screen there is a "label" with CustomName of camera. Unfortunately, changes of the CustomName will be not affected until reactivating the View mode. Somehow it's possible to get the updateable HUD or overlay on camera in View mode?

Programmable Block script help 1001

$
0
0
Hello.

can somebody help little moor that usually.
So little information.

I tray make 1 carrier, that carry 4-6 ship.
Carrier main goal is to be only use jump drive to space location, deploy ships and jump to hide.
its deploy 1 ship that is main ship and 4 drones (1 ship is optional backup if first main ship be wrecked)

all ships have some prorogrammed block.
(steam workshop)
Formations Script
Launch Control Script
Whip's Turret AI Slaving Script

i tray make one more prorogram, whit...

Programmable Block script help 1001

Request for access to wheel propulsion override (Steering angle as a bonus)

$
0
0
To whom it may concern,

Request:
I am hoping that we can get access to wheel propulsion through in-game scripting, like we have access to the "Override" property on a Thruster.

Considerations:
I am aware that wheels function differently than thrusters and this would be fine. My expectations given current behavior is that we would get access to toggle (positive or negative) propulsion override as though a user was pressing the W or S keys (respectively).

For simplicity we can assume...

Request for access to wheel propulsion override (Steering angle as a bonus)

Automated assemblers keep inventory level

$
0
0
Hey all,

I just finished building an automated assembler setup that I'm pretty happy with. Basically, it's a system that lets you specify how much of a given item you want to have in inventory, and which assemblers product that item, and the system will enable and disable assemblers as necessary to keep the inventory full.

[​IMG]

To set it up, you need:
One programmable block.
One timer block.
One LCD screen.
At least one assembler per type of item you...

Automated assemblers keep inventory level

PB Scripting Guide: How To Use Self-Updating

$
0
0
Greetings engineers! As you all have (hopefully) read in last week's update post, the PB now has some fancy new self-updating features which means you no longer need timer blocks!

This self-update system is relatively straightforward, but does require a bit of explanation, so let's get into it!


Update Frequency:
The self-update system is controlled through the Runtime.UpdateFrequency property. Those of you who are familiar with GameLogic components should recognize...

PB Scripting Guide: How To Use Self-Updating

Broken Rotor script...

$
0
0
Hi everyone,

I've managed to write this script below which works.... once. the idea is when a button is pressed the rotor moves in that direction by 1 degree from its last position.

Currently the first time you run the block it will set the min and max limits like it should and changes the velocity to positive. For some reason though, the second, third, fourth time the block is run, nothing changes. I'm stumped any help would be greatly appreciated...

Code:
public Program()

{


}...
Broken Rotor script...

Request for smaller scripting improvements

$
0
0
Ok, here's my request for a few things that I stumbled upon while trying stuff with the ingame API :)
First there are missing whitelist entries for ingame scripting:

Sandbox.Game.EntityComponents.MyResourceSourceComponent.HasCapacityRemainingByType(MyDefinitionId)
Sandbox.Game.EntityComponents.MyResourceSourceComponent.RemainingCapacityByType(MyDefinitionId)
All other ByType-Methods are already accessible, these ones only via the Properties (bool HasCapacityRemaining and float...

Request for smaller scripting improvements

How to find values/properties of a block

$
0
0
To start off, yes I know how to find the basic terminal properties (I think thats what they're called) that look like this:

Laser Antenna
Implements
  • IMyLaserAntenna
  • IMyFunctionalBlock
Properties
  • OnOff: Boolean
  • ShowInTerminal: Boolean
  • ShowInToolbarConfig: Boolean
  • ShowOnHUD: Boolean
  • isPerm: Boolean
Actions
  • OnOff (Toggle block On/Off)
  • OnOff_On...

How to find values/properties of a block

Find Weld/Grind Speed with in-game script?

$
0
0
Can a script look up tool speed?
I really would love it if my auto welders had an idea of how fast they are able to finish a job so they don't skimp on the armour blocks which they cant check the integrity of because armour isn't a terminal block >.<
Right now the only way to be sure is to track steel plates going through which involves regulating how many get into the welder, which basically requires two sorting blocks and a container in an airlock system and even then you cant be sure the...

Find Weld/Grind Speed with in-game script?
Viewing all 903 articles
Browse latest View live