Page 1 of 1

Easiest way to find out the node name?

PostPosted: Sun Dec 08, 2013 22:43
by JMR
For barter shops Etc, you need to know the node name. If the tekkit mod isn't enabled, then I can't find a way to easily find the node name.

I know you can look inside the lua files, but that takes a while and if the mod isn't on your local machine then what?

Does anyone know an easy method to get a node's name?

PostPosted: Sun Dec 08, 2013 22:57
by Evergreen
JMR wrote:For barter shops Etc, you need to know the node name. If the tekkit mod isn't enabled, then I can't find a way to easily find the node name.

I know you can look inside the lua files, but that takes a while and if the mod isn't on your local machine then what?

Does anyone know an easy method to get a node's name?
None that I know of. There should be a command which gets the pointed block and prints the node name into the chat.

PostPosted: Mon Dec 09, 2013 01:57
by kaeza
There's also Dan Duncombe's currency mod which allows to edit the shop visually by dragging the items around instead of having to enter the item name.

PostPosted: Mon Dec 09, 2013 09:44
by Casimir
Evergreen wrote:There should be a command which gets the pointed block and prints the node name into the chat.

I wanted to do a mod like that some time ago, but the problem is, that there is no way I know of on how to get the pointed node. (Except punching.)

For items in the inventory take this.
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_chatcommand("getinfo_item", {
    params = "",
    description = "name of item in hand",
    privs = {},
    func = function(name, param)
        local player = minetest.get_player_by_name(name)
        if player == nil then
            minetest.log("error", "Unable to get info, player is nil")
            return true -- Handled chat message
        end
        if player:get_wielded_item():is_empty() then
            minetest.chat_send_player(name, 'Unable to get info, no item in hand.')
        else
            local item_name = player:get_wielded_item():get_name()
            local item_count = player:get_wielded_item():get_count()
            local item_wear = player:get_wielded_item():get_wear()
            minetest.chat_send_player(name, 'get info: name = '.. item_name ..', count = '.. item_count ..', wear = '.. item_wear ..'')
        end
    end,
})

PostPosted: Mon Dec 09, 2013 15:33
by Krock
Or add an item, which is pointable to everything, could easily work with: on_use = { send nodename to player }

PostPosted: Mon Dec 09, 2013 16:15
by Evergreen
Krock wrote:Or add an item, which is pointable to everything, could easily work with: on_use = { send nodename to player }
Someone already made a mod that has a tool which gets the node name, but I was thinking of a command. I think there should be some sort of minetest.get_pointed_thing()