0 of 0

File information

Last updated

Original upload

Created by


Uploaded by


Virus scan

Safe to use

Tags for this mod

About this mod

Write and execute C# code from the SMAPI console.

Permissions and credits
Console Code lets you write and execute C# code from the SMAPI console.

  • Install the latest version of SMAPI.
  • Unzip the mod folder into Stardew Valley/Mods.
  • Run the game using SMAPI.

Short snippets
You can run code directly in the SMAPI console using the cs command. You can separate multiple expressions with ;. If the last expression returns a value, it'll be shown in the SMAPI console.

For example:
cs Game1.player.Money = 5000; Game1.player.currentLocation.Name
> Output: "FarmHouse"

You can't use double quotes (") directly in the console (due to the SMAPI command parser), but you can replace them with backticks (`).

Script files
You can load a block from a file in Console Code's folder. The script must not include using statements, class declarations, etc.

For example, let's say you have this sell-items.cs file in the mod folder:
foreach (var item in Game1.player.items)
if (item == null)
Game1.player.money += item.salePrice();

You can execute it like this:
cs --script sell-items.cs

Compatible with Stardew Valley 1.5+ on Linux/macOS/Windows, both single-player and multiplayer.

See also