The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding/Removing TAGs
Author Message
Osirirs
Journeyman
*

Posts: 73
Likes Given: 6
Likes Received: 4 in 2 posts
Joined: Feb 2014
Reputation: 2



Post: #1
Adding/Removing TAGs
Hey guys I need to have a better understanding of TAGs Ive been banging my head with that almost all week >.< I always try everything I think of before asking haha. Im trying to tag Stat and Skill points to my level system, everything goes fine to gain the stat points but where I get stuck is removing it...I got 2 stat points and then I could add the stats I want, the points would drop down to 0 and then go back to 2, So of course I could add stats infinitely.
I dont have my script with me but Here's what I wrote:
[Function f_levelup]
TAG. STATP=<tag.statp>+{2 3} //not sure if its supposed to be <tag0.statp>

//and then on my level menu
[DIALOG d_levelm button]
ON=1
IF <EVAL <tag.statp>>
SRC. STR +=1
TAG.STATP=<tag.statp> -=1
ELSEIF
<EVAL <tag.statp>>
dialog d_levelm
ELSE
SYSMESSAGE you dont have any more Stat Points
Return 1
ENDIF
ENDIF

Sorry if it looks a bit messy, wrote that on my phone o.o
08-25-2015 02:16 AM
Find all posts by this user Like Post Quote this message in a reply
azmanomer
Journeyman
*

Posts: 139
Likes Given: 4
Likes Received: 18 in 16 posts
Joined: Nov 2013
Reputation: 1



Post: #2
RE: Adding/Removing TAGs
tag0.blabla -----> means if there is no value for blabla return 0
TAG.STATP=<tag.statp> -=1 this one really wrong Tongue correct one is tag0.statp -= 1
also for if <eval <tag.statp>> eval is not neccessary just use if <tag0.statp> but i couldnt understand what are u trying to do while checking 2 times tag.statp but i correct all of them with my understanding.

[DIALOG d_levelm button]
ON=1
IF <src.tag0.statp>
SRC.STR +=1
src.TAG0.STATP -= 1
src.dialog d_levelm
ELSE
src.SYSMESSAGE you dont have any more Stat Points
Return 1
ENDIF

also if you are calling this dialog with command you dont have to use 'src' but if you are calling it from item or npc u should use src.
(This post was last modified: 08-25-2015 02:51 AM by azmanomer.)
08-25-2015 02:38 AM
Find all posts by this user Like Post Quote this message in a reply
Osirirs
Journeyman
*

Posts: 73
Likes Given: 6
Likes Received: 4 in 2 posts
Joined: Feb 2014
Reputation: 2



Post: #3
RE: Adding/Removing TAGs
Rock n rooooooollll ! Everything works great now, thanks buddy ! Plus its a great thing to know for my upcoming script Big Grin
08-25-2015 09:22 AM
Find all posts by this user Like Post Quote this message in a reply
pointhz
Journeyman
*

Posts: 148
Likes Given: 1
Likes Received: 55 in 28 posts
Joined: Oct 2013
Reputation: 1



Post: #4
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.)
08-25-2015 12:01 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes pointhz's post
Osirirs
Journeyman
*

Posts: 73
Likes Given: 6
Likes Received: 4 in 2 posts
Joined: Feb 2014
Reputation: 2



Post: #5
RE: Adding/Removing TAGs
Hmmm indeed that makes a lot of sense, im not yet very familiar with strings tho but what you meant is I shouldnt use tag0 in my IF statement now that it exist ? Only when the tag is not yet created ? Couldnt I just creat an event that creates the tag in which the default value is 0 (no points) and then every stat point is added or removed ?
08-28-2015 07:39 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)