RE: Adding/Removing TAGs
TAG's are like memory items, except they are not items.
They are character based (Unless you use account.tag) and you can set them to a value or a string and then call them using those same values or strings.
In your case, you can't be sure if a player has enough "numbers" in the TAG.statp, so you use TAG0.statp. If the player has no tag.statp, it will return 0, else it will return 1. If you used TAG.statp instead, it would return an error.
Althought it may work, what azmanomer said isn't totally correct, because if "IF <src.tag0.statp>" returns 1, it means you have that tag, so you only need to use SRC.TAG.STATP -=1 and not SRC.TAG0.STATP -=1 after it. See what I mean? As soon as you check that a player has a tag, you don't need to use tag0 anymore. It is only used so it doesn't return an error in case it doesn't exist.
If your tag.statp was a string and not a number, you couldn't use the IF (<SRC.TAG0.STATP>). You would have to use something like IF STRMATCH("<TAG.STATP>","")
Why? Lets see some examples:
Lets say you want to check if a player doesn't have a tag=string:
IF STRMATCH("<SRC.TAG.FACTION>","")
SRC.SYSMESSAGE Player has no faction.
ELSE
SRC.SYSMESSAGE Player has faction.
ENDIF
If you don't have any TAG.FACTION, then you will read the sysmessage "Player has no faction".
If you used "IF STRMATCH("<SRC.TAG0.FACTION>","")" instead, you would read "Player has faction." Why? Because 0 isnt "" (empty).
Using IF STRMATCH("<SRC.TAG.FACTION>","") is the same as using IF STRMATCH("<SRC.TAG0.FACTION>","0"). As I said, if you don't have the TAG.FACTION, this last function will return 0, which is = 0, so it's like if it returned 1.
Think I explained myself correctly xD
(This post was last modified: 08-25-2015 12:05 PM by pointhz.)
|