#(RextheOreo) Trying to make a command occur when right clicking any direction.

1 messages · Page 1 of 1 (latest)

spark canyon
#

https://paste.denizenscript.com/View/107806
To be more specific, the event is when the player right clicks anything. However, I don't want the rest of the command triggering when the player isn't looking at a mob. I tried experimenting with the <player.can_see[*].if_null[false]> tag but that didn't work. Mind you, everything else in the script works, but I'm trying to refine it where it doesn't just trigger any time the player right clicks anything. I only want it to trigger when the player right clicks when looking at an entity.

sinful pendantBOT
#

(RextheOreo) Trying to make a command occur when the player sees an entity.

sinful pendantBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

visual moat
#

i

#

think you're overcomplicating this

#

!t entitytag.target

orchid falconBOT
visual moat
#

^this is probably the tag you actually want

#

or uhh

#

!t playertag.target

orchid falconBOT
visual moat
#

same deal lol

spark canyon
#

Hmm, how would I write this? cuz this only returns the entity the player is looking at. Is it truly as simple as - if <player.target.if_null[false]>: ?

plain lanternBOT
visual moat
#

you'd use .exists here

#

but otherwise ye

spark canyon
#

So, - if <player.target.exists>:?

visual moat
#

Sure

spark canyon
#

yup, this works. Thank you.

dim boltBOT
#
Resolved

Thread closed as resolved.

spark canyon
#

wait

dim boltBOT
#
Thread Reopened

Thread was manually reopened by @spark canyon.

spark canyon
#

This works, but I got another question that's related on this script

#

So, I got that working for when the player is looking at an entity, but how do I get if a player looks at a block? Cuz I've tried using @TargetBlock through MythicMobs but that only really applies for whatever block I actually click on. I want the script to trigger when the player just right clicks in general.

#

I'll post what I got for this other half of the script

#

(RextheOreo) Trying to make a command occur when right clicking anything.

#

(RextheOreo) Trying to make a command occur when right clicking any direction.

visual moat
#

!t cursor_on

orchid falconBOT
# visual moat !t cursor_on
Cannot Specify Searched Tag

Multiple possible tags: <EntityTag.cursor_on[(<range>)]>, <EntityTag.cursor_on_solid[(<range>)]>, <LocationTag.precise_cursor_on[(<range>)]>, <LocationTag.precise_cursor_on_block[(<range>)]>.

visual moat
#

err sorry

#

!t locationtag.ray

orchid falconBOT
# visual moat !t locationtag.ray
Cannot Specify Searched Tag

Multiple possible tags: <LocationTag.ray_trace[(range=<#.#>/{200});(return=<{precise}/block/normal>);(default=<{null}/air>);(fluids=<true/{false}>);(nonsolids=<true/{false}>);(entities=<matcher>);(ignore=<entity>|...);(raysize=<#.#>/{0})]>, <LocationTag.ray_trace[(range=<#.#>/{200});(return=<{precise}/block/normal>);(default=<{null}/air>);(fluids=<true/{false}>);(nonsolids=<true/{false}>);(entities=<matcher>);(ignore=<entity>|...);(raysize=<#.#>/{0})]>.

visual moat
#

.>

#

!t <LocationTag.ray_trace[(range=<#.#>/{200});(return=<{precise}/block/normal>);(default=<{null}/air>);(fluids=<true/{false}>);(nonsolids=<true/{false}>);(entities=<matcher>);(ignore=<entity>|...);(raysize=<#.#>/{0})]>

orchid falconBOT
# visual moat !t <LocationTag.ray_trace[(range=<#.#>/{200});(return=<{precise}/block/normal>);...

Traces a line from this location, in the direction its facing, towards whatever block it hits first, and returns the location of where it hit.
This tag has also been referred to as 'cursor_on' or 'precise_cursor_on' in the past.
Using 'return=normal' instead replaces the old 'precise_impact_normal' tag.
Optionally specify:
range: (defaults to 200) a maximum distance (in blocks) to trace before giving up.
return: (defaults to precise)
specify "precise" to return the exact location of the hit ...

Group

world

Returns

LocationTag

Examples
# Destroys whatever solid block the player is looking at.
- define target <player.eye_location.ray_trace[return=block]||null>
- if <[target]> != null:
    - modifyblock <[target]> air
# Spawns a heart wherever the player is looking, no more than 5 blocks away.
- playeffect effect:heart offset:0 at:<player.eye_location.ray_trace[range=5;entities=*;ignore=<player>;fluids=true;nonsolids=true;default=air]>

and more... Check the website for more examples

spark canyon
#

I think I typed this wrong?

#

I got it now