Command block clear hand command?

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

Command block clear hand command?

by mcfan » Tue Apr 01, 2014 19:41

Is there a command I can put into a command block to clear your hand so I could have a pressure plate you could step on to clear your hand?
Love MINECRAFT... will settle for Minetest
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Apr 01, 2014 22:32

/pulverize
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Tue Apr 01, 2014 23:03

That only pulverizes the item in your hand. I want one to pulverize your inventory.
Love MINECRAFT... will settle for Minetest
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Wed Apr 02, 2014 11:42

So is there no command for that? There is a button in the inventory+ mob that clears your hand and I wondered if that command could be used for a command block.
Love MINECRAFT... will settle for Minetest
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Wed Apr 02, 2014 12:23

You could create your own command.

P.S: There's a topic dedicated to modding questions.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Wed Apr 02, 2014 16:34

I'm terrible at creating commands though. I'm better at graphics and mod revision. Could you give me a idea of what I should do to make such a command?

...and I've posted on those before but no one ever answered. lol
Last edited by mcfan on Wed Apr 02, 2014 16:35, edited 1 time in total.
Love MINECRAFT... will settle for Minetest
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Wed Apr 02, 2014 16:43

Not everyone reads that topic.
It ruins the point of a forum, IMO.

Get an inventory: https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1429

The inventory table: https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1855

Set lists: https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1868

Maybe something like inv:set_lists(nil)
Last edited by rubenwardy on Wed Apr 02, 2014 16:44, edited 1 time in total.
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Wed Apr 02, 2014 20:09

 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Wed Apr 02, 2014 21:29

I know how to pulverize Casimir but I want a command that clears the whole inventory. Like the "clear" button in the inventory mod.
Love MINECRAFT... will settle for Minetest
 

User avatar
CraigyDavi
Member
 
Posts: 565
Joined: Sat Aug 10, 2013 13:08
GitHub: davisonio
IRC: davisonio or CraigyDavi
In-game: davisonio or CraigyDavi

by CraigyDavi » Wed Apr 02, 2014 21:48

Firstly you can create a chatcommand, this is a starter:
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("clearinv", {


Then when they type it it clears their inventory, you can use this code:
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
player:get_inventory():set_list("main", {})
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Thu Apr 03, 2014 01:45

Ok, trying it now.
Love MINECRAFT... will settle for Minetest
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Thu Apr 03, 2014 17:23

Didn't work. Posting the error soon.
Love MINECRAFT... will settle for Minetest
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Fri Apr 04, 2014 11:40

21:49:06: ERROR[main]: ========== ERROR FROM LUA ===========
21:49:06: ERROR[main]: Failed to load and run script from
21:49:06: ERROR[main]: /usr/share/minetest/builtin/builtin.lua:
21:49:06: ERROR[main]: /usr/share/minetest/builtin/chatcommands.lua:690: attempt to index global 'player' (a nil value)
21:49:06: ERROR[main]: stack traceback:
21:49:06: ERROR[main]: /usr/share/minetest/builtin/chatcommands.lua:690: in main chunk
21:49:06: ERROR[main]: [C]: in function 'dofile'
21:49:06: ERROR[main]: /usr/share/minetest/builtin/builtin.lua:23: in main chunk
21:49:06: ERROR[main]: =======END OF ERROR FROM LUA ========
Love MINECRAFT... will settle for Minetest
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Fri Apr 04, 2014 12:06

I think you need to replace "player" in the 2nd line with the player name of the person who typed it.

Such a command should be added to the default game, though; it's tedious to pulverize all your inventory by hand.
 

ronan_patrick
New member
 
Posts: 1
Joined: Fri Aug 08, 2014 20:56
In-game: ronan_patrick

Re: Command block clear hand command?

by ronan_patrick » Fri Aug 08, 2014 20:58

The command for clearing your entire inventory is "/clear".
In the command block, try "/clear @p"
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: Command block clear hand command?

by Evergreen » Fri Aug 08, 2014 21:42

ronan_patrick wrote:The command for clearing your entire inventory is "/clear".
In the command block, try "/clear @p"

eh, this is not minecraft. :P
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Command block clear hand command?

by Krock » Sat Aug 09, 2014 13:44

ronan_patrick wrote:The command for clearing your entire inventory is "/clear".
In the command block, try "/clear @p"

Soulation above, /pulverize
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
minermoder27
Member
 
Posts: 127
Joined: Wed Nov 20, 2013 23:24
GitHub: ZNixian
In-game: minermoder27

Re: Command block clear hand command?

by minermoder27 » Sat Jun 20, 2015 00:32

Untested, but here goes:

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
core.register_chatcommand("pulverizeall", {
   description = "Pulverize inventory",
   func = function(name, param)
      local player = core.get_player_by_name(name)
      player:get_inventory():set_list("main", {})
      return true, "An inventory was pulverized."
   end,
})
 


Return to WIP Mods

Who is online

Users browsing this forum: Google [Bot] and 5 guests

cron