So I made some code to get the value of a variable from text, and it worked great, but now I am trying to do the same with functions, but I for some reason am failing at this, if someone knows what I can do to fix this please let me know
code:
while index of "%%notationType(" in {_lineMessage} is not -1:
wait 1 tick
set {_start} to index of "%%notationType(" in {_lineMessage}
send "1. start %{_start}%"
set {_remainingMessage} to substring of {_lineMessage} from ({_start} + 14) to (length of {_lineMessage})
send "2. remaining - %{_remainingMessage}%"
set {_end} to index of ")%%" in {_remainingMessage}
send "3. relative end - %{_end}%"
if {_end} is greater than -1:
set {_end} to {_end} + ({_start} + 13)
send "4. end - %{_end}%"
set {_functionArgs} to substring of {_lineMessage} from {_start} to {_end}
set {_argStart} to index of "(" in {_functionArgs}
set {_argEnd} to index of ")" in {_functionArgs}
set {_args} to substring of {_functionArgs} from ({_argStart} + 1) to ({_argEnd} - 1)
send "5. arguments - %{_args}%"
set {_argList::*} to split {_args} at ", "
set {_arg2} to {_argList::2}
send "6. second argument - %{_arg2}%"
set {_arg2NakedStart} to index of "{" in {_arg2}
set {_arg2NakedEnd} to index of "}" in {_arg2}
set {_arg2Naked} to substring of {_arg2} from ({_arg2NakedStart} + 1) to ({_arg2NakedEnd} - 1)
send "7. second argument without {} - %{_arg2Naked}%"
set {_variableValue} to ConvertVariableToValue("%%{%{_arg2Naked}%}%%")
send "8. variable value - %{_variableValue}%"
send "9. how it looks - %{_arg2Naked}% + {} + %%%% = %%{%{_arg2Naked}%}%%"
set {_finalValue} to notationType({notationType::%player's uuid%::2}, {_variableValue})
send "10. final value - %{_finalValue}%"
replace first "%%notationType({notationType::%player's uuid%::2}, %{_arg2}%)%%" in {_lineMessage} with "%{_finalValue}%"