# Help me out here (and yourself maybe)

**URL:** <https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680>\
**Category:** Modding\
**Created:** [November 14, 2017, 12:17pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680 "2017-11-14T12:17:36Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nex](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/nex/32/58985_2.png) [@Nex](https://discourse.stonehearth.net/u/Nex)\
**Post date:** [November 14, 2017, 12:17pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/1 "2017-11-14T12:17:36Z")

</div>

Okay so instead of adding or replacing content I had my reasons to get rid of some! 🙂

I never did any modding in Stonehearth but I decided to dive into the files anyways, suprisingly it only took me a minute to accomplish what I wanted. Basically I just had to delete a few lines of code…

But then I thought, what if I turn this into a ‘mod’ so I could easily turn it on or off, or share it with everyone? And so I set up this folder structure inside the /mods folder:

- /temp/
  - /manifest.json
  - /handlers/
    - farming\_handler.lua

The manifest:

```
{
   "info": {
      "name": "temp",
      "version": 3
   },
      "override": {
      "stonehearth:call_handlers:farming_call_handler": "temp:handlers:farming_handler"
   }
}

```

My tweaked version of the ‘farming\_handler’ is simply missing a few lines of code and I’m trying to replace the original file with this one.

**The problem?**  
It works when I delete the code in the original file, but not as a mod trying to replace it.

Possible solutions I tried:

- Rebooting the game, several times
- Removing and adding the ‘mod’ entirely
- Adding the ‘required’ statement to the manifest, so that it is forced on

because I noticed json being used differently sometimes, I also tried:

- Swapping the path’s colons for slashes
- Using ‘file()’ instead of the folder name

**Interesting** is that without the required statement, I noticed the mod turning itself off every time I quit to main menu, or reboot the game. Which is odd behaviour as far as I’m aware.

---

<div class="post-metadata">

**Author:** ![Hamnisu](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/hamnisu/32/48131_2.png) [@Hamnisu](https://discourse.stonehearth.net/u/Hamnisu)\
**Post date:** [November 14, 2017, 12:23pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/2 "2017-11-14T12:23:59Z")

</div>

Try switching this line `"override":` into `"overrides":` (add an S at the end).

Also, it seems you are using aliases within your “overrides”-call?  
I’ve never seen it used that way before - but if it works, make sure both aliases exist (in the Stonehearth manifest and your manifest respectively).

In _overrides_ (and _mixintos_ etc.) I always point to files by folder-structure 🙂

---

<div class="post-metadata">

**Author:** ![Relyss](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/relyss/32/41785_2.png) [@Relyss](https://discourse.stonehearth.net/u/Relyss)\
**Post date:** [November 14, 2017, 12:25pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/3 "2017-11-14T12:25:40Z")

</div>

I works with aliases too, but @Nex doesn’t have that alias declared in his manifest.

---

<div class="post-metadata">

**Author:** ![Nex](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/nex/32/58985_2.png) [@Nex](https://discourse.stonehearth.net/u/Nex)\
**Post date:** [November 14, 2017, 12:32pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/4 "2017-11-14T12:32:54Z")

</div>

> [@Hamnisu](#):
>
> Try switching this line “override”: into “overrides”: (add an S at the end).

Should’ve noticed this, I changed it, didn’t solve the issue though.

---

<div class="post-metadata">

**Author:** ![BrunoSupremo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/brunosupremo/32/54819_2.png) [@BrunoSupremo](https://discourse.stonehearth.net/u/BrunoSupremo)\
**Post date:** [November 14, 2017, 12:33pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/5 "2017-11-14T12:33:30Z")

</div>

> [@Nex](#):
>
> “temp:handlers:farming\_handler”

This (as pointed by Relys) does not exist. You need to create that alias to use that way, or replace it with the file path.

---

<div class="post-metadata">

**Author:** ![Nex](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/nex/32/58985_2.png) [@Nex](https://discourse.stonehearth.net/u/Nex)\
**Post date:** [November 14, 2017, 12:37pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/6 "2017-11-14T12:37:23Z")

</div>

> [@BrunoSupremo](#):
>
> This (as pointed by Relys) does not exist. You need to create that alias to use that way, or replace it with the file path.

As far as I know (checking other mods’ manifests) the path on the right refers to the ‘modded’ content? So therefore the folders and files could be named anything right?

---

<div class="post-metadata">

**Author:** ![BrunoSupremo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/brunosupremo/32/54819_2.png) [@BrunoSupremo](https://discourse.stonehearth.net/u/BrunoSupremo)\
**Post date:** [November 14, 2017, 12:38pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/7 "2017-11-14T12:38:13Z")

</div>

temp:handlers:farming\_handler is not equal to temp/handlers/farming\_handler.lua  
A path has slashes **/**.  
Those with **:** are aliases to a path.

The right side is what will replace or add to the left side.  
The alias is just a shortcut to a path, like this

“your\_mod:your\_alias”:“full/path/here/that/you/dont/want/to/type/everytime.json”

The alias creation goes into the alias section, above the overrides, like this:

“aliases”{  
…  
}

---

<div class="post-metadata">

**Author:** ![Nex](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/nex/32/58985_2.png) [@Nex](https://discourse.stonehearth.net/u/Nex)\
**Post date:** [November 14, 2017, 12:43pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/8 "2017-11-14T12:43:38Z")

</div>

I get what you say but I don’t understand yet what I’m doing wrong here.

“temp:handlers:farming\_handler” does exist, because it refers to the folders/files with identical names right?

And also, why would I want to use an alias when this manifest has only 1 reference basically.

> [@BrunoSupremo](#):
>
> temp:handlers:farming\_handler is not equal to temp/handlers/farming\_handler.lua
> 
> A path has slashes /.
> 
> Those with : are aliases to a path.

Now, this makes sense, I thought those were the same. I did mention in op that I tried both ways though

---

<div class="post-metadata">

**Author:** ![BrunoSupremo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/brunosupremo/32/54819_2.png) [@BrunoSupremo](https://discourse.stonehearth.net/u/BrunoSupremo)\
**Post date:** [November 14, 2017, 12:44pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/9 "2017-11-14T12:44:41Z")

</div>

temp:handlers:farming\_handler is not equal to temp/handlers/farming\_handler.lua  
A path has slashes /.  
Those with : are aliases to a path.

You don’t need an alias. You are right, but using **:** means it is an alias. Replace them with **/** so they are an actual path. Oh, and you will need the file extension too, so add the **.lua**

---

<div class="post-metadata">

**Author:** ![Nex](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/nex/32/58985_2.png) [@Nex](https://discourse.stonehearth.net/u/Nex)\
**Post date:** [November 14, 2017, 12:55pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/10 "2017-11-14T12:55:51Z")

</div>

So this is correct?  
“stonehearth/call\_handlers/farming\_call\_handler”: “file(handlers/farming\_handler.lua)”

Or should the first part be colons still?  
“stonehearth:call\_handlers:farming\_call\_handler”: “file(handlers/farming\_handler.lua)”

Still not working with either of those.

---

<div class="post-metadata">

**Author:** ![Hamnisu](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/hamnisu/32/48131_2.png) [@Hamnisu](https://discourse.stonehearth.net/u/Hamnisu)\
**Post date:** [November 14, 2017, 12:58pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/11 "2017-11-14T12:58:58Z")

</div>

As pointed out by @Relyss and @BrunoSupremo, you either want to add the alias or point to the files by their respective folder-structure.

An example with folder-structure:

```
{
   "info": {
      "name": "temp",
      "version": 3
   },
      "overrides": {
      "stonehearth/call_handlers/farming_call_handler.lua": "temp/handlers/farming_handler.lua"
   }
}

```

If you want to add an alias to your mod, it would look something like this

```
"info": {},

"aliases" : {
    "handlers:farming_handler": "file(temp/handlers/farming_handler.lua)"
 },

 "overrides": {}

```

But, as pointed out by @BrunoSupremo, the alias you tried to call in the Stonehearth-mod does not exist in its manifest.

---

<div class="post-metadata">

**Author:** ![BrunoSupremo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/brunosupremo/32/54819_2.png) [@BrunoSupremo](https://discourse.stonehearth.net/u/BrunoSupremo)\
**Post date:** [November 14, 2017, 1:00pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/12 "2017-11-14T13:00:34Z")

</div>

The first one needs a .lua. So farming\_call\_handler.lua. A path is always complete, slashes and file extensions included.

The second is incorrect because there is no aliases named “stonehearth:call\_handlers:farming\_call\_handler”.

Just search at the stonehearth manifest to see if an alias exists or not. If not, use the full file path.

The “file()” method is a path relative to your current file using it.  
This is also the only time where you can have a path without a file extension, but only if your file is a json and it has the same name of its folder. So you can stop the path at the folder and it will guess that it has a json file there.  
Like “file(path/entity)” will point to path/entity/entity.json

---

<div class="post-metadata">

**Author:** ![Nex](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/nex/32/58985_2.png) [@Nex](https://discourse.stonehearth.net/u/Nex)\
**Post date:** [November 14, 2017, 1:07pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/13 "2017-11-14T13:07:35Z")

</div>

Alright I get it now, even with coding experience this json and lua made no sense to me at first. And before @Hamnisu wrote that example I didn’t understand it either.  
But thank you all for you time as this is very basic information I suppose. Though still way more difficult than the original change I made to the code itself!

---

<div class="post-metadata">

**Author:** ![Hamnisu](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/hamnisu/32/48131_2.png) [@Hamnisu](https://discourse.stonehearth.net/u/Hamnisu)\
**Post date:** [November 14, 2017, 1:15pm UTC](https://discourse.stonehearth.net/t/help-me-out-here-and-yourself-maybe/32680/14 "2017-11-14T13:15:37Z")

</div>

Before starting my own mod, I had never worked with JSON nor Lua either - I understand your struggles getting started.  
I’m still not very experieced with them.

It’s not “basic information” until you understand more advanced stuff; so don’t beat yourself up over this! 😉  
Glad the issue is solved!
