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

Help creating a basic status checker script

$
0
0
I'm trying to create a script that is simply this:
if connector is unconnected > play soundblock once.

The problem is that it keeps starting to play the sound over and over again if I do it by updatefrequency100.

I didn't find anywhere in the API (https://github.com/malware-dev/MDK-SE/wiki
/SpaceEngineers.Game.ModAPI.Ingame.IMySoundBlock) how to check if whether the "play sound" on the soundblock is true. From looking at it I don't think it can be done.

I guess I should try...

Help creating a basic status checker script

Request for access to wheel propulsion override (Steering angle as a bonus)

$
0
0
To whom it may concern,

Request:
I am hoping that we can get access to wheel propulsion through in-game scripting, like we have access to the "Override" property on a Thruster.

Considerations:
I am aware that wheels function differently than thrusters and this would be fine. My expectations given current behavior is that we would get access to toggle (positive or negative) propulsion override as though a user was pressing the W or S keys (respectively).

For simplicity we can assume...

Request for access to wheel propulsion override (Steering angle as a bonus)

Yield Malware

$
0
0
Not an anti-virus advert.

Just wanted to say that I have revisited some of my scripts and are now using IEnumerator<GridProcessorState> to yield at update10. Have a sensor that checks if any player are near (PB also checks IsUnderControl) and only then my PB starts yielding states from an enum in an array..

CheckGridState, GenerateManifest, CalculateWeight, CalculateEnergy, DisplayManifest, DisplayEnergy, RenameBlocks etc etc.

Not often in C# you get to fake a message pump with a loop...

Yield Malware

Merge Block issues (IsConnected)

$
0
0
I'm making a thing that moves along a rail and extends it as it goes, for various applications.

Basically, the thing moves along the rail with 2 merge blocks, but i'm having some issues.

The (MergeBlock).IsConnected function returns true as early as the merge block indicator turns yellow, eg. when it's getting close, but still isn't connected, does anyone know of a method of detecting if the merge block is actually merged? currently just checking the position of the piston moving the...

Merge Block issues (IsConnected)

GetCubeBlock() for armor?

$
0
0
I haven't seen anything recent on this topic... was wondering if there was anything new, or a workaround, for accessing the slimblock for a non-terminal block? I'm looking for damage/integrity values.

API or example script for the new LCD?

$
0
0
With the new update, 6 different possible LCD's in cockpits, 2 on the programmable blocks... heck knows how many more are out there.

So the question is how to access each of them?

For example, I want to set up one of the LCD's in a friendly fighter to list the heading/pitch change to point to the nearest enemy, as locked onto by one of it's turrets.

I'm not asking for the turret to LCD code, I'm asking for the actual code that references the LCD itself in the cockpit....

API or example script for the new LCD?

Enemy player's Name in MyDetectedEntityInfo

$
0
0
Hi!
I wrote simple script, that show detected players on LCD:

PHP:
string lcd_name "BASE-DetectionLCD";
string sensor_name "BASE-Sensor"
string detect_str "";

IMyTextPanel lcd_panel GridTerminalSystem.GetBlockWithNamelcd_name ) as IMyTextPanel;
IMySensorBlock sensor GridTerminalSystem.GetBlockWithNamesensor_name ) as IMySensorBlock;

MyDetectedEntityInfo detected_entity sensor.LastDetectedEntity;

if( 
detected_entity.Type == MyDetectedEntityType.CharacterHuman )
{...
Enemy player's Name in MyDetectedEntityInfo

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

Autogenerated API index

$
0
0
This index contains all types and members available to ingame scripting - with exception to the .NET types, because including those would have made the listing far too big. There will be links to Microsoft's own documentation for those types where appropriate.

https://github.com/malware-dev/MDK-SE/wiki/Api-Index

Set VS for script writing

$
0
0
Its been a while since I last played around with scripting in-game.
Seems that a lot has changed and trying to set a project in Visual Studio
so I can write while not playing the game had few difficulties.
I get reference errors and I'm not sure what I'm doing wrong.
Can I still use VS2015 or should I upgrade to a newer version, and then what?
I appreciate anyone who could help me :)

