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

HUD message

$
0
0
Hello. It must be a simple question.
I need to show a message or notification from In-game script on Hud.
Something like Debug or Console text. Like quest message maybe. Or some status.
This like will be perfect.
[​IMG]
Now I use the Echo or HUD-LCD, but I think i seen something in someone's script.
--- Automerge ---
I found, how the Game shows their ( Sandbox.Graphics.GUI.MyGuiSandbox.CreateMessageBox ) but it all is...

HUD message

Convert string to dictionary

$
0
0
I'm trying to convert a string like this:
Iron:999.9,Nickel:888.8,Cobalt:777.7,Magnesium:666.6,Silicon:555.5,Silver:444.4,Gold:333.3,Platinum:222.2,Uranium:111.1
into a dictionary<string, float> using:

Code:
public List<IMyTerminalBlock> ants = new List<IMyTerminalBlock>();
public Dictionary<String, float>[] zones;

void Main()
{
	GridTerminalSystem.SearchBlocksOfName("Laser Antenna", ants);
	if (ants.Count > 0)
	{
		for (int i = ants.Count - 1; i >= 0; i--)
 		{
			  zones[i] =...
Convert string to dictionary<string, float>

Is there a way to disable Stop Countdown I a script

$
0
0
I am wanting to write a script where a self destruct can be averted untill x amount of tine has passed then you can't disable the self destruct anymore.. but I can't figure out how to stop someone from just disabling the war head with the stop countdown button

Howto for using VS Code

$
0
0
Hello Everyone,

Spent a day working out how to set up Visual Studio Code (aka 'VS Code' or 'VSC') as a development environment for Space Engineers. I finally got it working with code completion (intelisense) and syntax checking. Here's the instructions, which are also present in the repo which contains the required directory skeleton for the coding environment. For the most part, folks should stick with using 'Visual Studio', but if you want a lighter weight environment like VSC for...

Howto for using VS Code

Retrieve Name of BP Loaded Into A Projector?

$
0
0
Is there a way to retrieve the name of the blueprint that is currently active in the projector?

How do I divide with MyFixedPoint

$
0
0
I'm trying to divide one MyFixedPoint number by another (I want the ratio of current cargo volume to total cargo volume) and I just realized the struct is missing DivideSafe. Is there any way to divide and still keep them in the MyFixedPoint format, or do I have to bite the bullet and extract the values to doubles?

This is for a programmable block script, if that wasn't clear.

Thanks.

-BC

Block Count

$
0
0
I am wondering is there a way to retrieve some of the numbers stored in the "Info" tab of a grid such as totals for functional blocks/armor blocks and the like? I was having a look in Me.CubeGrid but couldn't see anything.

MDK: Malware's DevKit for Space Engineers

$
0
0
https://github.com/malware-dev/MDK-SE

MDK-SE
(Malware's Development Kit for SE)

A toolkit to help with ingame script (programmable block) development for Keen Software House's space sandbox Space Engineers. It helps you create a ready-to-code project for writing ingame scripts, and provides an analyzer which warns you if you're trying to use something that is not allowed in Space Engineers.

General features
  • Helps you create...

MDK: Malware's DevKit for Space Engineers

IsSurvival ?

$
0
0
It's possible to get game mode?
May be indirectly from some values.

I found MyObjectBuilder_SessionSettings, :( prohibited.

iMyCockpit isUnderControl. Who is it??

$
0
0
New sad question. I always get "this is impossible."

What did I do wrong?

$
0
0
I've got a pair of timers loaded with other stuff that I'm triggering when doors are opened or closed.

Code:
bool closed = false;
bool open = false;
void Main()
  {
  Runtime.UpdateFrequency = UpdateFrequency.Update1;
  var door = GridTerminalSystem.GetBlockWithName("Airtight Hangar Door") as IMyAirtightHangarDoor;
  var lightsOn = GridTerminalSystem.GetBlockWithName("HangarOpen Timer") as IMyTimerBlock;
  var lightsOff = GridTerminalSystem.GetBlockWithName("HangarClose Timer") as...
What did I do wrong?

Get current angle of rotor

$
0
0
Hello Coders!

Getting the current angle of a rotors is something that has been somewhat of a problem for me. Because of this i set out to create a simple piece of code that could get said angle.

Below you will find some code that gets the current angle of the rotor.

Code:
void Main() 
{ 
var rotorStator = GridTerminalSystem.GetBlockWithName("Rotor") as IMyMotorStator;  

string info = rotorStator.DetailedInfo;

string CAngString = System.Text.RegularExpressions.Regex.Replace(info,...
Get current angle of rotor

Quick Introduction to Space Engineers Ingame Scripts

Get the inventory item type restriction

$
0
0
Hey,
I couldn't find the info on the forum or online.

I am trying to find a way (non hardcoded) to find the inventory item / item type restriction of the block.

So I don't have to hard code all possible ammo of every possible turret in the game!

It would make life easier also for the refineries/arc furnace, O2H2 Gen etc....

Do you guys have any pointers?

C# Container subtypename is prohibited

$
0
0
Hello,
I would like to ask a error: subtypename is prohibited

My code is:

if (argument == "kontener1")
{
szoveges2.WritePublicText("", false);
szoveges2.WritePublicText("\nKonténer1:", true);
IMyInventory kontainer1inventory = kontener1.GetInventory(0);
kontainer1ItemsList = kontainer1inventory.GetItems();
var kontener1tomeg = kontener1.GetInventory(0).CurrentMass;
foreach (IMyInventoryItem elem in kontainer1ItemsList)
{
szoveges2.WritePublicText("\n" +...

C# Container subtypename is prohibited

IMyShipController RotationIndicator any ideas?

$
0
0
Hello.
I wonder how ship controller RotationIndicator forms.

The main problem is how to get the 0.0-1.0 (min-max) rotation signal the most perfomance friendly way.

For my mouse RotationIndicator.X (or Y) minimum is always above 0.56 .
So using it as Gyroscopes direct input is very inaccurate at low signal even on UpdateFrequency.Update1

For me it looks like RotationIndicator forms out of some world vector and it's direction is corrected by mouse input.
So is RotationIndicator a mouse...

IMyShipController RotationIndicator any ideas?

Error thrown when querying door statuses

$
0
0
I'm trying to read the state of a door (open, closed, opening, closing).

When I run the following code....
Code:
public void Main()

{
	var door = GridTerminalSystem.GetBlockGroupWithName("Airtight Hanger Door 1") as IMyDoor;
	if(door.Status == DoorStatus.Open)
	{
		Echo("Door is open");
	}
} 
... I get an error :

Code:
Caught exception during execution of script: Object reference not set to an instance of an object.
at Program.Main()
at...
Error thrown when querying door statuses

String CenterAlign

$
0
0
I wonder how this code affects perfomance on servers used to build up to 50 string lines per tick every 10-th tick
Code:
#region String Extensions
		static string CenterAlign(string source, int space)//centers string space wide
		{
			if (source == "" || space <= 0) return "";//input empty or no space? return empty		 
			else
			{
				int length = source.Length; //source length
				if (space == length) return source;//return source if its length == space
				else if (space > length) return...
String CenterAlign

Getting GasLevel from IMyInventoryItem.

$
0
0
I would like to get GasLevel value from hydrogen bottle. I already found my bottle in a container, so I have a reference to IMyInventoryItem. IMyInventoryItem have a Content property which in this case is an instance of MyObjectBuilder_GasContainerObject. MyObjectBuilder_GasContainerObject have a GasLevel variable that I would like to read, but the type MyObjectBuilder_GasContainerObject isn't allowed in ingame scripts.
Which extensions or interfaces can I use instead?

IMyProjector and Programming? Is it possible?

$
0
0
I have a small problem trying to alter the offset and rotation of a projection from a projector. Here's my code. Any help to get it working would be greatly apprecieted.

Code:
public void Main(string argument, UpdateType updateSource)

{

	var defaultLargeVertex = new List<int>{2,0,-1,0,0,0};

	// Horizontal Offset, Vertical Offset, Forward Offset,  Pitch, Yaw, Roll

	var defaultSmallVertex = new List<int>{0, -28, -3, 90, 0, 180};

	// Horizontal Offset, Vertical Offset, Forward Offset,...
IMyProjector and Programming? Is it possible?
Viewing all 903 articles
Browse latest View live