English addbind scroll?

7 replies
Goto Page
To the start Previous 1 Next To the start
14.08.18 07:55:23 pm
Up
Why this doesn't work?

Code:
1
2
3
4
5
6
7
8
9
addbind('mwheelup')
addhook("key","button_press")


function button_press(id,key,state)
    if key == 'mwheelup' then
        msg('success')
    end
end
14.08.18 09:19:32 pm
Up
Mujahid
User
Offline Off
the mwheelup function works for binds?
edited 1×, last 14.08.18 09:35:27 pm
السلام في سوريا
14.08.18 10:23:33 pm
Up
Edik
User
Offline Off
dont forget to ask the state:
Code:
1
2
3
4
5
6
addbind("mwheelup")
function button_press(id,key,state)
    if key == "mwheelup" and state == 0 then
        msg("success")
    end
end
edited 1×, last 14.08.18 10:35:02 pm
15.08.18 01:51:34 am
Up
Masea
Super User
Offline Off
@user Edik: And why is that?
Create and design your GUI easy and fast: file cs2d GUI Framework (12) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
15.08.18 04:58:19 am
Up
Cure Pikachu
User
Offline Off
I used this to debug:
Code:
1
2
3
4
5
6
7
addbind("mwheelup")
addbind("mwheeldown")

addhook("key","button_press")
function button_press(id,key,state)
     msg(key.." "..state)
end

With this you expect some output when you scroll, but nope, got nothing. And yes, the documentation considers them valid.
cs2d lua cmd addbind has written:
Valid key names:
...
• Mouse: "mouse1" (left click), "mouse2" (right click), "mouse3" (middle click), "mwheelup", "mwheeldown" (scrolling)
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
15.08.18 10:44:18 am
Up
@edik lol.

So is this a bug or wheel bind name got changed perhaps?
18.08.18 06:04:03 am
Up
SQ
Moderator
Offline Off
@user Quattro: It seems I didn't added it and documentation is incorrect.
Probably it's that.
edited 1×, last 18.08.18 06:16:51 am
19.08.18 03:36:33 pm
Up
@user SQ:
It seems I found a loophole haha
To the start Previous 1 Next To the start