Access to same variable twice without change it, get different outcome

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Ghostfish_

New Member
May 6, 2020
5
0
1
24
{exist.%player%} is set under the code below

Code:
on join:
    if {exist.%player%} is not set:
        set {exist.%player%} to true

command //setUpFormerExisted:
    permission: tbc.excommands
    trigger:
        loop all players:
            make console execute command "//setUpExistance %loop-player%"
        loop all offline players:
            make console execute command "//setUpExistance %loop-offline player%"

command //setUpExistance [<text>]:
    trigger:
        if arg 1 is set:
            set {exist.%arg 1%} to true
        else:
            set {exist.%player%} to true

function isPlayerExist(p: text) :: boolean:
    broadcast "{exist.%{_p}%} is %{exist.%{_p}%}%"
    if {exist.%{_p}%} is true:
        return true
    else:
        return false

The problem is that if I access the variable {exist.Ghostfish_} through my account named "Ghostfish_", I will get the result of true
And if I log on to another account named "test", I will get the result of false. The same thing happened to {exist.test}

I tried to access to the variable {exist.test} through this command /gv by "Ghostfish_", I will get true

Code:
command //getVariable <text>:
    aliases: /gv
    permission: tbc.excommands
    trigger:
        send "%{%arg 1%}%"

How should I fix it? Thank you guys very much!
[doublepost=1605219949,1605219872][/doublepost]"The problem is that if I access the variable {exist.Ghostfish_} through my account named "Ghostfish_", I will get the result of true
And if I log on to another account named "test", I will get the result of false. The same thing happened to {exist.test}"

Through method isPlayerExist(text)
[doublepost=1605220685][/doublepost]Here are the screenshots
will any invisible information be generated by subtext? By invisible information, I mean something like "<reset>1" will look exactly the same as "1" but actually different

Code:
if loop-value contains "@":
                set {_si} to the first index of "@" in loop-value
                set {_si} to sum({_si},1)
                set {_ei} to length of loop-value
                
                set {_targetText} to subtext of loop-value from characters {_si} to {_ei}
                delete {_target}
                set {_target} to {_targetText} parsed as player
                
                delete {_pre}
                set {_pre} to subtext of loop-value from characters 0 to subtract({_si},2)
                if isPlayerExist({_targetText}) is true:
                    set {_post} to "<light blue>%subtext of loop-value from characters subtract({_si},1) to {_ei}%"
                else:
                    set {_post} to "<reset>%subtext of loop-value from characters subtract({_si},1) to {_ei}%"
                    
                if {_pre} is set:
                    set {_rp} to "%{_pre}%%{_post}%<reset>"
                else:
                    set {_rp} to "%{_post}%<reset>"
                set {_nm} to "%{_nm}%%{_rp}% "
                
                if isPlayerExist({_targetText}) is true:
                    aitPlayer_inChat({_target}, {_targetText}, {_p}, {_m}, getTime())
 

Attachments

  • R3(OYQZ7C)$W8~(0$OBIRUO.png
    7.4 KB · Views: 91
  • IN4FRZ{B}{PSS4VXOQIY$2G.png
    8.7 KB · Views: 97
Status
Not open for further replies.