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

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

Using depency injection (DI) and several files

$
0
0
So, after coming back to SE after like 4 years, I have some reqeusts for the C# scritping system (not sure if they are implemented alaready).

Allow for people to define a class in a separate file, then use Dependency injection or usings to access these classes inside the scripts.

This would reduce script sizes enormously , since people can actually have 1 file per class, and reuse defined types in other scripts without having to reupload them.

Further it could lower the execution...

Using depency injection (DI) and several files

IMyInventory GetItems working?

$
0
0
Hmm The behavior of this has changed from how it was before and how it was during the release tests and it seems to be broken.
from the ingamte script interface for "IMyInventory" the method "GetItems"
void GetItems(List<MyInventoryItem> items, Func<MyInventoryItem, bool> filter = null);

Originaly this retruned the neede dinfo.
During the release tests it was changed to return void but ot accepted a list with the out keyword so that list would be populated with the needed info rather than...

IMyInventory GetItems working?

Real slowdown when running the script

$
0
0
Hello awesome people, i'm currently trying to create a RGB light animation(by assigning random values to Color), but i'm experiencing a TERRIBLE performance issue, that when i enter the scene with the changing color light, my script is pretty simple, can anyone more experienced help me identify what i'm doing wrong that cause this severe performance degradation?
Code:
public Program()

{

	// The constructor, called only once every session and
	// always before any other method is called....
Real slowdown when running the script

WindTurbine?

$
0
0
Hello,

I would like to access to all my wynd turbines and retrieve some info from it.It seems that the API does not expose any MyWyndTurbine or IMyWyndTurbine interface at the moment.

Any tips related to this?

Thank you very much in advance!

IMyInventory.GetItems() Returning MyInventoryItem instead of IMyInventoryItem

$
0
0
I've got a few sections of code in a couple automatic drill miners, all of the code was written by a user called Pennywise, that use the GetItems method to perform different tasks. One section I've managed to convert over to the new MyInventoryItem way, but the second section, specifically where the Content method is called. According to the compilation log, the Content method is non-existent for the type MyInventoryItem, and I cannot cast an IMyInventoryItem to a MyInventoryItem.

Is there...

IMyInventory.GetItems() Returning MyInventoryItem instead of IMyInventoryItem

Help using new inter-grid communications

$
0
0
Can someone explain how the new inter-grid communication system works? The old method of using the "IMyRadioAntenna.TransmitMessage" doesn't seem to work anymore and I can't find any information about the new system. I've been searching through the forums, Malware's API index, and google for any information. The most information I've found was on Malware's API index, but that still left me confused of how to actually use it.

For reference, when I tried running a script that used the...

Help using new inter-grid communications

Programmable Block Inter-Grid Communication Guide

$
0
0
Oh yes, that's right. The single most requested feature for PB is now happening. Programmable blocks can now utilize the antenna system to send data to other grids. We said it was never gonna happen, but we have to keep you on your toes now, don't we? ;-)

While you pick your collective jaws up from the floor, let's show some love for @Malware who helped design this system, and @Jimmacle for providing so much feedback that I ended up rewriting...

Programmable Block Inter-Grid Communication Guide

Gravity aligning thrusters

$
0
0
Hello, I wanted to try and create a script that uses thrusters on rotors to rotate them to match gravity for a modular miner I was going to try and build. I was wondering if anyone here had tried a project like this and how you went about it, since I was thinking about making it where you feed the gravity vector into the rotor and have it rotate the thruster to match the angle (or the inverse of it).

I attempted to look at the Gravity Aligned Camera script to see how he was rotating the...

Gravity aligning thrusters

LCD Font Size & number of lines of text

$
0
0
Has anyone done the work and willing to share how to calculate how many text lines an lcd will show based on current font setting?

I've been scraping scripts to find how people do it but its either bad or confusing.

I just wondered if there was a bomb proof elegant method.

Execution time . What is acceptable for a script that people may use on multi play

