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

IMyProjector RemainingBlocksPerType missing Armor Blocks from Dictionary

$
0
0
I do not know if this is the correct thread so please move it if not.

Hey guys hoping someone that drives PB updates can help. It seems from testing tonight that IMyProjector.RemainingBlocksPerType Dictionary returns all non armor blocks. oddly there is no other way than using Remaining ArmorBlocks guessing how much steel is needed as most variants require different amounts.

Thanks,

Script to get armour block positions

$
0
0
I am writing a script to plot the position of all blocks on a grid onto a monospaced display panel. I have a very basic setup which gets the positions of all blocks that appear on the terminal, but would like to also get the positions of armour blocks.

Does anyone know how to do this?

Code:
 
public void Main(string argument) 
{ 
    string report = "";  //Create string to dump text into 
 
    //Get Block and position 
    var blocks = new List<IMyTerminalBlock>();  //Create empty list...
Script to get armour block positions

Get/Set ship name from PB

$
0
0
Is there a way to do this? Changing the name of the antenna would be the next best thing, but I'm looking to access values in the terminal "info" tab.

Problems with IMyTextPanel

$
0
0
Hello there.

I think there is something wrong, Visual Studio dont know about the CustomData proberty of a IMyTextPanel.

Ingame the code compiles with no errors

Getting a warning in script

$
0
0
Hi there, can someone tell me why am I getting a Warning after compiling this script? And does anyone know if it breaks something within the code?

Warning: 'IMyShipConnector.IsConnected' is obsolete: 'Use the Status property'

Code:
public void Save()
{
}

public void Main()
{
/*======================================| VARIABLES |=====================================*/

//THRUSTERS
    var thrusters = GridTerminalSystem.GetBlockGroupWithName("PF_W_S1 - Thrusters"); 
    List<IMyThrust>...
Getting a warning in script

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

Help me understand PhysicalMass

$
0
0
I'm trying to figure out PhysicalMass.

I have a ship and realistic inventory size.
This is the data I get.
Code:
		Empty cargo	2Mkg in cargo	Increase
Ship 		2.52Mkg		4.52Mkg		79%
TotalMass 	2.52Mkg		4.52Mkg		79%
BaseMass 	2.52Mkg		2.52Mkg		-
PhysicalMass 	10.06Mkg	18.06Mkg	79%
Now with x3 inventory size:

Code:
		Empty cargo	2Mkg in cargo	Increase
Ship 		2.52Mkg		4.52Mkg		79%
TotalMass 	2.52Mkg		4.52Mkg		79%
BaseMass 	2.52Mkg		2.52Mkg		-
PhysicalMass 	10.06Mkg	12.73Mkg...
Help me understand PhysicalMass

Is there any way using only 2 programable blocks to make a timer like block?

$
0
0
I am trying to work around the bug where a projected/built timer block does not remember its actions (like a call to a programmable block, and then to itself to create a loop). In the past I would use a timer block and programmable block to perform multiple timed events (in this case for a missile assembly). With the timer block broken as I have described, I am at a loss to get another solution working. I have tried using programmable blocks calling each other, this fails when the...

Is there any way using only 2 programable blocks to make a timer like block?

Easy copying of relevant code from Visual studio

$
0
0
Hi, when making in-game scripts in VS you have to select and copy a portion of your file every time you want to test it in game. I found this tedious so I wrote a simple script that copies a predefined section at the touch of a keyboard command. It also trims white-space, as it can eat up a considerable portion of the character limit.


Easy copying of relevant code from Visual studio

Best way to investigate low sim speed?

$
0
0
Is there a sort of task manager tool in the game world that would help me isolate the source of low sim speed?

I know the "Echo" function is usually to blame for memory leaks, and I still have a few grids with it in their code, but none of them are running and I can't seem to find the source of the problem.

EDIT:
The irony is that all this happened because I was trying to consolidate all my debugging strings into one central location by transmitting a string with log data to a designated...

Best way to investigate low sim speed?

Oxygen Generator Detailed Info (Missing Required Input)

$
0
0
I'm working on a script where I grab every block's power needs. I've noticed that things like Assemblers and Refineries have a "Required Input" property in their Detailed Info. This apparently shows how much power that block needs (usually 1kW if idling, much more if working).

This page () states that the Oxy Generator just needs 1kW while not doing anything, and 330kW when working. However, its Detailed Info only shows the block's Max Required Input (330kw).

Does this sound like a...

Oxygen Generator Detailed Info (Missing Required Input)

Where can I find up to date reference for PB scripting ?

$
0
0
Hello

Because it is a real pain to try to find correct information lost in tons of outdated data :(

Thank you for your help.
And if someone can add accurate link in sticky that would be helpfull.

I found this source in a recent post and use as reference but I got a warning for obsolete function
https://github.com/KeenSoftwareHous...dbox.Common/ModAPI/Ingame/IMyTerminalBlock.cs

Using IMyTerminalBlock.GetInventoryCount()
It says to use...

Where can I find up to date reference for PB scripting ?

Behaviour of saved blocks (error handling)

$
0
0
Already tried a bit, but there was no null reference exception or what I would expect. Maybe someone else knows more what happens with saved blocks (global / member variable), when they change (e.g. deleted, damaged etc.) ingame.

In my case, a rotor is handled by the script, but even if I delete it, the script runs on. Also, access its properties. So is the underlying object forever in memory or did I just not wait enough?

How are you guys viewing documentation.chw?

$
0
0
Can't open it. All the tools I've tried can't open it. Is there any up to date documentation (preferably in the MDSN format) that I can view? I'm running Windows 10 which I believe Microsoft removed support for viewing help files in.

I'd really like some documentation outside of that which I get from using an IDE.

Cross grid guided torpedo/missile script?

$
0
0
Has anyone created any cross grid torpedo/missile scripts yet? I've seen in one of the updates wherein PB's can now access remote grids. It makes me wonder if people have started making guided torpedo scripts which use that function.

Having a programming block in every torpedo would probably kill the sim speed so maybe having a single PB that manages a missile swarm would be nice.

Leveling Script

$
0
0
My English is not that good :D Because I have never written a script I would be happy if you write me one :) I need a script where the block x from the g-menu is and sobalt the player say we pay 100 credits the block to build again in the g Menu appears

initialization vs. destroyed blocks

$
0
0
How does your script handle one or more of the blocks of script interest getting destroyed?
Do you get the blocks only at initialization, to save memory?
Are you ok with the script likely erroring out when one of these blocks is destroyed?
How do you handle one of the blocks of interest being destroyed on purpose and rebuilt (relocation for example)?

Setting Destination of Remote Block

$
0
0
Alright so based on the missing API thread I think this is a no-go, but it mentions some of the issues may have work arounds so I thought it worth asking anyways.

I've got a way to get a GPS coordinate that I want a child ship to go to relative to a mother ship - is there any current work around or reliable way to get the child ship to go there? I'd been hoping to use the remote block but it doesn't looks like thats feasible.

Need Help. HangarScript doesn't work

$
0
0
Hey guys,

i found a good script in the www for the airlock hangardoor. But it is a bit older and the api changed. May someone look for it please?

Code:
bool g_initialize = true;
IMyTimerBlock g_timer = null;
IMyAirVent g_airVent = null;
List<IMyTerminalBlock> g_doorOutside = null;
List<IMyTerminalBlock> g_doorInside = null;
List<Func<int>> g_queuedActions = new List<Func<int>>();
 
void Main()
{
    if(g_initialize) {
        var groups = GridTerminalSystem.BlockGroups;
        for(int i =...
Need Help. HangarScript doesn't work

Modify performance monitor data display

$
0
0
In the SHIFT+F11 menu, pushing F11 multiple times will show different pages of data. Can I customize one of these pages to include select information? I'm looking to keep only sim speed and FPS data in the top corner without all the other information cluttering up the screen.
Viewing all 903 articles
Browse latest View live