Auto-Code in Stardew Valley

Image by Joe Strout

Add a robotic helper to your Stardew Valley farm with Miniscript!

Stardew Valley is an engaging video game in which you can farm, craft things, fish, and make friends with other local residents. As your garden grows, all that farming can be time-consuming. Wouldn’t it be great if you could use your computer skills to automate some work? You can, with the Farmtronics mod.

To start, install SMAPIa free program that supports mods (additional or customized features) in any desktop version of Stardew Valley. Detailed instructions for installing SMAPI are available on the web at https://stardewvalleywiki.com/Modding:Player_Guide/Getting_Started.

Next, download Farmtronics (https://github.com/JoeStrout/Farmtronics), and unzip it into your Mods folder as described in the SMAPI instructions. Then launch Stardew Valley, and click on the TV in your cabin—the same place you go for a weather report or to watch the fortune teller. If everything has gone correctly, you’ll now see a new option: “Farmtronics Home Computer”. Click that, and the home computer opens up, with a blinking cursor ready for your commands.

If you’ve followed the Mini Micro projects in recent issues, the Farmtronics computer will feel very familiar. It uses the same MiniScript language, and even includes some of the same demos. Start with the help Command.

That will lead you to the very important toDo command.

The toDo command shows you a list of programming tasks, from simple to complex.

Each one has some notes about how to approach it, and a checkbox that indicates when the task is complete. Work your way through these tasks one by one, reading the instructions carefully. If you get stuck, ask someone to work with you, or find help online (https://miniscript.org).

The reward for completing all seven tasks is well worth it: your very own robot. You’ll receive this in the mail the next morning after completing the tasks. You can carry this robot around with you, and place it down somewhere in your farm.

Then right-click it, and the bot console will open up. The bot console is just like the home computer, except that you also have access to item inventory so you can give the bot items, or take things it has gathered.

Also, the bot console has access to commands that start with bot. When you get to this point, try it. Right-click your robot, then enter bot.forward. The bot immediately rolls forward one map square if it can. (If your screen is big enough, you can click and drag just outside the bot console to move it aside, so that you can see the console and the bot at the same time. Otherwise, you’ll have to dismiss the bot console by clicking OK in order to see what the bot has done.) Other bot commands make the robot turn, use tools, and sense what is in front of it. By this point, you will know how to edit and save your own programs, so you can write code to make the robot do sophisticated tasks for you, like water and harvest your whole garden.

You can find more details about the available commands in the Farmtronics wiki (https://github.com/JoeStrout/Farmtronics/wiki/).

As you develop your own robot programs, be patient with yourself. Take them one step at a time, testing as you go, and don’t worry if it takes multiple tries to get it right. Programming is a superpower, but like any skill, it takes practice. In time your robot will be a trusty companion and a hard-working member of your Stardew Valley family.

Learn More

What is Autocoding

https://en.wikipedia.org/wiki/Autocoding

Stardew Valley

https://www.stardewvalley.net/

Stardew Valley on STEAM

https://store.steampowered.com/app/413150/Stardew_Valley

Stardew Valley Wiki?

https://stardewvalleywiki.com/Stardew_Valley_Wiki

Stardew Valley Trailer

https://www.youtube.com/watch?v=ot7uXNQskhs

Stardew Valley

https://www.gog.com/en/game/stardew_valley

SMAPI

https://smapi.io/

How to Install SMAPI and Mods

https://www.youtube.com/watch?v=CCqk2ejC_Hs

Launch SMAPI Using Steam for Stardew Valley

https://shockbyte.com/billing/knowledgebase/719/How-to-Launch-SMAPI-Using-Steam-for-Stardew-Valley.html

Also In The December 2022 Issue

The electronic toys your parents may have grown up with!

Meet the point where your love of hiking and technology meet.

Learn how kids are falling in love with computer science in Africa

Move over Krabby Paddy, algae burger is coming through!

Show off your Minecraft fighting skills with these RAD mods

Take a bite out of this story on how technology is being used to help communities come together!

A collection of the Learn more links from the December 2022 issue, all in one place, just for you.

A collection of interesting stories about technology and STEM for December 2022

Interested but not ready to subscribe? Sign-up for our free monthly email newsletter with curated site content and a new issue email announcement that we send every two months.

No, thanks!