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

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

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

by Arcelmi » 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
+ Spoiler
+ Spoiler
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: 1139
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

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

by DS-minetest » Post

I have already done something like this: viewtopic.php?t=17780
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

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

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

by Arcelmi » 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

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

by Arcelmi » 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!

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

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

by DS-minetest » 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.
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

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

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

by azekill_DIABLO » Post

DS-minetest wrote:I have already done something like this: viewtopic.php?t=17780
it was CSM, this one is server side: a big improvement

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

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

by DS-minetest » Post

azekill_DIABLO wrote:
DS-minetest wrote:I have already done something like this: viewtopic.php?t=17780
it was CSM, this one is server side: a big improvement
No, it was (and is) both.
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

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

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

by azekill_DIABLO » Post

okay. sorry. didn't senn it. need engine improvmements!

User avatar
Wuzzy
Member
Posts: 4057
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 » Post

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: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

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

by azekill_DIABLO » Post

Wuzzy wrote:include this functionality into core
Including a functionnality in the core... What it's possible?

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

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

by DS-minetest » 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.
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

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

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

by azekill_DIABLO » Post

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

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

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

by Arcelmi » 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!

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

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

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

try out my skytest mod always being updated!
viewtopic.php?f=9&t=17568

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

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

by texmex » 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)
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
Lone_Wolf
Member
Posts: 2371
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

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

by Lone_Wolf » Post

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: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

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

by texmex » Post

keyevent mod is superior atm tbh.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
Lone_Wolf
Member
Posts: 2371
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

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

by Lone_Wolf » 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)

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

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

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

by Gundul » 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.
My servers: Jungle, Lilly in the valley, 3xile

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

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

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

by texmex » Post

Use keyevent mod instead, it’s better. I can show you how to use that.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
Lone_Wolf
Member
Posts: 2371
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

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

by Lone_Wolf » 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...

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

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

by texmex » Post

You may get the same functionality by checking old_keys.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
Lone_Wolf
Member
Posts: 2371
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

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

by Lone_Wolf » 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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests