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-nmm8 (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-nmm8 (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-nmm8 (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
Tags....
Author Message
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Tags....
Simple Example:
PHP Code:
[ITEMDEF i_monster_counter]
ID i_crystal_green
NAME
Monster counter
type 
t_script

ON
=@Create
color 
colors_all

ON
=@Dclick
src
.sysmessage @100 You have killed <dtag0.monsterKillmonsters.
return 
1

[EVENTS e_monster_kill]
ON=@Kill
ref1 
= <findid.i_monster_counter>
if (<
ref1>)
      
ref1.tag0.monsterKill += 1
      sysmessage 
@100 Your monster counter is increasedis now <ref1.dtag0.monsterKill>
      return 
0
endif
//This will install the e_monster_kill event on the player.
//For removing the event type .events -e_monster_kill.
[FUNCTION testMonster]
events +e_monster_kill
src
.sysmessage @100 Monster kill event installed

In some line of code:
PHP Code:
sysmessage @100 Your monster counter is increasedis now <ref1.dtag0.monsterKill
I add the prefix d before the tag, that means display the result in decimal (instead of hexdecimal), it's a shortcut for avoiding writing <eval <ref1.tag0.monsterKill>>

Difference betweeen TAG,TAG0:
TAG0 just tell Sphere to set to 0 the value of the TAG when the TAG is accessed AND the TAG doesn't have any value.
Example:
PHP Code:
[function testApples]
sysmessage  I have <tag0.applesapples//Output will be: I have 0 apples.
sysmessage I have <tag.applesapples.  //Output will be: I have apples.   
tag.apples 2
sysmessage  I have 
<tag0.applesapples//Output will be: I have 02 apples.
sysmessage I have <tag.applesapples.  //Output will be: I have 02 apples. 
//The following line will clear the tag.
tag.apples 
It's important to use TAG0 when checking the tag value.
PHP Code:
[FUNCTION checkApples]
//This will throw an error in the console if the tag is empty.
//By using tag0 you can avoid the error.
if <tag.apples> > 1
    say I have at least an apple
.
else
    
say I have no apples.
endif 
(This post was last modified: 11-25-2016 03:12 AM by darksun84.)
11-25-2016 02:46 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
Tags.... - Lincoln - 11-25-2016, 12:51 AM
RE: Tags.... - darksun84 - 11-25-2016 02:46 AM
RE: Tags.... - Lincoln - 11-25-2016, 03:45 AM
RE: Tags.... - darksun84 - 11-25-2016, 05:07 AM

Forum Jump:


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