A problem with my mod

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

A problem with my mod

by Josh » Sun Sep 09, 2012 04:28

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

by InfinityProject » Sun Sep 09, 2012 04:31

Post your debug.
 

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

by Josh » Sun Sep 09, 2012 04:36

How?
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Sep 09, 2012 06:00

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)
 

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

by Josh » Mon Sep 10, 2012 04:09

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

by Echo » Mon Sep 10, 2012 08:20

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

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

by Topywo » Mon Sep 10, 2012 09:50

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

by minecraft64 » Tue Sep 11, 2012 02:00

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

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

by Josh » Tue Sep 11, 2012 03:28

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.
 

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

by Josh » Sat Sep 22, 2012 03:24

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/screenshot_3959142873.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

by InfinityProject » Sat Sep 22, 2012 03:50

Add:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
drawtype = "plantlike",

To your node.
 

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

by Josh » Sat Sep 22, 2012 04:04

Thank's InfinityProject it works! it now look's like this https://dl.dropbox.com/u/102401091/screenshot_3961591842.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

by Aqua » Sat Sep 22, 2012 06:54

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 ^.~
 

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

by Josh » Sun Sep 30, 2012 03:18

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

by Echo » Sun Sep 30, 2012 06:53

out of lua_api.txt:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
- get_hp(): returns number of hitpoints (2 * number of hearts)
- set_hp(hp): set number of hitpoints (2 * number of hearts)
 

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

by Josh » Tue Oct 09, 2012 02:47

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?
 

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

by cornernote » Tue Oct 09, 2012 03:27

start by making a new mod, and then paste this in the init.lua:
https://github.com/celeron55/minetest_game/blob/master/mods/bucket/init.lua

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

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

by Josh » Tue Oct 09, 2012 03:45

cornernote wrote:start by making a new mod, and then paste this in the init.lua:
https://github.com/celeron55/minetest_game/blob/master/mods/bucket/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.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 15 guests

cron