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

Set Block Ownership To Neutral?

$
0
0
I know ages ago they removed the ability to "hack" blocks you didn't own but is it possible to assign a block you own to ownership: neutral or space pirates? You can do this via the terminal but you can do it via a script?

Generic GetValue Option?

$
0
0
I have been trying to do something like the following:

Code:
myBlock.GetValue<T>(prop.Id);
Basically I want to be use GetValue on the property of a block without first knowing if its boolean, float so on.

Is this possible in Space Engineers?

Currently I am doing:
Code:
if (prop.TypeName == "Boolean")
	 myBlock.GetValue<Boolean>(prop.Id);
}
else if(prop.TypeName == "Float")
{
	myBlock.GetValue<float>(prop.Id);
}
Etc
It would be nice to have more a more compact way of doing...

Generic GetValue Option?

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

How Does CubeGrid.GetHashCode Work?

$
0
0
I have been trying to find out a way to check a grid to see if it has been physically changed ie if a new block has been added or one has been deleted.

Currently I am simply fetching all the terminal blocks and counting them to see if they match an earlier count. This kind of works but if for instance someone deleted a door then replaced it was a beacon, it wouldn't detect a change as the totals would still be the same.

I am wonder would GetHashCode work for this or would the hash also...

How Does CubeGrid.GetHashCode Work?

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
Viewing all 645 articles
Browse latest View live