Skript icon indicating copy to clipboard operation
Skript copied to clipboard

parse %string% as (%*classinfo%|"<.*>")

Open MrScopes opened this issue 5 years ago • 2 comments

the updated parse expression should also be an effect, currently: %string% parsed as (%*classinfo%|"<.*>") however, I think we should also be able to use parse %string% as (%*classinfo%|"<.*>") (it just makes more sense imo) Use Example:

function hi(player: text):
    parse {_player} as offline player # instead of set {_player} to {_player} parsed as offline player
    send "Hi!" to {_player}

MrScopes avatar Nov 21 '20 19:11 MrScopes

Neat little addition, but I'm currently thinking of any particular use-cases. It certainly is not hard to add though.

Mwexim avatar Nov 24 '20 15:11 Mwexim

Neat little addition, but I'm currently thinking of any particular use-cases. It certainly is not hard to add though.

The use case that led me to make this is having a function parameter be several types, such as number, text, or a player. Obviously, I set this type to text then later parsed depending on the situation. Like in my clan system, the second arg is text. But it can also be a player for kick, invite, etc. I use default UUIDs so defining the second arg as player would cause various issues such as clan names being a player instead of a name.

MrScopes avatar Nov 24 '20 15:11 MrScopes