[MOD] Callback API for key and mousebutton[1.0][controls]

User avatar
Arcelmi
Member
 
Posts: 68
Joined: Mon Dec 28, 2015 16:24
Location: Germany
GitHub: Arcelmi
IRC: Arcelmi
In-game: Arcelmi

[MOD] Callback API for key and mousebutton[1.0][controls]

by Arcelmi » Thu Sep 14, 2017 13:09

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:


+ controls.register_on_press


+ controls.register_on_hold


+ controls.register_on_release
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!
 

User avatar
DS-minetest
Member
 
Posts: 1116
Joined: Thu Jun 19, 2014 19:49
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
GitHub: DS-Minetest
In-game: DS

Re: [MOD] Callback API for key and mousebutton[controls][1.0

by DS-minetest » Thu Sep 14, 2017 14:08

I have already done something like this: https://forum.minetest.net/viewtopic.php?t=17780
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
Arcelmi
Member
 
Posts: 68
Joined: Mon Dec 28, 2015 16:24
Location: Germany
GitHub: Arcelmi
IRC: Arcelmi
In-game: Arcelmi

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Arcelmi » Thu Sep 14, 2017 14:10

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!
 

User avatar
Arcelmi
Member
 
Posts: 68
Joined: Mon Dec 28, 2015 16:24
Location: Germany
GitHub: Arcelmi
IRC: Arcelmi
In-game: Arcelmi

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Arcelmi » Thu Sep 14, 2017 14:14

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!
 

User avatar
DS-minetest
Member
 
Posts: 1116
Joined: Thu Jun 19, 2014 19:49
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
GitHub: DS-Minetest
In-game: DS

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by DS-minetest » Thu Sep 14, 2017 14:55

Arcelmi wrote:Does your mod also handle key releases? I didn't see anything like this in your code.

I think, I forgot that.
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7489
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
DS-minetest
Member
 
Posts: 1116
Joined: Thu Jun 19, 2014 19:49
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
GitHub: DS-Minetest
In-game: DS

Re: [MOD] Callback API for key and mousebutton[controls][1.0

by DS-minetest » Thu Sep 14, 2017 16:29

azekill_DIABLO wrote:
DS-minetest wrote:I have already done something like this: https://forum.minetest.net/viewtopic.php?t=17780

it was CSM, this one is server side: a big improvement

No, it was (and is) both.
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7489
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
Wuzzy
Member
 
Posts: 3625
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Wuzzy » Mon Nov 06, 2017 15:10

Care to suggest to include this functionality into core Minetest, or at least builtin?
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH
 

User avatar
azekill_DIABLO
Member
 
Posts: 7489
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by azekill_DIABLO » Mon Nov 06, 2017 15:45

Wuzzy wrote:include this functionality into core


Including a functionnality in the core... What it's possible?
 

User avatar
DS-minetest
Member
 
Posts: 1116
Joined: Thu Jun 19, 2014 19:49
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
GitHub: DS-Minetest
In-game: DS

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by DS-minetest » Mon Nov 06, 2017 17:40

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.
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7489
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by azekill_DIABLO » Mon Nov 06, 2017 17:42

was ironic :D a builtin function would be simpler normally... but idk about the server connection... with builtin lua...
 

User avatar
Arcelmi
Member
 
Posts: 68
Joined: Mon Dec 28, 2015 16:24
Location: Germany
GitHub: Arcelmi
IRC: Arcelmi
In-game: Arcelmi

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Arcelmi » Tue Dec 12, 2017 16:44

License changed to GNU Lesser General Public License v2.1
I don't speak very good English... | My mods

I've got a signature!
 

User avatar
RSLRedstonier
Member
 
Posts: 451
Joined: Wed May 10, 2017 21:00
Location: some were in middle earth
GitHub: RSL-Redstonier
In-game: RSLRedstonier

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by RSLRedstonier » Tue Jan 16, 2018 18:02

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
"A programmer is just a tool which converts caffeine into code"

try out my skytest mod always being updated!
https://forum.minetest.net/viewtopic.php?f=9&t=17568
 

User avatar
texmex
Member
 
Posts: 1588
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by texmex » Wed May 22, 2019 08:48

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)
 

User avatar
Lone_Wolf
Member
 
Posts: 2197
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Lone_Wolf » Tue May 28, 2019 22:05

Didn't realize there was a forums topic. Great mod!
May I suggest you add this mod to the Minetest ContentDB?
 

User avatar
texmex
Member
 
Posts: 1588
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

User avatar
Lone_Wolf
Member
 
Posts: 2197
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Lone_Wolf » Wed May 29, 2019 04:44

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)
 

User avatar
Joseph16
Member
 
Posts: 308
Joined: Tue Dec 06, 2016 05:35
In-game: Joseph16

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Joseph16 » Thu May 30, 2019 12:58

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
 

Gundul
Member
 
Posts: 592
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Gundul » Thu May 30, 2019 13:55

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.
My servers: Jungle, Lilly in the valley, ZombieTest
 

User avatar
Joseph16
Member
 
Posts: 308
Joined: Tue Dec 06, 2016 05:35
In-game: Joseph16

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Joseph16 » Fri May 31, 2019 15:41

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
 

User avatar
texmex
Member
 
Posts: 1588
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

User avatar
Lone_Wolf
Member
 
Posts: 2197
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Lone_Wolf » Tue Jun 11, 2019 14:08

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...
 

User avatar
texmex
Member
 
Posts: 1588
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

User avatar
Lone_Wolf
Member
 
Posts: 2197
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf

Re: [MOD] Callback API for key and mousebutton[1.0][controls

by Lone_Wolf » Tue Jun 11, 2019 15:10

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
 


Return to WIP Mods



Who is online

Users browsing this forum: MSN [Bot] and 10 guests