APickledWalrus / skript-placeholders

Placeholder integration for Skript.
GNU General Public License v3.0
28 stars 8 forks source link

Parse bug #26

Closed Pocanistaken closed 3 years ago

Pocanistaken commented 3 years ago

Description

Hey i just made a function for get a placeholderapi support for my skript but there is a problem probably about parse

Steps to Reproduce

Function ->

function pDiscordPlaceholderAPI(string : text, p : player) :: text:
    set {_word::*} to {_string} split at " "
    loop {_word::*}:
        if first character of loop-value contains "%%":
            if last character of loop-value contains "%%":
                set {_v} to subtext of loop-value from characters 2 to (the length of loop-value - 1)
                replace "%loop-value%" in {_string} with "%placeholder {_v} from {_p}%"
    return {_string} 

The part where I'm having a problem


                                                set {_name} to yaml value "Data.%{_t}%.Nickname" from "data"
                        reply with "%{_name}%"
                        set {_string} to pDiscordPlaceholderAPI("%yaml value ""DiscordChat.Message"" from ""config""%", {_name} parsed as player)                       
                        broadcast "%{_string}%"

Expected Behavior

a Advice to fix problem

Errors / Screenshots

image

image

image

Server Information

btw when i write bug report to here i got a idea for fix this problem just save yaml value to player not a text after probably my problem will fix but I think its must be work beacuse i parsing it to player.

Pocanistaken commented 3 years ago

Edit: Still some problem i saved value to player but nothing changed

APickledWalrus commented 3 years ago

Super sorry for the late reply.. I somehow missed this.. my bad!!

Are you still having this issue? If so:

  1. Are you sure you have the player expansion installed?
  2. Are you sure the placeholder string is correct that you are putting into the expression

Make sure the script is actually meeting the conditions and making it to the replace line too If it is, make sure the placeholder you're putting into the expression is formatted properly If you're still having issues and you're sure it's formatted properly, let me know :D

Pocanistaken commented 3 years ago

Firstly haha no problem.I may be a little angry that you answered late

Yeah i still have this issue.I tested what you said but i know the reason of problem its just accepts player but if you set player to any variable for example if you do it like that set {_player} to player it's won't work

command test:
    trigger:
        set {_player} to player
        set {_work} to pDiscordPlaceholderAPI("%yaml value ""DiscordChat.Message"" from ""config""%", player) # it will be work                     
        set {_nowork} to pDiscordPlaceholderAPI("%yaml value ""DiscordChat.Message"" from ""config""%", {_player}) # it won't work i need to this one work for my skript                        

i hope you got me also you can test it too waitting your answer it would be nice if it wasn't delayed for 3 weeks as soon as possible

APickledWalrus commented 3 years ago

This seems to work okay for me. Here is the code I used:

command /placeholdertest <text>:
    trigger:
        set {_p} to player
        broadcast test(player, arg-1)
        broadcast test({_p}, arg-1)

function test(p: player, string: string) :: text:
    set {_word::*} to {_string} split at " "
    loop {_word::*}:
        if first character of loop-value contains "%%":
            if last character of loop-value contains "%%":
                set {_v} to subtext of loop-value from characters 2 to (the length of loop-value - 1)
                replace "%loop-value%" in {_string} with "%placeholder {_v} from {_p}%"
    return {_string} 

COMMAND USED FOR TESTING:
/placeholdertest %player_name% > hey how are you?

The placeholder was properly replaced both times. If I can't reproduce it, there is not much I can do unfortunately. I would recommend updating Placeholder API. You are also running an old version of Skript & server version. It is possible this could be an issue with Skript. Maybe you could try the 1.8 fork found here: https://github.com/Matocolotoe/Skript-1.8/releases/tag/2.5.3

Pocanistaken commented 3 years ago

Okay thank you.