Skip to main content

I will be streaming November first, 22:00 UTC.

Also watch on these platforms:

Chat commands let you do all sorts of things following player input. It can be something as simple as teleporting a player to a specific location, or it can be something extremely complex. Fortunately it is fairly simple to create a chat command, and all the function stuff works the exact same as a function you'd write for an ABM or nodetimer.

minetest.register_chatcommand('final', {
   description = 'The final chat command for this video tutorial.',
   params = "<player>,<code>,<time>",
   privs = {home=true},
   func = function(name, params)
      params = params:split(',')
      local player = params[1]
      local code = params[2] or 'No code entered'
      local time = params[3] or 30
      minetest.chat_send_player(name, 'inputted values are; '..player..' '..code..' '..time)
      if minetest.get_player_by_name(player) then
         minetest.after(time, function()
            minetest.chat_send_player(player, code)
         end)
      end
   end,
})