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

Block.GetValue("IsShooting") nullreference error

$
0
0
Hi,
Does anyone have an idea, why this is always throwing an exception ?

Code:
int firingguns = 0;
List<IMyTerminalBlock> Guns = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyUserControllableGun>(Guns);
for(byte i=0;i<Guns.Count;i++)
{
	if( Guns[i].GetValue<bool>("IsShooting")==true )  firingguns += 1;
}

I checked every part of this code and only this part seems to cause the problem:
"GetValue<bool>("IsShooting")"...

Block.GetValue<bool>("IsShooting") nullreference error

Help: IsConnected & IsLocked obsolete?

$
0
0
Hello,

I am writing a script that is reliant on knowing when a connector can connect and when it is connected, but when I run it it says IsConnected & IsLocked are obsolete and the if's that are dependent on them are not triggering. What were they replaced with and what is the new syntax for finding those out?

I appreciate the help :)
--- Automerge ---
Nevermind,...

Help: IsConnected & IsLocked obsolete?

Get Blocks with name Tag

$
0
0
Hello,

is there a common solution to get Blocks by a Nametag.

for Example all Blocks with "Test - " in thier name.

I know there a multiple ways, but wich one is the most performant?

[solved] Thrust Override doesn't work in 2nd code iteration

$
0
0
hi,
the following code is Part of a bigger script.
for better understanding i inserted the whole foreach loop, which gives me trouble.

This code snipped is actually responsible for dedocking a small drone via mergeblock, in particular this is the part where the thrusters are getting fired to generate distance between mothership and drone.

When i weld the first Drone, it works perfectly and drone gets properly seperated.
If i weld/place the next drone, everything seems to work fine, except...

[solved] Thrust Override doesn't work in 2nd code iteration

SetTarget() and TrackTarget() broken ?

Programmable Block Help; Changing Light Color Based on Inventory

$
0
0
Hey folks,

I am looking for a bit of help with a basic Programmable Block script I am trying to cobble together. The general idea is for a Spotlight to change color based on how full the cargo containers on an Atmospheric Miner used in Survival are; basically an obvious visual cue that it is time to go home and unload.

The ship in question, currently, is a small grid with four large containers - hence setting the trigger variable "Red" to ~90% of four 15kL containers.

It seems this should...

Programmable Block Help; Changing Light Color Based on Inventory

[solved] Block.GetValue("IsShooting") nullreference error

$
0
0
Hi,
Does anyone have an idea, why this is always throwing an exception ?

Code:
int firingguns = 0;
List<IMyTerminalBlock> Guns = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyUserControllableGun>(Guns);
for(byte i=0;i<Guns.Count;i++)
{
	if( Guns[i].GetValue<bool>("IsShooting")==true )  firingguns += 1;
}

I checked every part of this code and only this part seems to cause the problem:
"GetValue<bool>("IsShooting")"...

[solved] Block.GetValue<bool>("IsShooting") nullreference error

Ingame Programming missing API and functions and known issues

$
0
0
So i've decided to sum up, what i'm mostly missing on blocks in ingame API
Please add things you want to see, or that should be here
Before i list missing APIs i add few known issue and possible circumvents

