Migrating your mod to Steam Workshop

Nooby question but what do you mean by define?

Well, are you a modder?

What should i be changing here?

Infa.addPlatformA = function () {
		var icon = './mods/InfaMod_v1.0.0/Consoles/img/A.png';
		GDT.addPlatform(

If you follow the recommendations written above, you would use:

var InfaMod_MrDewDew = {};

(function () {
	InfaMod_MrDewDew.modPath = GDT.getRelativePath();

var ready = function () {
};

var error = function () {
};


GDT.loadJs(['source/source.js',
'source/OtherFile.js',
'source/SubFolder/AnotherFile.js'
], ready, error);
})();

And then in your implementation:

Infa.addPlatformA = function () {
		var icon = InfaMod_MrDewDew.modPath + '/Consoles/img/A.png';
		GDT.addPlatform(
2 Likes

alphabit got me. :smiley: He ninja’d me.

2 Likes

Question, do we have to make it like this? var exGDT_FireChaos and not jsut exGDT?

Basically it doesn’t matter BUT, we recommend a certain way to do it, in order to make it easier for all to:

  1. distinguish this variables and try to make as much as possible sure that there are no name collisions
  2. allow other mod-writers to use this convention for accessing other mod’s feature (for interaction between mods)

So my recommendation would be (especially to make support easier) to use the proposed convention.

2 Likes

Also, @alphabit I’m having problems getting my platform images done. It’s annoying. I tried to fix it many times but it doesn’t work.

What exactly is your problem? Any chances I can take a look at your mod?

1 Like

Well, we can use jsfiddle, (an online collaboration site, built for JS, also has chat etc.Join here: http://jsfiddle.net/#&togetherjs=ENAerFGTaJ ), or i can send you the file, or I can paste it here (I don’t prefer the 3rd option.
Problem: Images missing.

Let’s fiddle

3 Likes

Important Note about modding with and without Steam Workshop

Just to avoid some confusion:
The changes described in this topic are necessary to allow your mod to correctly work with Steam Workshop.
BUT your mods will work after all these changes also when installed manually (like you always did in the /mods/ folder).

Path acquisition is dynamic (when used as we recommended), so it doesn’t matter if your mod has been downloaded from Workshop or has been installed manually.

When you develop your mods, you would do that like you did before, with the differences / changes discussed here.
Hope this clarifies some confusion.

3 Likes

Of some reason I dont seem to get any image. I am sure the image is in the location it should return.

Doesn’t work:

var buntuIcon = GDT.getRelativePath() + "/img/buntu.png";

Doesn’t work:

var buntuIcon = GDT.getRelativePath() + "img/buntu.png";

This should work. I don’t know if it makes a difference, put it like this.

var buntuIcon = GDT.getRelativePath() + 'img/buntu.png'

This is how you call the image.
In your file which loads the mod’s js’s in the same folder as package.json is, that file which package.json sais to load, did you define this?

Part of the code.
var buntuIcon = {};
(function () {    
    buntuIcon.modPath = GDT.getRelativePath();

you should keep a copy of what GDT.getRelativePath() returns at the start of your mod and then use this value to build your paths. Don’t call GDT.getRelativePath() every time you need the value as it will not reliably return the correct value.

Have a look at the example in the original post.

2 Likes

That was the exact same as I explained.

@PatrickKlug could you please explain in detail, I didnt understand. I tried it, but my mod couldnt recognize the variable declared in my maim file.

1 Like

3 Likes

Thank you :slight_smile:

Did you fix it? What was the problem?

GDT.getRelativePath() 

returned wrong value. See @alphabit’s post.

1 Like