Reflection

$
0
0
I am curious is reflection permitted in the Program Block? I am guessing its probably not allowed but was wondering.

Looking a for script that toggles light colours

$
0
0
I'm looking for a script that can change the colour of an interior light based on another block's power state (block is off - light turns red, block is on - light turns blue). Can anyone help with this?

Alternatively something that can just toggle the light between two colours with a single button.

There's plenty of similar scripts around but they're either no longer working or unable to toggle without setting up a second trigger or manually altering the Run arguement.

Detecting key presses / mouse movement.

$
0
0
I'm looking for tutorials or examples of code for the programmable block that can detect user interactions. If they can be filtered to just manual movement (pressing a thruster key, or manipulating yaw, pitch, and roll) that would cover me. I really don't need the values being generated but just output a bool that, yes, the player is using a thruster or rotating the ship at the time the script is running.

I've looked back a few pages in the forum as well as did a search via Google.

Thanks

Noob question about scripting for text panel

$
0
0
How do I skip lines on the text output?

I wrote
mainscreen.WriteText("> option 1", false);
mainscreen.WriteText("- option 2", true);
mainscreen.WriteText("- option 3", true);
mainscreen.WriteText("", true); //attempt to skip a line
mainscreen.WriteText("etc...", true);

with the hopes of it looking like

> option 1
- option 2
- option 3

etc...

but it comes out as
> option 1- option 2- option 3etc...

I'm making a menu for choosing options with a button panel with an...

Noob question about scripting for text panel

New Camera Raycast and Sensor API (Update 01.162 DEV)

$
0
0
by Rexxar:
--------------------------------------------------------------------

This week brings several big changes to the programmable block API. The major features are:
  • IMyRemoteControl.GetFreeDestination has been removed
  • IMySensorBlock.LastDetectedEntity no longer returns an IMyEntity reference, instead returns MyDetectedEntityInfo
  • IMyCameraBlock has new raycast functions to replace GetFreeDestination
  • New MyDetectedEntityInfo struct to contain information...

New Camera Raycast and Sensor API (Update 01.162 DEV)

Help with thrusters on rotors

$
0
0
Hello all!

I'm trying to control a ship which has 4 wings - 2 on each side with 4 hydrogen thrusters on each wing. I want to set a command from cockpit so the thrusters face forward, downward or backward. During the transition from one position to the target position, the thrusters must be off. They should fire only when the current angle is withing tolerance of 1.5° from target position. When the position is within the tolerance, the rotation speed should become 0 and the rotors will be...

Help with thrusters on rotors

IMyShipController::CalculateShipMass() Broken?

$
0
0
I have a little test ship. The Mass of this ship is 230,374.4kg. This is the base mass without myself and any items stored in a container. The method returns the struct below.

Code:
	public struct MyShipMass
	{
		//
		// Zusammenfassung:
		//	 Gets the base mass of the ship.
		public readonly float BaseMass;
		//
		// Zusammenfassung:
		//	 Gets the total mass of the ship, including cargo.
		public readonly float TotalMass;
		//
		// Zusammenfassung:
		//	 Gets the physical mass of the...
IMyShipController::CalculateShipMass() Broken?

Inserting code into Programmable Block via (another) Programmable Block

$
0
0
Hey all,

I'm new to programming - please bear with me :)

As stated in the title my question is, whether it is possible to insert code into a programmable block via another programmable block.

My use case is as follows: I'm building a carrier with some facilities that can autoweld and launch smaller drones. The carrier determines a target via raycast, calculates an orbit (sort of) around the target and send's those coordinates to the drones. Those should orbit the target and engage the...

Inserting code into Programmable Block via (another) Programmable Block

Visual Script Builder

Direct way to get grid velocity vector

$
0
0
Hi,
I couldn't find a direct way to get the velocity vector of the grid a programmable block is on. I know other ways to get it but I was wondering if there was a method or function to call that could do it directly. Since I can place a camera and use the raycast function to know its own grid velocity, I suppose there is a way to know it directly as the vector apparently does exist within the game.
Viewing all 903 articles
Browse latest View live