Some values are not available trough IMyTerminalBlock.GetProperties(), but you still can parse them from IMyTerminalBlock.DetailedInfo(which is enough, if you don't need to modify this values), list of detailed info strings can be found here...

Ingame Programming missing API and functions and known issues

Any RADAR possibility with a drone swarm?

$
0
0
I'm designing/developing a drone "swarm" that could serve as a "border" around my base. They will be spread on a surface of a sphere, center of the sphere will be the base. While I'm online, on my HUD, I could see any other ship that is closing to my base and dispatch drones or start my capital ship.

Are there any method to detect them programmatically? I know the raycasting feature of the camera, but it is not enough for such RADAR functionality. I understand that from Antennas I couldn't...

Any RADAR possibility with a drone swarm?

Working on an Elevator Programme

$
0
0
Hello.
I have been working on a script to work with a 1x1 elevator I designed. As it stands, I am not knowledgeable enough to fix the errors I've been getting on my own.
Could someone help me out with making it compile in-game? I've commented the code as best I could so you'll know what my intent is.
What it should do:
  1. set pistons(marked by a tag) to a list and .count to an int
  2. calculate and pass(to pistons[divided across equally]) distance from current floor to destination...

Working on an Elevator Programme

Tutorial scenarios utilize old API functions no longer available - need help!

$
0
0
This is my first time giving programming a go, and first time using C#. I spent the better part of the last couple of days watching YouTube tutorials to get some basic understanding. That said, I started one of the programming tutorial scenarios, and have found that most of the scripts are using obsolete functions. I'm looking for some help on how to proceed with the script below

The underlined line of code below is where it gives the warning "outDoor.Open is obsolete, use Status property...

Tutorial scenarios utilize old API functions no longer available - need help!

[resolved]projector.LoadBlueprint() not working?(it does work afterall)

$
0
0
hi im trying to make a script to automatically configure all of the projectors on a structure so i can build a space elevator, each section is welded by a climber and has a projector on it which projects the next section, since blueprints are stored in the projector by value and not by reference i need to constantly update all the projectors to the bottom most version (their are 4 nested sections of slack so the script docent have to run as quickly).

anyway everything is working except for...

[resolved]projector.LoadBlueprint() not working?(it does work afterall)

Script Cycle-day/night detection without Timer: Help

$
0
0
Hi! I'm Brazilian, they wanted to apologize for my English because I'm using Google Translate to post. I am a recent SE player and a recent programming student and would like to start exercising programming by SE and the tutorials in that forum, and I decided to make a simple code to detect the day cycle without relying on timer, only the solar panel and logic That I came up with some research was as follows:


Code:
List <IMySolarPanel> SolarPanel = new List <IMySolarPanel> ();
List...
Script Cycle-day/night detection without Timer: Help

Get Terminal Actions/Properties/ItemIds etc. script

$
0
0
Hello guys, i have been using this script for a while now and its been giving me alot of easy to get documentation for use in my own scripts so i decided to release it as an easy way to get terminal API info :)

How to use:
- Set up PB
- Paste/ load in my code
- rename block you want to inspect "block"
- recompile
- use the commands displayed in the "echo" box of the PB :)

Commands:
when you first load the script you will see this in the echo box, it displays all the commands you can use:...

Get Terminal Actions/Properties/ItemIds etc. script

Use of many Split() commands causes complexity issues

$
0
0
Hi all I am in the process of writing a script that displays different things based on which line of custom data in a text panel is read.
e.g. you read the first line it may show on the text panel:Menu name is "Men1" then options are "option1","option2"... so on. or if you read the second line:
Display name is "DisplaySigma" then values are "value 1" = 4, "value 2" = 63 ... so on etc.

To accomplish this what I have done is create a format I use in the custom data of:...

Use of many Split() commands causes complexity issues

Foreach??

$
0
0
Can a dev or someone confirm whether or not foreach loops work consistently?? I remember seeing something on steam from late 2015 or early 2016 saying that they were bugged.

Help With Whips Drop Pod Script

[PSA] the newest update (1.182.2) has broken lcd updates [Fixed in 1.182.203]

$
0
0
Basically lcds only update once every 100 ticks (0.6fps) now. doesnt matter if its SP or MP.

Edit: Workaround has been found, you can force an update by making the lcd switch to texture and back to text like in ye olden days (this drains performance tho):
Code:
lcd.ShowTextureOnScreen();
lcd.ShowPublicTextOnScreen();
thx to MMaster for taking a peek using dotpeek :)

Edit2: talking with a dev, figuring out the issue

Edit3: please dont use the walkaround unless you absolutely have...

[PSA] the newest update (1.182.2) has broken lcd updates [Fixed in 1.182.203]

Help solving "Script is too complex" without loosing any functionality

$
0
0
I get "Script is too complex" when i undock from a station with many blocks, is there any good way to change the code to make it work without loosing any functionality?


Help solving "Script is too complex" without loosing any functionality

Drones

$
0
0
Hey all, I've recently started modding space engineers, but I haven't really gotten into the in-game scripting yet. I've read this tutorial and have gotten everything right until it comes to the drone coming at the player. https://steamcommunity.com/sharedfiles/filedetails/?id=519946091 I use the script below in the programmable block (I actually got this script out of a programmable block on one of the default pirate ships). Anyway, I put the script in the programmable block, use...

Drones
Viewing all 903 articles
Browse latest View live