Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Add click input for clicking event

Open Blueyescat opened this issue 7 years ago • 23 comments

Example:

on click:
    if click type is left:
    else if click type is right mouse button:

Click types should be the same with click action in english.lang:

left: left mouse button, left mouse, LMB

right: right mouse button, right mouse, RMB

I thought about other click types but they aren't useful in Skript.

Blueyescat avatar Oct 02 '17 17:10 Blueyescat

So you just mean being able to check what type of click was made in a generic non-inventory click event? That'd make sense. I assume this isn't already possible since I've never seen the code for it.

TheBentoBox avatar Oct 02 '17 17:10 TheBentoBox

Welp, this is a kind of duplicate of #87 which was closed without the real feature being implemented.

Snow-Pyon avatar Oct 02 '17 21:10 Snow-Pyon

This has been added already hasn't it?

TheLimeGlass avatar Mar 10 '18 13:03 TheLimeGlass

No 🙂

Blueyescat avatar Mar 10 '18 16:03 Blueyescat

https://github.com/bensku/Skript/pull/1142

TheLimeGlass avatar Apr 06 '18 20:04 TheLimeGlass

@TheLimeGlass not what he was talking about. He meant something like:

on click:

  if hand is left:
    # do stuff

Snow-Pyon avatar Apr 06 '18 21:04 Snow-Pyon

Why? Type as in Clicked type from the on inventory event. Clicked action is Inventory action in Skript. This was added already. It's either on right click or on left click. Having a left click is redundant because it's an attack event.

TheLimeGlass avatar Apr 06 '18 22:04 TheLimeGlass

Should never be called clicked type as that's already an existing syntax

TheLimeGlass avatar Apr 06 '18 22:04 TheLimeGlass

This should be closed

TheLimeGlass avatar Apr 06 '18 22:04 TheLimeGlass

What are you talking about lol, funny. It is click type, not click action. And click types and inventory actions aren't the same thing.

You can return a specified thing if the event is a specified event in the same expression, so the same syntax can be used. 🤦‍♀️

This suggestion means you can do

on click:
    if click type is left:
        #action1
    else if click type is right mouse button:
        #action2
    #action3

instead of creating two events and copying the same things:

on left click:
    #action1
    #action3

on right click:
    #action2
    #action3

You can left click on blocks or air, how it is an attack event. Also Skript already has support for using on click and on left click, not only on right click.

This is not about what hand is used. Literally mouse button.

Blueyescat avatar Apr 07 '18 10:04 Blueyescat

No click type is, Inventory, Click, Event! Don't use that syntax for this as they're NOT the same.

Again this is redundant because on left click should be a DAMAGE event and not used in this way. Skript even disables on left click so what's the point of having it!

TheLimeGlass avatar Apr 07 '18 14:04 TheLimeGlass

https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/ClickType.html

TheLimeGlass avatar Apr 07 '18 14:04 TheLimeGlass

k

Blueyescat avatar Apr 07 '18 14:04 Blueyescat

@TheLimeGlass please stop answering if you don't understand what's being requested on this enhancement.

Snow-Pyon avatar Apr 07 '18 16:04 Snow-Pyon

I do and I feel that it's a really stupid suggestion. First off if it was to be added it should be click

if click was left
if click was right
if click was middle

This is not a smart addition since left click event is not recommended and you can create unlimited event triggers. The only reason on leftclick is a valid syntax is so that Skript can notify the player to use proper events. If it didn't exist people would question why it's not a valid syntax.

on rightclick:
    stuff
on rightclick:
    more stuff
on damage of pig:
    stuff
on damage of pig:
    more stuff

wow

Also middle click can only be handled in creative. The client doesn't send any information when in survival so this request becomes pointless.

TheLimeGlass avatar Apr 07 '18 16:04 TheLimeGlass

@TheLimeGlass Good luck with detecting left clicking on blocks using the damage event.

Who talks about middle clicks in this request?

Blueyescat avatar Apr 07 '18 17:04 Blueyescat

on block damage...

I never use left click on block. I don't see a need in that...

TheLimeGlass avatar Apr 07 '18 17:04 TheLimeGlass

Go on detecting left clicking to air.

First, learn what is Skript, then try to close my issues. Nobody is going to use on block damage or on damage to detect left clicking to kill English.

Blueyescat avatar Apr 07 '18 17:04 Blueyescat

Feature request here has nothing to do with inventory click event. Suggested syntax is not good, but since this is not a pull request it doesn't really matter. Many issues don't suggest syntax at all, but still get implemented.

@TheLimeGlass If block damage is fired when you left click on bedrock, that is a bug. Same for other blocks that cannot be broken in survival. All blocks when the player is in adventure mode... And the case with air that was already brought up.

Block damage event does have its uses, but is not really a full replacement to left click event.

bensku avatar Apr 08 '18 09:04 bensku

So what syntax should be used to implement this feature? I thought about the hand expression but it is totally a different thing: PlayerInteractEvent.html#getHand and you wouldn't call the used mouse button as "hand". Hm, actually what about mouse button 👀 Also it can be a condition, too.

Blueyescat avatar Nov 05 '18 14:11 Blueyescat

Inventory click events already deal with different types of clicks. Maybe we could steal some ideas from there.

bensku avatar Nov 05 '18 17:11 bensku

close?

TheLimeGlass avatar Jan 31 '22 21:01 TheLimeGlass

I think this is a good idea.

fenziie avatar May 02 '24 05:05 fenziie