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

Timer block 1-in, 81-out operations- coding a neural network?

$
0
0
I was defending the honor of a timer block in another thread, noting how 81 operations per second didnt seem that bad after all.. and it got me thinking.

... is it possible, to someone with the know how, to build a neural net with nothing but timer blocks?

Each block has a single input with 5 different actions: Start countdown, Stop existing countdown, Trigger now, Power off (suspend countdown), Power on (Resume countdown)

When triggered, each block has 81 actions it can output (9 actions...

Timer block 1-in, 81-out operations- coding a neural network?

Inter-Grid Communication Only Works on the Same Grid

$
0
0
Hi all,

Recently got into scripting for SE and I've been trying to get igc working between two different grids with antennas but I've been unsuccessful. I've been using the example scripts provided by the mdk github page as well as my own which work just fine if both PBs are on the same ship but do not work when communicating between two separate ships.

The example script: https://github.com/malware-dev/MDK-SE/wiki/IGC-Example-2-Toggle-Lights

I've triple checked that...

Inter-Grid Communication Only Works on the Same Grid

How do I know whether a light bulb is turned On or Off?

$
0
0
How do I know whether a light bulb is turned On or Off? Example LCD: [Lamp] - Off.
-------------------------------------------------- ------------------------
code:
IMyTextPanel LCD = GridTerminalSystem.GetBlockWithName ("LCDTest") as IMyTextPanel;
IMyInteriorLight Lamp = GridTerminalSystem.GetBlockWithName ("LampTest") as IMyInteriorLight;
if (Lamp.OnOff_Off == OnOff_Off) {// How?
LCD.WritePublicText ("", false);
LCD.WritePublicText («[Lamp] - OFF», true);
}
еlse {...

How do I know whether a light bulb is turned On or Off?

System.Text.RegularExpressions performance in scripts

$
0
0
I profiled my freezing script and found that ~400 Regex.IsMatch executions on compiled regexp last 0.2 seconds!
On my local machine in pure C# the exact same regexps(even heavier) executing 200(!) times faster!

I changed regex to String.IndexOf and now script working fast.

But, why regex'es so slow in ingame scripts?

Regex example:
DisplayRegex":{"Pattern":"(this will never mathch everything|Components|Ore)","Options":9}

Script freezes game

$
0
0
Are ingame scripts running in main thread?
I made a sorter for my storage. Every time it works, game freezes on ~0.5 second =(
It freezes even i transfer one stack.

Can you list the raw materials required to build a MyProductionItem?

$
0
0
I'm hoping there is a way accessible through the API to get this. For example, making a steel plate requires 7 iron. I've started to hardcode each item, which isn't too bad since there's only 26, but if anything changed during a future update I'd have to also update my script, also there's the fact that (while sort of rare) some mods add new components to the game, which I have no knowledge of, so I'm also losing mod support.

Here's the script I'm working on, you can see in the bottom...

Can you list the raw materials required to build a MyProductionItem?

Some warning before script too complex

$
0
0
May I know in script about how i close to "Script is too complex" error? My script may vary count of iterations it does. So, maybe there is a way to know about reaching limit without stopping PB?

Jukebox block

$
0
0
Hello.
A new Jukebox has a playlist. It's possible to manage it?

[​IMG]

Help with controlling groups

$
0
0
So I'm wanting to write up a script that sums up all thrust directions. compares the available newton force with current ship weight. Then uses the delta-v formula and determines if the ship had enough fuel for a one-way trip or 2-way trip. Gonna try to implement some sort of auto-pilot feature so a ship doesn't ram full speed into a station.
I've never used the List command while programming so it was no surprise when it was giving me errors. If anyone can give me pointers with groups it...

Help with controlling groups

Question about continuous looping in PB

$
0
0
so I've just gotten into playing with the PB in game and was wondering how to make a script continuously loop
basically I'm trying to make it so refineries cant be turned off and if they are, to then instantly turn the back on.
I'm using a timer block as a check to link multiple refineries. any help would be appreciated

Code:
public Program()
		{
			Runtime.UpdateFrequency = UpdateFrequency.Update100;
		}
public void Main(string argument, UpdateType updateType)
		{
			var Checkblock =...
Question about continuous looping in PB

Object reference not set to an instance of an object

$
0
0
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using VRageMath;
using VRage.Game;
using Sandbox.ModAPI.Interfaces;
using Sandbox.ModAPI.Ingame;
using Sandbox.Game.EntityComponents;
using VRage.Game.Components;
using VRage.Collections;
using VRage.Game.ObjectBuilders.Definitions;
using VRage.Game.ModAPI.Ingame;
using SpaceEngineers.Game.ModAPI.Ingame;
using Sandbox.Game.Replication;

public sealed class Program2 : MyGridProgram
{
//

//...

Object reference not set to an instance of an object

Programmable Block Inter-Grid Communication Guide

Detecting where a program run was called from.

$
0
0
Is it possible to know where a programmable block was called from in the script?

So in this case I have a sensor named "assignment A" and it calls the pb with the argument "OpenDoor" a generic call for all sensors with the same function on the grid.

I then want to search for a door with name contains "assignment A" taken in this case from the name of the sensor that sent the run command.


So in this case I only need to setup the names of sensors and doors to match without having to...

Detecting where a program run was called from.

What this interface of the Hinge blocks for programming (In game)?

$
0
0
What this interface/type of the Hinge blocks in the sparks of the future dlc for programming (In game)?

Example:

IMyBlockGroup group = GridTerminalSystem.GetBlockGroupWithName("A Group");
List<IMyHingeBlocks> hinge = new List<IMyHingeBlocks>();
// Fetch the blocks from that group. Note that the type designation is implicit
// here, it's defined by the list above - this is why you don't need to specify
// the type in <>.
group.GetBlocksOfType(hinge);

Is...

What this interface of the Hinge blocks for programming (In game)?

Analysing conveyer system for hydrogen/oxygen

$
0
0
Hi,

I need help finding the right way to analyse the conveyer system of a grid with a script.
For the most block types this is not problem. You can select the inventory of the block an check with "IsConnectedTo" or "CanTransferItemTo" if the block has a conveyer connection to another on.

But how to check if a hydrogen tank has a connection to a hydrogen engine or a thruster for example?
Those blocks can't store any items, so "CanTransferItemTo" doesn't work. All blocks implement the...

Analysing conveyer system for hydrogen/oxygen

Help my script :)

$
0
0
Hi, I’m just learning to program in the game, and I have not encountered such a level. The creak shows the fullness of the container on the screen. Containers should be named BOX_0, BOX_1, etc. The script works and I get the information on the screen, but I don’t know if I am doing it right. :)

For example, here I led to a fractional number, because division cannot be applied to FixedPoint.

Code:
(float)INV.CurrentVolume 
Code:
public void Main(string argument, UpdateType...
Help my script :)

Ignore max script length

$
0
0
Is there a way to remove or ignore the max size of scripts? It would be very helpful, for debugging and testing.

Check If Welder Is Welding?

$
0
0
I am wondering is there a way to check if a welder is currently welding? I have tried IsWorking but that always come back true even if it is idle.

Change A Block's Paint Color Via Code?

$
0
0
I'm fairly sure you can but is it possible to change the color/paint scheme of a block via the programming block?

It would be a nice feature in any case.

Sci-Fi Four Button Panel LCD

$
0
0
Hi.
I've searched for nearly an hour trying to find how to write text to the LCD panel on a button on the Sci-Fi Four Button Panel. I can't find how to do it in a script. The LCD panels are great for displaying what the buttons do but I want to provide some feedback on the action to the LCD screen. I've checked out the MDK API listings and echo'd all of the actions I can find but can't get any further with IMyButtonPanel.

If anyone can point me in the right direction I would be grateful.
Viewing all 903 articles
Browse latest View live