Arcelmi
Member
Posts: 68 Joined: Mon Dec 28, 2015 16:24
GitHub:
Arcelmi
IRC: Arcelmi
In-game: Arcelmi
Location: Germany
by Arcelmi » Thu Sep 14, 2017 13:09
Post
Description:
This mod adds callbacks when a player press, hold or release a button.
Download Information:
Latest version: 1.0
Download
GitHub
License: GNU Lesser General Public License v2.1
API:
Spoiler Syntax:
Code: Select all
controls.register_on_press(function(player, key))
Description:
Register a callback to be called when a player press a key or mousebutton.
player - ObjectRef
key - string (can be "jump", "right", "left", "LMB", "RMB", "sneak", "aux1", "down" or "up")
Example:
Code: Select all
controls.register_on_press(function(player, key)
minetest.chat_send_all(player:get_player_name().." pressed the key "..key.."!")
end)
Spoiler Syntax:
Code: Select all
controls.register_on_hold(function(player, key, time))
Description:
Register a callback to be called when a player is holding a key or mousebutton.
player - ObjectRef
key - string (can be "jump", "right", "left", "LMB", "RMB", "sneak", "aux1", "down" or "up")
time - number (time from press the button)
Example:
Code: Select all
controls.register_on_hold(function(player, key, time)
minetest.chat_send_all(player:get_player_name().." is holding the key "..key.." for "..time.." seconds.")
end)
Spoiler Syntax:
Code: Select all
controls.register_on_release(function(player, key, time))
Description:
Register a callback to be called when a player release a key or mousebutton.
player - ObjectRef
key - string (can be "jump", "right", "left", "LMB", "RMB", "sneak", "aux1", "down" or "up")
time - number (time from press the button)
Example:
Code: Select all
controls.register_on_release(function(player, key, time)
minetest.chat_send_all(player:get_player_name().." released the key "..key.." after "..time.." seconds!")
end)
Last edited by
Arcelmi on Tue Dec 12, 2017 16:44, edited 1 time in total.
I don't speak very good English... |
My mods
I've got a signature!
Desour
Member
Posts: 1473 Joined: Thu Jun 19, 2014 19:49
GitHub:
Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
by Desour » Thu Sep 14, 2017 14:08
Post
I have already done something like this:
viewtopic.php?t=17780
Arcelmi
Member
Posts: 68 Joined: Mon Dec 28, 2015 16:24
GitHub:
Arcelmi
IRC: Arcelmi
In-game: Arcelmi
Location: Germany
by Arcelmi » Thu Sep 14, 2017 14:10
Post
Sorry I didn't see this...
Because I don't searched after something like this, because I wanted to update this with my bow mod.
I don't thought that somebody had make something like this.
I don't speak very good English... |
My mods
I've got a signature!
Arcelmi
Member
Posts: 68 Joined: Mon Dec 28, 2015 16:24
GitHub:
Arcelmi
IRC: Arcelmi
In-game: Arcelmi
Location: Germany
by Arcelmi » Thu Sep 14, 2017 14:14
Post
Does your mod also handle key releases? I didn't see anything like this in your code.
I don't speak very good English... |
My mods
I've got a signature!
Desour
Member
Posts: 1473 Joined: Thu Jun 19, 2014 19:49
GitHub:
Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
by Desour » Thu Sep 14, 2017 14:55
Post
Arcelmi wrote: Does your mod also handle key releases? I didn't see anything like this in your code.
I think, I forgot that.
azekill_DIABLO
Member
Posts: 7507 Joined: Wed Oct 29, 2014 20:05
GitHub:
azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:
by azekill_DIABLO » Thu Sep 14, 2017 15:51
Post
it was CSM, this one is server side: a big improvement
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
Desour
Member
Posts: 1473 Joined: Thu Jun 19, 2014 19:49
GitHub:
Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
by Desour » Thu Sep 14, 2017 16:29
Post
azekill_DIABLO wrote:
it was CSM, this one is server side: a big improvement
No, it was (and is) both.
azekill_DIABLO
Member
Posts: 7507 Joined: Wed Oct 29, 2014 20:05
GitHub:
azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:
by azekill_DIABLO » Thu Sep 14, 2017 16:49
Post
okay. sorry. didn't senn it. need engine improvmements!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
Wuzzy
Member
Posts: 4804 Joined: Mon Sep 24, 2012 15:01
GitHub:
Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:
by Wuzzy » Mon Nov 06, 2017 15:10
Post
Care to suggest to include this functionality into core Minetest, or at least builtin?
azekill_DIABLO
Member
Posts: 7507 Joined: Wed Oct 29, 2014 20:05
GitHub:
azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:
by azekill_DIABLO » Mon Nov 06, 2017 15:45
Post
Wuzzy wrote: include this functionality into core
Including a functionnality in the core... What it's possible?
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
Desour
Member
Posts: 1473 Joined: Thu Jun 19, 2014 19:49
GitHub:
Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
by Desour » Mon Nov 06, 2017 17:40
Post
azekill_DIABLO wrote: Wuzzy wrote: include this functionality into core
Including a functionnality in the core... What it's possible?
Minetest has some builtin lua stuff, someone could add this mod's functionality there as helper and make a pull request to the minetest github repository.
azekill_DIABLO
Member
Posts: 7507 Joined: Wed Oct 29, 2014 20:05
GitHub:
azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:
by azekill_DIABLO » Mon Nov 06, 2017 17:42
Post
was ironic :D a builtin function would be simpler normally... but idk about the server connection... with builtin lua...
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
Arcelmi
Member
Posts: 68 Joined: Mon Dec 28, 2015 16:24
GitHub:
Arcelmi
IRC: Arcelmi
In-game: Arcelmi
Location: Germany
by Arcelmi » Tue Dec 12, 2017 16:44
Post
License changed to GNU Lesser General Public License v2.1
I don't speak very good English... |
My mods
I've got a signature!
TechNolaByte
Member
Posts: 465 Joined: Wed May 10, 2017 21:00
GitHub:
TechNolaByte
by TechNolaByte » Tue Jan 16, 2018 18:02
Post
wow this will save me a lot of time with an ultimate armor suit which has tons of special ability's which each need key binds
The great quest of alchemy neither failed nor attained gold; programmers are those great alchemists who transmute caffeine into code.
texmex
Member
Posts: 1753 Joined: Mon Jul 11, 2016 21:08
GitHub:
tacotexmex
In-game: tacotexmex
by texmex » Wed May 22, 2019 08:48
Post
I need to check multiple keys at the same time. For instance, I want to check that Aux and Up is pressed at the same time while at the same time checking that no other keys are being pressed. How?
Can key be returned as a table instead? (key.up, key.sneak and so on)
Lone_Wolf
Member
Posts: 2578 Joined: Sun Apr 09, 2017 05:50
GitHub:
LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan
by Lone_Wolf » Tue May 28, 2019 22:05
Post
Didn't realize there was a forums topic. Great mod!
May I suggest you add this mod to the
Minetest ContentDB ?
texmex
Member
Posts: 1753 Joined: Mon Jul 11, 2016 21:08
GitHub:
tacotexmex
In-game: tacotexmex
by texmex » Wed May 29, 2019 04:02
Post
keyevent mod is superior atm tbh.
Lone_Wolf
Member
Posts: 2578 Joined: Sun Apr 09, 2017 05:50
GitHub:
LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan
by Lone_Wolf » Wed May 29, 2019 04:44
Post
texmex wrote: keyevent mod is superior atm tbh.
This mod was perfect for what I needed at the time. And it had been so long since I had seen the keyevent mod that I had forgotten it existed. Didn't help that it was in the CSM section (
with no bold red letters saying it also doubled as a mod )
Joseph16
Member
Posts: 310 Joined: Tue Dec 06, 2016 05:35
In-game: smb3
by Joseph16 » Thu May 30, 2019 12:58
Post
How do I use this? I installed it and tried to use the key release thing but I couldn't get it to work. Please explain how this mod works.
Testin' mines since 1989
u18398
by u18398 » Thu May 30, 2019 13:55
Post
Joseph13 wrote: How do I use this? I installed it and tried to use the key release thing but I couldn't get it to work. Please explain how this mod works.
This is an api. please ask google what an api is.
This mod is totally useless if you do not write mods for yourself
and you need to check for pressed keys in your mod.
Joseph16
Member
Posts: 310 Joined: Tue Dec 06, 2016 05:35
In-game: smb3
by Joseph16 » Fri May 31, 2019 15:41
Post
I know what an api is. I'm making my own mods. What I'm asking is how to I use it with a mod? I installed the mod and enabled it, but whenever I tried to use the mod's functions it does not work.
Testin' mines since 1989
texmex
Member
Posts: 1753 Joined: Mon Jul 11, 2016 21:08
GitHub:
tacotexmex
In-game: tacotexmex
by texmex » Fri May 31, 2019 17:10
Post
Use
keyevent mod instead, it’s better. I can show you how to use that.
Lone_Wolf
Member
Posts: 2578 Joined: Sun Apr 09, 2017 05:50
GitHub:
LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan
by Lone_Wolf » Tue Jun 11, 2019 14:08
Post
texmex wrote: Use
keyevent mod instead, it’s better. I can show you how to use that.
I don't see any
register_on_release() or
register_on_hold() functions in that mod. I'm sticking with this one...
texmex
Member
Posts: 1753 Joined: Mon Jul 11, 2016 21:08
GitHub:
tacotexmex
In-game: tacotexmex
by texmex » Tue Jun 11, 2019 14:45
Post
You may get the same functionality by checking old_keys.
Lone_Wolf
Member
Posts: 2578 Joined: Sun Apr 09, 2017 05:50
GitHub:
LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan
by Lone_Wolf » Tue Jun 11, 2019 15:10
Post
texmex wrote: You may get the same functionality by checking old_keys.
Is that just the state of the keys on the last check? If so that won't work for me without some extra modding I would rather not do
Users browsing this forum: No registered users and 33 guests