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
Add to the NEXT Spot
Author Message
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #10
RE: Add to the NEXT Spot
you must use "return 0/1" to stop the loop, otherwise it will continue looping until 250 and will set 250 tags Tongue
and also use the right return 0/1, because on @DeathCorpse the return 1 will prevent the corpse creation, and return 0 will allow the corpse creation

and LOCAL.X (hex) is not the same as dLOCAL.X (dec)
tag.gslain<LOCAL.X> = tag.gslain01
tag.gslain<dLOCAL.X> = tag.gslain1

so if you set the value on tag.gslain1, you wont find the tag value if you search it on tag.gslain01

Ben already post a working example with these things fixed

PS: just a code optimization tip, avoid make checks inside loops which doesn't really need to be inside the loop. If you check the <REF1.ISPLAYER> value inside the loop, sphere will try to get the <REF1.ISPLAYER> result 1x ~ 250x, but you just need check it 1x and not 250x. So you can check it just a single time before start the loop

Code:
[EVENTS e_cao_cao]
ON=@DeathCorpse
REF1=<ATTACKER.MAX>  //who ever did most damage
IF (<REF1.ISPLAYER>)
  FOR x 1 250
    IF (STRCMPI("<REF1.TAG.gslain<dLOCAL.X>>","Cao Cao")==0)
      REF1.SYSMESSAGE @0482 You have already defeated General Cao Cao...
      return 1  //prevent corpse creation
    ELIF (<ISEMPTY <REF1.TAG.gslain<dLOCAL.X>>>)
      REF1.TAG.gslain<dLOCAL.X>=Cao Cao
      REF1.SYSMESSAGE @0481 Congratulations! You have defeated General Cao Cao!
      return 0  //allow corpse creation
    ENDIF
  ENDFOR
ENDIF
(This post was last modified: 02-02-2015 02:47 PM by Coruja.)
02-02-2015 02:42 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
Add to the NEXT Spot - x77x - 01-31-2015, 05:10 AM
RE: Add to the NEXT Spot - Extreme - 01-31-2015, 05:55 AM
RE: Add to the NEXT Spot - x77x - 01-31-2015, 06:34 AM
RE: Add to the NEXT Spot - azmanomer - 01-31-2015, 08:58 AM
RE: Add to the NEXT Spot - x77x - 01-31-2015, 12:10 PM
RE: Add to the NEXT Spot - azmanomer - 01-31-2015, 01:31 PM
RE: Add to the NEXT Spot - x77x - 01-31-2015, 01:44 PM
RE: Add to the NEXT Spot - Ben - 01-31-2015, 11:51 PM
RE: Add to the NEXT Spot - x77x - 02-01-2015, 02:44 AM
RE: Add to the NEXT Spot - Coruja - 02-02-2015 02:42 PM
RE: Add to the NEXT Spot - x77x - 10-14-2015, 01:50 PM
RE: Add to the NEXT Spot - x77x - 10-14-2015, 09:16 PM

Forum Jump:


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