Skript
Skript copied to clipboard
Add click input for clicking event
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.
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.
Welp, this is a kind of duplicate of #87 which was closed without the real feature being implemented.
This has been added already hasn't it?
No 🙂
https://github.com/bensku/Skript/pull/1142
@TheLimeGlass not what he was talking about. He meant something like:
on click:
if hand is left:
# do stuff
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.
Should never be called clicked type as that's already an existing syntax
This should be closed
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.
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!
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/ClickType.html
k
@TheLimeGlass please stop answering if you don't understand what's being requested on this enhancement.
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 Good luck with detecting left clicking on blocks using the damage event.
Who talks about middle clicks in this request?
on block damage
...
I never use left click on block. I don't see a need in that...
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.
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.
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.
Inventory click events already deal with different types of clicks. Maybe we could steal some ideas from there.
close?
I think this is a good idea.