Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaw/Pitch of location does not work if the location is in a variable #2708

Closed
ghost opened this issue Dec 19, 2019 · 10 comments
Closed

Yaw/Pitch of location does not work if the location is in a variable #2708

ghost opened this issue Dec 19, 2019 · 10 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@ghost
Copy link

ghost commented Dec 19, 2019

Description

Yaw/Pitch of location does not work if the location is in a variable

Steps to Reproduce

set {_loc} to location of player
send "%pitch of {_loc}% %yaw of {_loc}%"
all none ^

Expected Behavior

Expected to give same result as %yaw of player% does

Errors / Screenshots

no errors

Server Information

  • Server version/platform: 1.12.2 Paper
  • Skript version: 2.4
@Wealthyturtle
Copy link
Member

Wealthyturtle commented Dec 19, 2019

That's not your problem, your problem is that the location of player does not come with yaw/pitch. If you do...

set {_loc} to location of player
set {_loc}'s yaw to player's yaw
set {_loc}'s pitch to player's pitch
send "%pitch of {_loc}% %yaw of {_loc}%"

Then it should not return <none>. I believe this is done for optimization purposes (?) since not many people use yaw/pitch anyways.

@ghost
Copy link
Author

ghost commented Dec 19, 2019

That's not your problem, your problem is that the location of player does not come with yaw/pitch. If you do...

set {_loc} to location of player
set {_loc}'s yaw to player's yaw
set {_loc}'s pitch to player's pitch
send "%pitch of {_loc}% %yaw of {_loc}%"

Then it should not return <none>. I believe this is done for optimization purposes (?) since not many people use yaw/pitch anyways.

it still returns none and in older version of Skript it worked right

@Wealthyturtle Wealthyturtle added the needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls. label Dec 19, 2019
@Wealthyturtle
Copy link
Member

Can replicate, my bad. Setting a location's yaw/pitch does not work

@Wealthyturtle Wealthyturtle added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: low Issues that are not harmful to the experience but are related to useful changes or additions. and removed needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls. labels Dec 22, 2019
@nopeless
Copy link

nopeless commented Dec 30, 2019

can we increase priority @Wealthyturtle ?
set {a} to location(0, 100 ,0, ("world" parsed as world), 0, 0)
this does not save the pitch as well

well i used an explicit function instead of deriving the location from the player so that means there is no way of teleporting an entity with specific yaw and pitch

@jaylawl
Copy link
Contributor

jaylawl commented Jan 1, 2020

encountered this exact issue on paper 1.14.4 / spigot 2.4 just last night

@jaylawl
Copy link
Contributor

jaylawl commented Jan 1, 2020

command /loc:
    trigger:
    
        command sender != console
        
        set {_l} to location(0, 0, 0, (command sender's world))
        set {_l}'s yaw to 180
        set {_l}'s pitch to -45
        
        send "yaw: %{_l}'s yaw%, pitch: %{_l}'s pitch%"
        
        {_l}.setYaw(180)
        {_l}.setPitch(-45)
        
        send "yaw: %{_l}'s yaw%, pitch: %{_l}'s pitch%"
        
        send "yaw: %{_l}.getYaw()%, pitch: %{_l}.getPitch()%"

Extracting the yaw & pitch via skript-mirror works correctly (last line of the code)
This is also on paper 1.14.4 / skript 2.4

@ghost
Copy link
Author

ghost commented Feb 19, 2020

to avoid the need of changing your scripts to use skript-mirror code, I have made a replacement for broken vanilla Skript syntaxes:

#Yaw, is broken in Skript 2.4
expression:
	patterns:
		[the] yaw of %location%
		%location%'s yaw
	return type: number
	get:
		return expression 1.getYaw()
	set:
		expression 1.setYaw(change value)
	remove:
		expression 1.setYaw(expression 1.getYaw() - change value)
	add:
		expression 1.setYaw(expression 1.getYaw() + change value)

#Pitch, is broken in Skript 2.4
expression:
	patterns:
		[the] pitch of %location%
		%location%'s pitch
	return type: number
	get:
		return expression 1.getPitch()
	set:
		expression 1.setPitch(change value)
	remove:
		expression 1.setPitch(expression 1.getPitch() - change value)
	add:
		expression 1.setPitch(expression 1.getPitch() + change value)

@ShaneBeee
Copy link
Contributor

Can this be rechecked?

I just did some testing and it seems to work.

example code:

command /test:
    trigger:
        set {_l} to location(1, 1, 1, world "world", 11, 12)
        send "Y: %yaw of {_l}%"
        send "P: %pitch of {_l}%"
        set yaw of {_l} to 10
        set pitch of {_l} to -45
        send "Y: %yaw of {_l}%"
        send "P: %pitch of {_l}%"

output:

> test
[14:54:36 INFO]: Y: 11
[14:54:36 INFO]: P: 12
[14:54:36 INFO]: Y: 10
[14:54:36 INFO]: P: -45

@Wealthyturtle
Copy link
Member

Can this be rechecked?

I just did some testing and it seems to work.

example code:

command /test:
    trigger:
        set {_l} to location(1, 1, 1, world "world", 11, 12)
        send "Y: %yaw of {_l}%"
        send "P: %pitch of {_l}%"
        set yaw of {_l} to 10
        set pitch of {_l} to -45
        send "Y: %yaw of {_l}%"
        send "P: %pitch of {_l}%"

output:

> test
[14:54:36 INFO]: Y: 11
[14:54:36 INFO]: P: 12
[14:54:36 INFO]: Y: 10
[14:54:36 INFO]: P: -45

Try

set {_loc} to location of player
set {_loc}'s yaw to player's yaw
set {_loc}'s pitch to player's pitch
send "%pitch of {_loc}% %yaw of {_loc}%"

@ghost
Copy link
Author

ghost commented Sep 21, 2020

I just tested, I cannot reproduce this bug anymore on 2.5beta4, so it's fixed, yay! closing

@ghost ghost closed this as completed Sep 21, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.
Projects
None yet
Development

No branches or pull requests

4 participants