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
Loop on tags.
Author Message
karma
Moderator
****

Posts: 178
Likes Given: 17
Likes Received: 32 in 29 posts
Joined: Jul 2012
Reputation: 3



Post: #6
RE: Loop on tags.
If you access frequently to these values you can consider using MySQL.
The way you are suggesting (but using commas as separators instead of blank spaces) may be better than having an high number of tags, if you have a reasonable limit of chars/enemies etc so that in any case the tag won't be too long.

You can use these functions (the code can be improved, it is old and i don't use it now, i think it works though):
Code:
[FUNCTION array_get] //item, source (0 based)
IF (<ISEMPTY <ARGV[<EVAL <ARGN1>+1>]>>)
    RETURN ""
ENDIF
RETURN <ARGV[<EVAL <ARGN1>+1>]>

[FUNCTION array_count]
RETURN <ARGV>

[FUNCTION array_add] //array, item to add
IF (<ARGV>==1)
    RETURN <Streat <ARGV[0]>>
ENDIF
RETURN <ARGS>

[FUNCTION array_remove] //item,array, 0 based
LOCAL.AR=<STREAT <ARGS>>
FOR (<Array_Count <LOCAL.AR>>)
    IF (<LOCAL._FOR>!=<EVAL <ARGV[0]>+1>)
        IF !(<ISEMPTY <VAR.ARRAY>>) //note that I use vars because locals are never empty
            VAR.ARRAY=<VAR.ARRAY>,<Array_Get <EVAL <LOCAL._FOR>-1>,<LOCAL.AR>>
        ELSE
            VAR.ARRAY=<Array_Get <EVAL <LOCAL._FOR>-1>, <LOCAL.AR>>
        ENDIF
    ENDIF
ENDFOR
IF (<ISEMPTY <VAR.ARRAY>>)
    VAR.ARRAY
    RETURN
ENDIF
LOCAL.ARRAY=<VAR.ARRAY>
VAR.ARRAY
RETURN <LOCAL.ARRAY>

[FUNCTION array_update] //item, new val, array
LOCAL.AR=<STREAT <STREAT <ARGS>>>
FOR (<Array_Count <LOCAL.AR>>)
    IF (<LOCAL._FOR>!=<EVAL <ARGV[0]>+1>)
        IF !(<ISEMPTY <LOCAL.ARRAY>>)
            LOCAL.ARRAY=<LOCAL.ARRAY>,<Array_Get <EVAL <LOCAL._FOR>+-1>,<LOCAL.AR>>
        ELSE
            LOCAL.ARRAY=<Array_Get <EVAL <LOCAL._FOR>+-1>, <LOCAL.AR>>
        ENDIF
    ELSE
        IF !(<ISEMPTY <LOCAL.ARRAY>>)
            LOCAL.ARRAY=<LOCAL.ARRAY>,<ARGV[1]>
        ELSE
            LOCAL.ARRAY=<ARGV[1]>
        ENDIF
    ENDIF
    IF (<LOCAL._FOR>>1000)
        RETURN 1
    ENDIF
ENDFOR
LOCAL.ARRAY=<LOCAL.ARRAY>
LOCAL.ARRAY
RETURN <LOCAL.ARRAY>

Anyways, take in mind that guildstones and townstones already have properties to store these values: http://wiki.sphere.torfo.org/index.php/S...wn_Members
Also, check the current code in the "stones" folder, most of the stuff regarding guild/townstones is scripted.
(This post was last modified: 01-23-2016 06:16 AM by karma.)
01-23-2016 06:11 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes karma's post
Post Reply 


Messages In This Thread
Loop on tags. - rastrero - 01-22-2016, 03:57 PM
RE: Loop on tags. - darksun84 - 01-22-2016, 07:24 PM
RE: Loop on tags. - rastrero - 01-23-2016, 01:42 AM
RE: Loop on tags. - darksun84 - 01-23-2016, 02:59 AM
RE: Loop on tags. - rastrero - 01-23-2016, 04:46 AM
RE: Loop on tags. - karma - 01-23-2016 06:11 AM
RE: Loop on tags. - Sirocco - 02-08-2016, 06:04 PM

Forum Jump:


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