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

Block Naming Conventions?

$
0
0
After experimenting and realizing a script I've written fails to account for having more than one copy of the mechanism it handles on the same grid, I am starting to look into useful naming conventions to bypass that. This seems to be a problem fundamental enough that you would need a useful reusable solution and a standard set of methods to handle it.

I imagine that it's a rather common one too, and that I am far from the first in-game programmer to encounter it. What useful naming...

Block Naming Conventions?

Get name of the Entity which the turret is actively targeting?

$
0
0
Does the turret have a list of targets or at least access to the name of the currently targeted ship/station or part of that ship it's attacking?
--- Automerge ---
or is there a bool to know when the turret has a valid target?

Timer and / or programmable block connector auto connect problem

$
0
0
Hi, i don't know if its me or if it is a known problem, but here is what im facing of:

i have a programmable block in a station with a timer, this timer serves as usually, meaning just let the programmable block to run, with a trigger at every 1 seconds. I have a small ship with a programmable block and a timer on it too, this timer just serve as a trigger too, like the one on my station.

i'm trying to make an auto connect for my ship, meaning that i just push a button on the small ship...

Timer and / or programmable block connector auto connect problem

Sound Block Set Sound?

$
0
0
Is there anyway to set and play a sound on 1 Sound Block on demand?
So you can play all the difrent sound the block has using only 1 block?

Thanks for any answers.

Cheers!

Check If Gun Has Reloaded?

$
0
0
Hi how can I using the program block check if a weapon has reloaded through code?

Furthermore is there a way to see if it has no ammo?

INI data processing style

$
0
0
As part of my OS script I already have the needed classes to emulate files in the Storage variable of a PB.
I've reached to the conclusion that some parts of the data I want to store should be in a form that remind INI files, for easier retrieval later on.
That form is a section held in the [] brackets followed by key/value pairs.
Its easy enough to break and build key/value pair strings, but my problem now is how to build the string with the section and how to break it for processing.
An...

INI data processing style

Problem with script, need help :/

$
0
0
Hello people, I have a small problem that I cannot solve, if you have the time to help me I would greatly appreciate it!

Right, first off, I'm not an experienced scripter. I mostly edit scripts made by others or create very simple ones for myself (read; 5 lines :p).
So I would like some help with a script that i am copying off someone else (I have permission) I had to copy it off his YT video letter by letter, so there might be some errors, though I tried correcting most of em.

This still...

Problem with script, need help :/

Script Problem : Input string was not in the correct format

$
0
0
Hello all !

First, I'm sorry for my english, i'm not really good with Shakespeare language, but i try to do my best.
I Have a Script problem in my code, and i don't understand how i can resolve it. I post my code for u can help me maybe :s

Code:
public void Main() {
    string rXAngle = "";
    string rYAngle = "";
    string pCurrentPower = "";

    IMyMotorStator rotorX = GridTerminalSystem.GetBlockWithName("RotorX") as IMyMotorStator;
    IMyMotorStator rotorY =...
Script Problem : Input string was not in the correct format

How do you display multiple lines on LCD from Groupslist?

$
0
0
i have made a simple script to display Blockgroups. only now i see the last name at the firstline
--- Automerge ---
public Program(){ }
//Define area Variants and Statics
//int ALSGROUPcount = 0;
const string SystemName = "ALS";
static float FONT_SIZE = 1.5F;
string nl = "\r\n";

public void Main(){
List <IMyBlockGroup> ALLgr = new List<IMyBlockGroup>();//Declare ALL Groups
GridTerminalSystem.GetBlockGroups(ALLgr);//Get ALL Groups
foreach...

How do you display multiple lines on LCD from Groupslist?

[Solved!] Problem with script, need help :/

$
0
0
Hello people, I have a small problem that I cannot solve, if you have the time to help me I would greatly appreciate it!

Right, first off, I'm not an experienced scripter. I mostly edit scripts made by others or create very simple ones for myself (read; 5 lines :p).
So I would like some help with a script that i am copying off someone else (I have permission) I had to copy it off his YT video letter by letter, so there might be some errors, though I tried correcting most of em.

This still...

[Solved!] Problem with script, need help :/

Get ship velocity

$
0
0
I do know this has been asked so many times but I've been away from this game for a long time, so what I would like to know is. Do you still need to use block.GetPosition() then store as double and a few ticks later repeat and subtract old/new positon from old one to get ship velocity, or do they now have a nice clean method to access this directly... I'm not holding my breath, I do seriously doubt that even after all this time it still isn't a feature of ingame programming.

InterGrid...

Get ship velocity

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

How to find the block an TextPanel/LCD is attached to?

$
0
0
I've made a script to display the the capacity of inventories.

It looks around an lcd panel to find a block with an inventory (cargos, refinreies etc.).
What I want to do is to look at the block the LCD is mounted to first. But I have no how to transform "behind this block" into grid coordinates.

Can anyone help me with this?

[Solved] How to find the block an TextPanel/LCD is attached to?

$
0
0
I've made a script to display the the capacity of inventories.

It looks around an lcd panel to find a block with an inventory (cargos, refinreies etc.).
What I want to do is to look at the block the LCD is mounted to first. But I have no how to transform "behind this block" into grid coordinates.

Can anyone help me with this?

Is there any sort of documentation on IMyShipConnector.Status?

$
0
0
I can't find any and the source code on github is horribly outdated.

There is some script that uses IMyShipConnector.IsConnected and IsLocked and I wanted to get rid of the obsolete stuff but can't find any real info except that there's now a Status property that does all that combined (which sounds wonderful).

Maybe i'm doing it wrong and shouldn't use notepad++ to code...

Finding a block relative to another block.

$
0
0
I'm a little stumped at where to begin. This will be part of a larger script but I'm trying to gain the basic understanding of how it's done.

When constructing a ship via projection, it's projected as a part of an existing grid. The orientation of this existing grid is subjective. When the ship is cut away from the host, it becomes a new entity and that grid is also subject to change orientation.

So my thought is to use a centralized block like a flight seat as a demarcation point....

Finding a block relative to another block.

Turning a ship to face a gun target.

How to check if wheel is touching a surface while under gravity?

$
0
0
How to check if wheel is touching a surface while under gravity? so i can figure out if its useful to use the handbreak.

Getting a v3 from an angle.

$
0
0
Ok, a better explanation.

I'm vector stupid.

Below is a picture of what I have. the v3.Position is in world coordinates. All other vectors are normalized. a= Azimuth, e=Elevation. When the angle is at 0,0 it's pointing in the same direction as v3.Forward.

What I need is a normalized v3 of that angle that somehow adds in the v3.Forward to give a world vector. Vector3.CreateFromAzimuthAndElevation will give me a v3 that's 0 based on the v3.Position.

Any trig experts out there?...

Getting a v3 from an angle.

Standard Protocol for Manipulating block.CustomData

Viewing all 903 articles
Browse latest View live