$
0
0
I only play solo( because i mostly play with scrips ) so i don't really know what happens on multi play servers.
Im trying to keep execution times low with peaks only 10ms. Quite often 1ms or less. Also using dynamic refresh rates. And restart timer blocks so things are only done when they are needed.

What do i need to aim at with a published script. When does it stop being a usfull script and turn into a lag machine.

I expect the answer is 'it depends'

battery kW not working properly in a script

$
0
0
I'm currently writing a script for storing battery information.

This is a rundown of what I'm doing:

1. I'm taking the power information received from all my batteries via .DetailedInfo and splitting it into a matrix

for (int i = 0; i < batteryCount; i++)
{
batteryInfo = batteries.DetailedInfo;
var batteryInfoMatrix = batteryInfo.Split(' ' , '\n');

This should split up all the words into individual strings

2. After this I send the power output and the power label to a method to...


battery kW not working properly in a script

Recovering Signatures and Bookmarks from a radar

$
0
0
Hi everyone,

Since scripts are clearly considered as an "experimental" feature and basically banished from 95% of servers of the game, is it possible to expect the possibility to retrieve radar signature for extend possibilities of drone's script ? :)

Code Optimization Tips and Tricks

$
0
0
Hello all,

I'm looking for some tips on how to make scripts run as fast as possible.

What's the best place to use the GetBlock methods? Is it possible to just get the blocks the first time the program runs and keep them for all following executions or is this a bad idea?

What other things have you figured out that can improve execution time?

Thanks

How do you determine speed in a given direction?

$
0
0
I have a script and I would like to determine the speed of the ship in the forward direction of the ship only. Basically, if you where traveling 10m/s forward and you turned exactly 90 degrees I would get the speed of 0.
--- Automerge ---
After a little bit more digging I found some old code. I updated it and it works great.
Code:
		/*
		 * Returns the speed given a cockpit and a direction
		 * Example direction: Base6Directions.Direction.Forward
		 */...
How do you determine speed in a given direction?

New way to read inventory?

$
0
0
I got this error on test, in the EasyAPI code (which I had updated to handle currently live changes but that hasn't been pushed to github or the store).

There is no argument that corresponds to the required formal parameter `items` of `IMyInventory.GetItems(List<IMyInventory>, Func<MyInventoryItem, bool>`)
Adjusting to use MyInventoryItem instead of IMyInventoryItem, error:

'MyInventoryItem' does not contain a definition for 'Content' and no extension method...​

New way to read inventory?

Run the programming block when a condition is met

$
0
0
Hello,
I was wondering if there is a way to initiate the programming block if a rotor was at a specific rotation, or do I simply have to time the it takes for the rotor to be in that position and then verify the angle?

Thanks for the help!

Check for multiplayer or single player via script?

$
0
0
Is it possible to tell in any way whether a script is ran in multiplayer or singleplayer environment?

What type of data can be sent using the IGC.SendBroadcastMessage() function?

$
0
0
I want to send a bunch of different types of data in a single message but i dont want to make a string out of it.
I tried to do this:
Code:
if (Laser.Status == MyLaserAntennaStatus.Connected)
  {
  object Obj1 = new double[] { OrbitalPeriod };
  object Obj2 = HeightMap;
  object[] Data = new object[]{Obj1,Obj2};
  IGC.SendBroadcastMessage("Sattelite", Data);//Crashes here "Message type object[] is not allowed"
  HeightMap.Clear();
  Laser.Enabled = false;
  }
I also tried doing...

What type of data can be sent using the IGC.SendBroadcastMessage() function?

How do you get the GPS position of your character?

$
0
0
I've looked at the source code and tried to find working examples, but I just can't seem to get the position of my character. How do you make this code work?

public override void UpdateAfterSimulation()
{
if (!MyAPIGateway.Input.IsNewKeyReleased(MyKeys.F8))
return;

MyAPIGateway.Utilities.ShowNotification(..., 10000, MyFontEnum.White);
// I've tried 40 different things here like Sandbox.ModAPI.IMyEntity.GetPosition().ToString()
}

Thanks.
Viewing all 645 articles
Browse latest View live