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

Make message and broadcast effects accept objects #3951

Merged

Conversation

TPGamesNL
Copy link
Member

Description

Makes EffMessage and EffBroadcast accept objects to broadcast, instead of just strings.
Also makes it so the effects don't call any of the expressions getters multiple times (which is what the ugly code at the start of the second loop in EffMessage#execute is for):

function doStuff() :: text:
	broadcast "func called"
	return "test"

command /test:
	trigger:
		add sender to {_l::*}
		add sender to {_l::*}
		send "Result: %doStuff()%" to {_l::*}

will now only call doStuff once, used to be twice.


Target Minecraft Versions: any
Requirements: none
Related Issues: #3164

@TPGamesNL TPGamesNL added enhancement Feature request, an issue about something that could be improved, or a PR improving something. 2.6 labels May 8, 2021
@TPGamesNL
Copy link
Member Author

TPGamesNL commented May 8, 2021

Now it also fixes the code:

command /test <text>:
	trigger:
		message "text: %coloured arg-1%"

parsing special chat formats (tooltip etc), although this bug was only present on master, not 2.5.3.

It also fixes an exception (SkriptAPIException: Call to getSingle() on a non-single expression) from the code message "text: %coloured ("abc" and "test")%"

@FranKusmiruk FranKusmiruk merged commit 25fbe9a into SkriptLang:master May 8, 2021
@TPGamesNL TPGamesNL deleted the enhancement/sending-objects branch May 8, 2021 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants