A problem with my mod

Post Reply
User avatar
Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

A problem with my mod

by Josh » Post

Ok so i created a simple mod. Iv'e done the init.lua file & everything else textures i have also done. But when i go to see if it works properly it says ModError failed to load & run. Why? im sure iv'e done everything right.

User avatar
InfinityProject
Member
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Post

Post your debug.

User avatar
Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post

How?

User avatar
sfan5
Moderator
Posts: 3938
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

1. Delete debug.txt
2. Reproduce the Error
3. Paste Debug.txt to http://pastie.org
4. Post the Link
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post

This is what i have written in init.lua

minetest.register_craftitem("decoplants:decoplant", {
tile_images = {"decoplant.png"},
groups={choppy},minetest.register_craft({
output = '"decoplant" 4',
recipe = {
{'default:leaves', 'default:leaves', ''},
{'default:leaves', 'default:leaves', ''},
{'', '', ''},

Is there anything im missing?

User avatar
Echo
Member
Posts: 121
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

where are the final brackets? Just to lazy to post or really missing? Please post the debug output.

User avatar
Topywo
Member
Posts: 1721
Joined: Fri May 18, 2012 20:27

by Topywo » Post

Josh wrote:This is what i have written in init.lua

minetest.register_craftitem("decoplants:decoplant", {
tile_images = {"decoplant.png"},
groups={choppy},minetest.register_craft({
output = '"decoplant" 4',
recipe = {
{'default:leaves', 'default:leaves', ''},
{'default:leaves', 'default:leaves', ''},
{'', '', ''},

Is there anything im missing?
I'm a beginner with LUA, so needed to read a bit. I hope experienced modders correct me whenever I'm wrong (I probably forgot something). Edit: found the first (edit: two --> three) errors myself.

I was busy making a longer answer, but then the electricity disappeared for half an hour and I lost everything :-/

Two helpfull links:
http://minetest.net/forum/viewtopic.php?id=1378
http://minetest.net/forum/viewtopic.php?id=2049

I certainly advice to peek into the init.lua of the default mod

1. If you want a nice decorative plant for your house, I don't think craftitem is going to help you. As far as I can see it is used for items with the only purpose to be used in crafting and with only an inventory image. Use node instead of craftitem.

2. Tile_images is deprecated, use: tiles

3. To use an image it needs to be in a textures folder. The names are slightly different from those used in the rest of LUA. Instead of the colon (:) you need to use the underscore(_) to seperate the modname from the item/node name.
So if you use decoplants:decoplant, your textures folder needs to contain decoplants_decoplant.png and the line you use in init.lua is:
tiles={"decoplants_decoplant.png"},

4. As far as I know you need to give a value to choppy in groups like this:
groups={choppy=3},

5. close with })

6. use two enters to create a whiteline for readability and then continue with minetest.register_craft etc..

7. output = '"decoplant" 4', --> use ' instead of " and ' and use the modname, like this:
output = 'decoplants:decoplant 4',

8. Try for your receipe the same as the default:sandstone and don't forget the end brackets. Sandstone's receipe is working for sure:
recipe = {
{'default:leaves', 'default:leaves'},
{'default:leaves', 'default:leaves'},
}
})

9. Great that you are trying to use LUA!
Last edited by Topywo on Mon Sep 10, 2012 09:54, edited 1 time in total.

User avatar
minecraft64
Member
Posts: 16
Joined: Sun Jul 22, 2012 14:23
Location: Stalker Block!! XD
Contact:

by minecraft64 » Post

the crafting recepie is a separate line of code then the register; node, craft item, etc.
Got Tobuscus?

User avatar
Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post

Topywo wrote:
Josh wrote:This is what i have written in init.lua

minetest.register_craftitem("decoplants:decoplant", {
tile_images = {"decoplant.png"},
groups={choppy},minetest.register_craft({
output = '"decoplant" 4',
recipe = {
{'default:leaves', 'default:leaves', ''},
{'default:leaves', 'default:leaves', ''},
{'', '', ''},

Is there anything im missing?
I'm a beginner with LUA, so needed to read a bit. I hope experienced modders correct me whenever I'm wrong (I probably forgot something). Edit: found the first (edit: two --> three) errors myself.

I was busy making a longer answer, but then the electricity disappeared for half an hour and I lost everything :-/

Two helpfull links:
http://minetest.net/forum/viewtopic.php?id=1378
http://minetest.net/forum/viewtopic.php?id=2049

I certainly advice to peek into the init.lua of the default mod

1. If you want a nice decorative plant for your house, I don't think craftitem is going to help you. As far as I can see it is used for items with the only purpose to be used in crafting and with only an inventory image. Use node instead of craftitem.

2. Tile_images is deprecated, use: tiles

3. To use an image it needs to be in a textures folder. The names are slightly different from those used in the rest of LUA. Instead of the colon (:) you need to use the underscore(_) to seperate the modname from the item/node name.
So if you use decoplants:decoplant, your textures folder needs to contain decoplants_decoplant.png and the line you use in init.lua is:
tiles={"decoplants_decoplant.png"},

4. As far as I know you need to give a value to choppy in groups like this:
groups={choppy=3},

5. close with })

6. use two enters to create a whiteline for readability and then continue with minetest.register_craft etc..

7. output = '"decoplant" 4', --> use ' instead of " and ' and use the modname, like this:
output = 'decoplants:decoplant 4',

8. Try for your receipe the same as the default:sandstone and don't forget the end brackets. Sandstone's receipe is working for sure:
recipe = {
{'default:leaves', 'default:leaves'},
{'default:leaves', 'default:leaves'},
}
})

9. Great that you are trying to use LUA!
Thank's for helping me out Topywo.

User avatar
Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post

Good news! i got my mod to work but when i choose it from creative mode it looks like this
https://dl.dropbox.com/u/102401091/scre ... 142873.png
It's not suppost to look like that all i want it to look like is junglegrass.

User avatar
InfinityProject
Member
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Post

Add:

Code: Select all

drawtype = "plantlike",

To your node.

User avatar
Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post

Thank's InfinityProject it works! it now look's like this https://dl.dropbox.com/u/102401091/scre ... 591842.png
Hooray iv'e officially created a mod. Only a few more change's & i will release it to everybody.

User avatar
Aqua
Member
Posts: 641
Joined: Wed Aug 22, 2012 09:11
Location: Sydney~Singapore
Contact:

by Aqua » Post

Great job can't wait until release been waiting for something like this :)
Last edited by Aqua on Sat Sep 22, 2012 06:55, edited 1 time in total.
Hi there ^.~

User avatar
Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post

I have created another mod this will add a sword! but before i release it i would like to know how i can get it to take away all of the players hearts?

User avatar
Echo
Member
Posts: 121
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

out of lua_api.txt:

Code: Select all

- get_hp(): returns number of hitpoints (2 * number of hearts)
- set_hp(hp): set number of hitpoints (2 * number of hearts)

User avatar
Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post

I am making a new mod that adds differen't types of buckets. These will do the same as normal buckets. Were do i start?

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

start by making a new mod, and then paste this in the init.lua:
https://github.com/celeron55/minetest_g ... t/init.lua

Change "bucket" to "yourmod", and then do whatever you want to make it work the way you want.

User avatar
Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post

cornernote wrote:start by making a new mod, and then paste this in the init.lua:
https://github.com/celeron55/minetest_g ... t/init.lua

Change "bucket" to "yourmod", and then do whatever you want to make it work the way you want.
Thanks. Ill see what i can do.

Post Reply

Who is online

Users browsing this forum: Skamiz Kazzarch and 10 guests