Skip to content

Passing formatted item name as argument in function #8824

Description

@MrMarshOfficial

Skript/Server Version

[12:35:04 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[12:35:04 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[12:35:04 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[12:35:04 INFO]: [Skript] Server Version: 26.1.2-74-e4e17fc (MC: 26.1.2)
[12:35:04 INFO]: [Skript] Skript Version: 2.16.1 (skriptlang-github)
[12:35:04 INFO]: [Skript] Installed Skript Addons: 
[12:35:04 INFO]: [Skript]  - skript-placeholders v1.7.1 (https://github.com/APickledWalrus/skript-placeholders)
[12:35:04 INFO]: [Skript]  - DiSky v4.29.0
[12:35:04 INFO]: [Skript]  - skript-reflect v2.6.3 (https://github.com/SkriptLang/skript-reflect)
[12:35:04 INFO]: [Skript]  - Lusk v1.3.14 (https://github.com/JakeGBLP/Lusk)
[12:35:04 INFO]: [Skript]  - SkBee v3.25.3 (https://github.com/ShaneBeee/SkBee)
[12:35:04 INFO]: [Skript]  - Skonic v1.2.8
[12:35:04 INFO]: [Skript] Installed dependencies: 
[12:35:04 INFO]: [Skript]  - Vault v1.7.3-b131
[12:35:04 INFO]: [Skript]  - WorldGuard v7.0.17+2370-e42d8bc
[12:35:04 INFO]: [Skript]  - GriefPrevention v16.18.7
/

Bug Description

Passing formatted item names in functions makes it so the passed text can't be checked correctly anymore.

In the following code, with an item named "&bTest", only "yes 1" will run. "yes 2" won't:

command /test:
trigger:
send player's held item
if player's held item's name = "&bTest":
send "&ayes 1"

	test(player's held item's name)

function test(name: text):
broadcast {_name}

if {_name} = "&bTest":
	broadcast "&ayes 2"

When removing "&b" in the code and in-game item's name, it works correctly.

Expected Behavior

The item name should also be able to be found correctly inside the function since they both match.

Steps to Reproduce

Pass a formatted item name in a function and check the name outside and inside the function.

The following code can be used:

command /test:
trigger:
send player's held item
if player's held item's name = "&bTest":
send "&ayes 1"

	test(player's held item's name)

function test(name: text):
broadcast {_name}

if {_name} = "&bTest":
	broadcast "&ayes 2"

Errors or Screenshots

Image

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugAn issue that needs to be fixed. Alternatively, a PR fixing an issue.priority: mediumIssues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).

Type

No type

Fields

Priority

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions