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

Getting a uuid of a var inside code #837

Closed
GrimEpp opened this issue Sep 2, 2017 · 9 comments
Closed

Getting a uuid of a var inside code #837

GrimEpp opened this issue Sep 2, 2017 · 9 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@GrimEpp
Copy link

GrimEpp commented Sep 2, 2017

Screenshot from Gyazo

This bug occurs when you try to get add a number to a var with a uuid in a function

@Blueyescat
Copy link
Contributor

Blueyescat commented Sep 2, 2017

✅ confirmed with 1.12.1 PaperSpigot + Skript dev29:

Can use this: send "%{_%player's uuid%}%"
But can't use this: send "%{_%{_p}'s uuid%}%"

@bensku bensku added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Sep 4, 2017
@jaylawl
Copy link
Contributor

jaylawl commented Sep 6, 2017

Confirming for dev31 / paper 1.12

set {jaygolf_temp::%{_player}'s uuid%} to {_latest_hole}

https://snag.gy/MQ9GxU.jpg

however this
set {_latest_hole} to {jaygolf_temp::%command sender's uuid%}
called in a different script works and doesnt generate errors

@Snow-Pyon Snow-Pyon added the priority: low Issues that are not harmful to the experience but are related to useful changes or additions. label Jan 31, 2018
@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Jul 5, 2018

The problem is that the Player ClassInfo parser changes the player/offlineplayer input to a String because of the configuration option where you can change players into their String uuid's. This causes every expression with a player being used in the variable to be seen as a String, and that would then cause it to not be understood.

To fix set the option to true as it's intended and just use player in the variables. It only changes the VariableString when used in variables, not basic expressions.

if (SkriptConfig.usePlayerUUIDsInVariableNames.value())

if (SkriptConfig.usePlayerUUIDsInVariableNames.value())

Njol adding this addition: dcb94b4

@Matocolotoe
Copy link
Contributor

Pretty much happens on every expression that uses a local variable

@andrei923
Copy link

Still persists

@TheBentoBox
Copy link
Member

Not sure if the priority can be escalated but I can confirm that this is really annoying. Basically any time you want to pass players into a function and get their UUID you have to break it up into multiple lines because of this exact bug.

@Runakai1
Copy link

This has been a bug for almost three years now. It's a really annoying bug. Is anything planned to fix this?

@FranKusmiruk
Copy link
Member

@Runakai1 parser bugs like this are hard to spot, hence why we didn't fix it yet. After we release the next alpha I can take a look at it again and see what's up with this for once and all.

@TPGamesNL
Copy link
Member

Alright so I've had enough of this bug, so I decided to find the cause of it. Apparently, it's literally just SkriptParser line 271. If you change ((the )?var(iable)? )?\{([^{}]|%\{|\}%)+\} to ((the )?var(iable)? )?\{.+\} (replace [^{}]|%\{|\}% with .), it works just fine. I presume the reason this was added, so people wouldn't try using variables in variables like so: {var::{_p}}, but they should've only made it fail on any curly brackets which is not between a pair of %, not make it fail on any curly bracket which isn't directly next to a %.

I was going to PR this, but I thought it would be better to first ask if it's important to keep it failing on variables like {var::{_p}}. The easist way to fix this is by changing the regex, as said above, but because the regex is only used is in the parseVariable method from SkriptParser, a simple parser could be made in there to make sure there isn't any weird stuff going on.

@TPGamesNL TPGamesNL added the PR available Issues which have a yet-to-be merged PR resolving it label Mar 23, 2021
@TPGamesNL TPGamesNL added completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels Jun 10, 2021
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. completed The issue has been fully resolved and the change will be in the next Skript update. 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