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

Escaping when parsing #3013

Closed
Runakai1 opened this issue May 27, 2020 · 10 comments
Closed

Escaping when parsing #3013

Runakai1 opened this issue May 27, 2020 · 10 comments
Labels
completed The issue has been fully resolved and the change will be in the next Skript update.

Comments

@Runakai1
Copy link

Runakai1 commented May 27, 2020

I am not entirely sure if this is an user error or something with skript.
Skript version: 2.5 alpha3
Mc: Paper 1.15.2

excaping | and () while parsing works and throws no error. The list is returning none, display name when debugging returns the correct name

Code:

command spawnentity:
	trigger:
		spawn a pig at player
		set display name of last spawned entity to "&b(&c&l!&b) &7[&6Level&7] &7| &c999"
	
command parse:
	trigger:
		set {_list::*} to display name of target parsed as "&b\(&c&l!&b\) &7[&6Level&7] &7\| &c%integer%"
		send "%{_list::*}%"
@Pikachu920
Copy link
Member

you have to escape the (, |, [ and ] as they have special meaning in skript patterns which is what you're making via the parse expr. is that what you are reporting? i'm a little confused

@Runakai1
Copy link
Author

Runakai1 commented May 27, 2020

I am just bad at formatting my code correctly on github.. I am escaping ( and | as the error told me when i wasnt escaping it but the list is returning none. It didn't say to escape [ and parsed without errors

@TPGamesNL
Copy link
Member

It's probably because the & characters aren't converted in syntax strings from the parse expression.

@Runakai1
Copy link
Author

Runakai1 commented May 27, 2020

It's probably because the & characters aren't converted in syntax strings from the parse expression.

I removed the color codes and it is still returning none

command spawnentity:
	trigger:
		spawn a pig at player
		set display name of last spawned entity to "(!) [Level] | 999"
	
command parse:
	trigger:
		set {_list::*} to display name of target parsed as "\(!\) [Level] \| %integer%"
		send "%{_list::*}%"

@bluelhf
Copy link
Contributor

bluelhf commented May 28, 2020

Does (display name of target) parsed as "\(!\) \[Level\] \| %integer%" work?

@Runakai1
Copy link
Author

Does (display name of target) parsed as "\(!\) \[Level\] \| %integer%" work?

It does. Maybe adding a warning to escape [ and ] would be handy

@FranKusmiruk
Copy link
Member

Could you check whether the parse error expression shows that information?

@Runakai1
Copy link
Author

Could you check whether the parse error expression shows that information?

I hope I used it correctly. I Used the code without escaping [ ] and with escaping it. Both didn't return anything however escaping [ and ] resulted in correct parsing as stated previously

command parse:
	trigger:
		set {_list::*} to (display name of target) parsed as "\(!\) [Level] \| %integer%"
		send "%{_list::*}%"
		send "%parse error%"

@Runakai1
Copy link
Author

Runakai1 commented Jul 7, 2020

Is this being worked on?

@TPGamesNL
Copy link
Member

TPGamesNL commented Feb 20, 2021

You wouldn't really be able to add a warning for this, since the syntax \(!\) [Level] \| %integer% is valid, [] denoting an optional group.
For the colour codes, it could be an idea to first convert colour codes in the syntax string, before using it.

@TPGamesNL TPGamesNL added the PR available Issues which have a yet-to-be merged PR resolving it label Mar 29, 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 Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed The issue has been fully resolved and the change will be in the next Skript update.
Projects
None yet
Development

No branches or pull requests

6 participants