Page 1 of 1

Need mod help

PostPosted: Mon Jun 03, 2013 14:48
by Yuser
This is my first time modding, you may be able to tell, but I was trying to get the framework of my mod in minetest and it just tells me failed to load and run the mod, with no information (but I haven't looked in debug yet, but I'm not sure how to read the debug lol)

this is the code so far that won't run

And right now it says unexpected symbol near ' '

some of the stuff I dodn't fill in yet, I'm worried about the ' ' right now
and other syntax errors

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
minetest.register_craft({
    output = 'planes:battery',
    inventory_image = "planes_battery.png"
    recipe = {
        {'default:iron_ingot', '', ''},
        {'default:mese_crystal', '', ''},
        {'default:iron_ingot', '', ''},
    }
})
})

minetest.register_craft({
    output = 'planes:esc_and_motor',
    inventory_image = "motor.png"
    recipe = {
        {'default:mese_crystal_fragment', 'default:mese_crystal_fragment', 'default:iron_ingot'},
        {'default:mese_crystal_fragment', 'default:iron_ingot', 'default:iron_ingot'},
        {'default:iron_ingot', '', 'default:iron_ingot'},
    }
})
})

minetest.register_craft({
    output = 'planes:reciever',
    inventory_image = "receiver.png"
    recipe = {
        {'default:iron_ingot', '', ''},
        {'default:mese_crystal', '', ''},
        {'', '', ''},
    }
})
})

minetest.register_craft({
    output = 'planes:electric_plane',
    inventory_image = "plane_flat.png",
    recipe = {
        {'default:wood_planks', 'planes:esc_and_motor', 'default:wood_planks'},
        {'default:mese_crystal', 'planes:battery', ''},
        {'', 'planes:receiver', ''},
    }
    on_place_on_ground = envref.add_entity(player,electric_plane)
})
})

minetest.register_entity(planes:rc_plane_flying, entity_definition)

print( 'Planes Mod: LOADED ' )

PostPosted: Mon Jun 03, 2013 14:59
by PilzAdam
You definetly need to paste the output of debug.txt, otherwise someone need to go through all the code and check the syntax "by hand". Nobody will do that.

PostPosted: Mon Jun 03, 2013 15:10
by VanessaE
Aside from the fact that register_craft() doesn't use those "inventory_image" fields, you're missing commas after some of them. For that, you want register_craftitem(), which works like an abridged version of register_node(). You must register the items themselves (which is how you assign them textures, names, etc) separately from the craft recipes used to make them.

See: https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1609

and: https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1790

PostPosted: Mon Jun 03, 2013 18:45
by Yuser
Okay, that first post is no longer relevant, I changed a whole lot, but the debug keeps pointing to something that doesn't exist. What encoding should the file have? I tried ANSI and Unicode.

PostPosted: Mon Jun 03, 2013 19:28
by Nore
Remove those inventory_image things, they bug the mod because there are no , after them... Moreover, they are useless in register_craft. You can also use remove the empty columns in register_craft so that shifting the recipe one slot right will still work.

PostPosted: Mon Jun 03, 2013 20:12
by Yuser
Yuser wrote:Okay, that first post is no longer relevant, I changed a whole lot, but the debug keeps pointing to something that doesn't exist. What encoding should the file have? I tried ANSI and Unicode.


In other words the first code posted doesn't exist anymore. I'm asking about file encoding. Depending on the encoding it says near' ' or near '(upside down u)' or near '}'. The code doesn't have any of that.

PostPosted: Mon Jun 03, 2013 20:17
by tinoesroho
... I don't know. Windows or Linux?

PostPosted: Mon Jun 03, 2013 20:19
by BlockMen
Yuser wrote:Okay, that first post is no longer relevant, I changed a whole lot, but the debug keeps pointing to something that doesn't exist. What encoding should the file have? I tried ANSI and Unicode.


If you are using notepad under windows ANSI ;)

PostPosted: Tue Jun 04, 2013 20:10
by Yuser
Thank you, blockmen. I redid the whole thing, the same as last time in ANSI again, but this time it worked and I have all of the craft items in. Now I need to do the entity part, which is very confusing to me haha.
right now I have

minetest.register_entity("helicopter:Y1_flying", {
stuff that goes here
})

and it can't find the } for whatever reason. I fixed the other problem.

PostPosted: Tue Jun 04, 2013 21:30
by kaeza
Yuser wrote:Thank you, blockmen. I redid the whole thing, the same as last time in ANSI again, but this time it worked and I have all of the craft items in. Now I need to do the entity part, which is very confusing to me haha.
right now I have

minetest.register_entity("helicopter:Y1_flying", {
stuff that goes here
})

and it can't find the } for whatever reason. I fixed the other problem.

Well, if you don't post actual code, it's hard to debug those problems.

PostPosted: Wed Jun 05, 2013 14:11
by Yuser
minetest.register_entity("helicopter:Y1_flying", {
on_step(self, dtime)
self.getpos()
on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
puncher:get_inventory():add_item("helicopter_Y1")
})

I don't think that code is right but I'm not planning on running it yet, I want it to recognize the } first.