Macro help

Discussion in 'Help & Support / Errors & Bugs' started by y0landi, Nov 20, 2016.

  1. y0landi

    y0landi Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Aug 9, 2016
    Messages:
    215
    Trophy Points:
    11,590
    Gender:
    Female
    Ratings:
    +108
    My task:
    My code: (Saved to onSendChatMessage and onChat)
    Code:
    http://pastebin.com/L6ZnDTVs
    
    Result:
    Please help. I've never even seen this error before...
     
    #1 y0landi, Nov 20, 2016
    Last edited: Nov 20, 2016
  2. y0landi

    y0landi Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Aug 9, 2016
    Messages:
    215
    Trophy Points:
    11,590
    Gender:
    Female
    Ratings:
    +108
    Any suggestions? @314
     
  3. 314

    314 Irrational SuperMod, former ServerAdmin
    SuperMod EcoLegend ⛰️⛰️⛰️⛰️ Ex-President ⚒️⚒️ Prestige ⭐ VI ⭐ Premium Upgrade

    Joined:
    Apr 1, 2014
    Messages:
    7,055
    Trophy Points:
    97,160
    EcoDollars:
    $2,400,000
    Ratings:
    +4,921
    2869 lines of macro code...?
    I am not even sure whether the mod is able to handle such sizes, that may very well be the cause.

    Use arrays and FOR loops instead, they can save you over 2000 lines.
     
  4. y0landi

    y0landi Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Aug 9, 2016
    Messages:
    215
    Trophy Points:
    11,590
    Gender:
    Female
    Ratings:
    +108
    idk how to use those...
     
  5. Expipiplusone

    Expipiplusone Builder
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Sep 13, 2014
    Messages:
    1,592
    Trophy Points:
    37,590
    Gender:
    Male
    Ratings:
    +778
    LOL
    http://mkb-wiki.herokuapp.com/wiki/commands and type "array" to find all commands related
     
  6. y0landi

    y0landi Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Aug 9, 2016
    Messages:
    215
    Trophy Points:
    11,590
    Gender:
    Female
    Ratings:
    +108
  7. kukelekuuk

    kukelekuuk C͕̹̲̽ͪ͐ͩ̔L̜̦̝͈ͦ̿̾̿ḘA̻̗̤̳̐ͭ̆̿̃̑ͭN̊̓͑̇ͯ
    Builder ⛰️ Ex-EcoLeader ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    May 25, 2011
    Messages:
    10,061
    Trophy Points:
    80,160
    Ratings:
    +6,925
    >2.9k lines

    [​IMG]
     
    • Agree Agree x 2
    • Winner Winner x 2
    • List
  8. y0landi

    y0landi Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Aug 9, 2016
    Messages:
    215
    Trophy Points:
    11,590
    Gender:
    Female
    Ratings:
    +108
    It has to be 2400 lines because I cant find a simple way to count how many people are on /near
     
  9. 314

    314 Irrational SuperMod, former ServerAdmin
    SuperMod EcoLegend ⛰️⛰️⛰️⛰️ Ex-President ⚒️⚒️ Prestige ⭐ VI ⭐ Premium Upgrade

    Joined:
    Apr 1, 2014
    Messages:
    7,055
    Trophy Points:
    97,160
    EcoDollars:
    $2,400,000
    Ratings:
    +4,921
    Match the first name with regular expressions, store this match in a list entry and replace the matched username with nothing. Repeat until 0 users are left in the original chat message.
     
  10. Expipiplusone

    Expipiplusone Builder
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Sep 13, 2014
    Messages:
    1,592
    Trophy Points:
    37,590
    Gender:
    Male
    Ratings:
    +778
    have you tried looking in the "scripts" section? I'm pretty confident there's a few scripts using arrays, you can get an idea on how to use them. If you still can't, write here the line of code that doesn't do what it's supposed to do and we'll try help you figure out what's wrong with the syntax
     
  11. y0landi

    y0landi Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Aug 9, 2016
    Messages:
    215
    Trophy Points:
    11,590
    Gender:
    Female
    Ratings:
    +108
    If only i knew what doesnt work... Im great at troubleshooting, just not when its on overflow error or a "Stack error in script". I dont even know how to begin to decipher that...
     
  12. goblizz

    goblizz The One and Only
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Dec 25, 2013
    Messages:
    1,789
    Trophy Points:
    45,160
    Gender:
    Male
    Ratings:
    +1,576
    I'm taking a shot in the dark here...but since your script is so long and being repeated so quickly, maybe that's causing the error?

    But I definitely advise taking 314 and Expipi's notes and rewriting the script to use FOR loops and arrays.
     
  13. y0landi

    y0landi Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Aug 9, 2016
    Messages:
    215
    Trophy Points:
    11,590
    Gender:
    Female
    Ratings:
    +108
    Okay... I don't know if I can though. My problem is this: when there are 4 people in /near and I look for 5 people, it gives an error. So I set it up to look for a certain number of players, and then if the number of players it's looking for is greater than the number of players, it lowers the number of players it looks for. Then it does all the com

    *note for later (ignore this)*
    scan each name separately
    Make 1 12 search instead of a 12,11,10. Scan test the 12 number of players and if result is #dis1 then set 12 to 0, continue until players exist = players scanned.
     
  14. Whammerist5

    Whammerist5 ø☗ø Guardian ø☗ø
    Builder ⛰️ Ex-Mayor ⚒️⚒️ Premium Upgrade

    Joined:
    Aug 15, 2015
    Messages:
    668
    Trophy Points:
    29,390
    Gender:
    Male
    EcoDollars:
    $0
    Ratings:
    +839
    Moved to Help / Support.
     
  15. 314

    314 Irrational SuperMod, former ServerAdmin
    SuperMod EcoLegend ⛰️⛰️⛰️⛰️ Ex-President ⚒️⚒️ Prestige ⭐ VI ⭐ Premium Upgrade

    Joined:
    Apr 1, 2014
    Messages:
    7,055
    Trophy Points:
    97,160
    EcoDollars:
    $2,400,000
    Ratings:
    +4,921
    Code:
    if(%@&endfriend1%="")
                match(%CHAT%, "^/nearbypass (.*)",{&friend1})
                set(@&endfriend1,%&friend1%)
            else
                if(%@&endfriend2%="")          
                    match(%CHAT%, "^/nearbypass (.*)",{&friend2})
                    set(@&endfriend2,%&friend2%)
                else
                    if(%@&endfriend3%="")          
                        match(%CHAT%, "^/nearbypass (.*)",{&friend3})
                        set(@&endfriend3,%&friend3%)
                    else
                        if(%@&endfriend4%="")          
                            match(%CHAT%, "^/nearbypass (.*)",{&friend4})
                            set(@&endfriend4,%&friend4%)
                        else
                            if(%@&endfriend5%="")          
                                match(%CHAT%, "^/nearbypass (.*)",{&friend5})
                                set(@&endfriend5,%&friend5%)
                            else
                                if(%@&endfriend6%="")          
                                    match(%CHAT%, "^/nearbypass (.*)",{&friend6})
                                    set(@&endfriend6,%&friend6%)
                                else
                                    if(%@&endfriend7%="")          
                                        match(%CHAT%, "^/nearbypass (.*)",{&friend7})
                                        set(@&endfriend7,%&friend7%)
                                    else
                                        if(%@&endfriend8%="")          
                                            match(%CHAT%, "^/nearbypass (.*)",{&friend8})
                                            set(@&endfriend8,%&friend8%)
                                        else
                                            if(%@&endfriend9%="")          
                                                match(%CHAT%, "^/nearbypass (.*)",{&friend9})
                                                set(@&endfriend9,%&friend9%)
                                            else
                                                if(%@&endfriend10%="")          
                                                    match(%CHAT%, "^/nearbypass (.*)",{&friend10})
                                                    set(@&endfriend10,%&friend10%)
                                                endif
                                            endif
                                        endif
                                    endif
                                endif
                            endif
                        endif
                    endif
                endif
            endif
    
    I may still be a little tired right now and thus make a few mistakes, but this is the (untested) code that should have the same functionality if you adjust the rest of your script.
    Code:
    FOR(#i, 1, 10, 1)
        IF(%@&endfriend[%#i%]%="")
            MATCH(%CHAT%, "^/nearbypass (.*)",{@&endfriend[%#i%]})
            BREAK
        ENDIF
    NEXT
    
    Replace all endfriendx with endfriend[x], x is a number from 1 to 10. Arrays work a lot better here. I removed the SET() line because it should be possible to set the array variable directly in the MATCH() command. Use this array pattern everywhere and you should be able to remove a lot of code.
     
    • Informative Informative x 1
    • List
  16. y0landi

    y0landi Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Aug 9, 2016
    Messages:
    215
    Trophy Points:
    11,590
    Gender:
    Female
    Ratings:
    +108
    I did that, and it helped A LOT!!!
    but what is wrong with it now?
    New stuff is after the "//123~~~~~~~~~~"
    Code:
    $${
    //for help in game use "/help endnear"
    IF(%KEYNAME%=="onSendChatMessage")
        ifmatches(%CHAT%, "^/nearbypass ")
            if(%@&endfriend1%="")
                match(%CHAT%, "^/nearbypass (.*)",{&friend1})
                set(@&endfriend1,%&friend1%)
            else
                if(%@&endfriend2%="")        
                    match(%CHAT%, "^/nearbypass (.*)",{&friend2})
                    set(@&endfriend2,%&friend2%)
                else
                    if(%@&endfriend3%="")        
                        match(%CHAT%, "^/nearbypass (.*)",{&friend3})
                        set(@&endfriend3,%&friend3%)
                    else
                        if(%@&endfriend4%="")        
                            match(%CHAT%, "^/nearbypass (.*)",{&friend4})
                            set(@&endfriend4,%&friend4%)
                        else
                            if(%@&endfriend5%="")        
                                match(%CHAT%, "^/nearbypass (.*)",{&friend5})
                                set(@&endfriend5,%&friend5%)
                            else
                                if(%@&endfriend6%="")        
                                    match(%CHAT%, "^/nearbypass (.*)",{&friend6})
                                    set(@&endfriend6,%&friend6%)
                                else
                                    if(%@&endfriend7%="")        
                                        match(%CHAT%, "^/nearbypass (.*)",{&friend7})
                                        set(@&endfriend7,%&friend7%)
                                    else
                                        if(%@&endfriend8%="")        
                                            match(%CHAT%, "^/nearbypass (.*)",{&friend8})
                                            set(@&endfriend8,%&friend8%)
                                        else
                                            if(%@&endfriend9%="")        
                                                match(%CHAT%, "^/nearbypass (.*)",{&friend9})
                                                set(@&endfriend9,%&friend9%)
                                            else
                                                if(%@&endfriend10%="")        
                                                    match(%CHAT%, "^/nearbypass (.*)",{&friend10})
                                                    set(@&endfriend10,%&friend10%)
                                                endif
                                            endif
                                        endif
                                    endif
                                endif
                            endif
                        endif
                    endif
                endif
            endif
            filter
        endif
        //editable command
        ifmatches(%CHAT%, "^/help endnear")
            log(To hide the name of someone use "/nearbypass <name>")
    //nicknames...
            log(To show a prevoiusly hidden name use "/nearbyshow <name>")
    //nicknames...
            log(To see the current list of hidden names use "/nearbylist")
            log(To edit the minimum distance names will appear use "/nearbydis <distnace>")
            log(To start the macro use "/nearbygo")
            log(To stop the macro use "/nearbystop")    
            filter
        endif
        ifmatches(%CHAT%, "^/nearbygo")
            do
                echo(/near 5000)
                wait(12000t)
            loop
            filter
        endif
        ifmatches(%CHAT%, "^/nearbystop")
            stop;
        endif
        ifmatches(%CHAT%, "^/nearbyshow ")
            match(%CHAT%, "^/nearbyshow (.*)",{&delplayer})
            if(%@&endfriend1%=%&delplayer%)
                set(@&endfriend1,"")
            else
                if(%@&endfriend2%=%&delplayer%)
                    set(@&endfriend2,"")
                else
                    if(%@&endfriend3%=%&delplayer%)
                        set(@&endfriend3,"")
                    else
                        if(%@&endfriend4%=%&delplayer%)
                            set(@&endfriend4,"")
                        else
                            if(%@&endfriend5%=%&delplayer%)
                                set(@&endfriend5,"")
                            else
                                if(%@&endfriend6%=%&delplayer%)
                                    set(@&endfriend6,"")
                                else
                                    if(%@&endfriend7%=%&delplayer%)
                                        set(@&endfriend7,"")
                                    else
                                        if(%@&endfriend8%=%&delplayer%)
                                            set(@&endfriend8,"")
                                        else
                                            if(%@&endfriend9%=%&delplayer%)
                                                set(@&endfriend9,"")
                                            else
                                                if(%@&endfriend10%=%&delplayer%)
                                                    set(@&endfriend10,"")
                                                else
                                                    log(Error: No hidden players by that name were found)
                                                endif
                                            endif
                                        endif
                                    endif
                                endif
                            endif
                        endif
                    endif
                endif
            endif
            filter
        endif
        ifmatches(%CHAT%, "^/nearbylist")
            log(Hidden Players: %@&endfriend1% %@&endfriend2% %@&endfriend3% %@&endfriend4% %@&endfriend5% %@&endfriend6% %@&endfriend7% %@&endfriend8% %@&endfriend9% %@&endfriend10%)
            filter
        endif
        ifmatches(%CHAT%, "^/nearbydis ")
            match(%CHAT%, "^/nearbydis ([0-9]+)",{#dis})
            set(@#minenddistance,%#dis%)
            filter
        endif
    endif
    //123~~~~~~~~~~
    IF(%KEYNAME%=="onChat")
        for(#r,1,12,1)
            set(#ni[%#r%],1)
            set(#ni[%#r%]sum,0)
        next
        ifcontains(%@&clean%, "Players nearby")
            match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2,&nick3,#dis3,&nick4,#dis4,&nick5,#dis5,&nick6,#dis6,&nick7,#dis7,&nick8,#dis8,&nick9,#dis9,&nick10,#dis10,&nick11,#dis11,&nick12,#dis12})
            if(%&nick1%!="#dis1")
                for(#e,1,12,1)
                    for(#q,1,10,1)
                        if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                            if(%dis[%#e%]%<%@#minenddistance%)
                                set(#ni[%#e%][%#q%],0)
                            endif
                        endif
                    next
                    set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                    if(#ni[%#e%]sum=0)
                        log(%&nick[%#e%]% %#dis[%#e%]%)
        //              playsound(custom.alert)
                    endif
                next
            else
                ifcontains(%@&clean%, "Players nearby")
                    match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2,&nick3,#dis3,&nick4,#dis4,&nick5,#dis5,&nick6,#dis6,&nick7,#dis7,&nick8,#dis8,&nick9,#dis9,&nick10,#dis10,&nick11,#dis11})
                    if(%&nick1%!="#dis1")
                        for(#e,1,11,1)
                            for(#q,1,10,1)
                                if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                    if(%dis[%#e%]%<%@#minenddistance%)
                                        set(#ni[%#e%][%#q%],0)
                                    endif
                                endif
                            next
                            set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                            if(#ni[%#e%]sum=0)
                                log(%&nick[%#e%]% %#dis[%#e%]%)
                //              playsound(custom.alert)
                            endif
                        next
                    else
                        ifcontains(%@&clean%, "Players nearby")
                            match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2,&nick3,#dis3,&nick4,#dis4,&nick5,#dis5,&nick6,#dis6,&nick7,#dis7,&nick8,#dis8,&nick9,#dis9,&nick10,#dis10})
                            if(%&nick1%!="#dis1")
                                for(#e,1,10,1)
                                    for(#q,1,10,1)
                                        if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                            if(%dis[%#e%]%<%@#minenddistance%)
                                                set(#ni[%#e%][%#q%],0)
                                            endif
                                        endif
                                    next
                                    set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                                    if(#ni[%#e%]sum=0)
                                        log(%&nick[%#e%]% %#dis[%#e%]%)
                        //              playsound(custom.alert)
                                    endif
                                next
                            else
                                ifcontains(%@&clean%, "Players nearby")
                                    match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2,&nick3,#dis3,&nick4,#dis4,&nick5,#dis5,&nick6,#dis6,&nick7,#dis7,&nick8,#dis8,&nick9,#dis9})
                                    if(%&nick1%!="#dis1")
                                        for(#e,1,9,1)
                                            for(#q,1,10,1)
                                                if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                                    if(%dis[%#e%]%<%@#minenddistance%)
                                                        set(#ni[%#e%][%#q%],0)
                                                    endif
                                                endif
                                            next
                                            set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                                            if(#ni[%#e%]sum=0)
                                                log(%&nick[%#e%]% %#dis[%#e%]%)
                                //              playsound(custom.alert)
                                            endif
                                        next
                                    else
                                        ifcontains(%@&clean%, "Players nearby")
                                            match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2,&nick3,#dis3,&nick4,#dis4,&nick5,#dis5,&nick6,#dis6,&nick7,#dis7,&nick8,#dis8})
                                            if(%&nick1%!="#dis1")
                                                for(#e,1,8,1)
                                                    for(#q,1,10,1)
                                                        if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                                            if(%dis[%#e%]%<%@#minenddistance%)
                                                                set(#ni[%#e%][%#q%],0)
                                                            endif
                                                        endif
                                                    next
                                                    set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                                                    if(#ni[%#e%]sum=0)
                                                        log(%&nick[%#e%]% %#dis[%#e%]%)
                                        //              playsound(custom.alert)
                                                    endif
                                                next
                                            else
                                                ifcontains(%@&clean%, "Players nearby")
                                                    match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2,&nick3,#dis3,&nick4,#dis4,&nick5,#dis5,&nick6,#dis6,&nick7,#dis7})
                                                    if(%&nick1%!="#dis1")
                                                        for(#e,1,7,1)
                                                            for(#q,1,10,1)
                                                                if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                                                    if(%dis[%#e%]%<%@#minenddistance%)
                                                                        set(#ni[%#e%][%#q%],0)
                                                                    endif
                                                                endif
                                                            next
                                                            set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                                                            if(#ni[%#e%]sum=0)
                                                                log(%&nick[%#e%]% %#dis[%#e%]%)
                                                //              playsound(custom.alert)
                                                            endif
                                                        next
                                                    else
                                                        ifcontains(%@&clean%, "Players nearby")
                                                            match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2,&nick3,#dis3,&nick4,#dis4,&nick5,#dis5,&nick6,#dis6})
                                                            if(%&nick1%!="#dis1")
                                                                for(#e,1,6,1)
                                                                    for(#q,1,10,1)
                                                                        if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                                                            if(%dis[%#e%]%<%@#minenddistance%)
                                                                                set(#ni[%#e%][%#q%],0)
                                                                            endif
                                                                        endif
                                                                    next
                                                                    set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                                                                    if(#ni[%#e%]sum=0)
                                                                        log(%&nick[%#e%]% %#dis[%#e%]%)
                                                        //              playsound(custom.alert)
                                                                    endif
                                                                next
                                                            else
                                                                ifcontains(%@&clean%, "Players nearby")
                                                                    match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2,&nick3,#dis3,&nick4,#dis4,&nick5,#dis5})
                                                                    if(%&nick1%!="#dis1")
                                                                        for(#e,1,5,1)
                                                                            for(#q,1,10,1)
                                                                                if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                                                                    if(%dis[%#e%]%<%@#minenddistance%)
                                                                                        set(#ni[%#e%][%#q%],0)
                                                                                    endif
                                                                                endif
                                                                            next
                                                                            set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                                                                            if(#ni[%#e%]sum=0)
                                                                                log(%&nick[%#e%]% %#dis[%#e%]%)
                                                                //              playsound(custom.alert)
                                                                            endif
                                                                        next
                                                                    else
                                                                        ifcontains(%@&clean%, "Players nearby")
                                                                            match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2,&nick3,#dis3,&nick4,#dis4})
                                                                            if(%&nick1%!="#dis1")
                                                                                for(#e,1,4,1)
                                                                                    for(#q,1,10,1)
                                                                                        if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                                                                            if(%dis[%#e%]%<%@#minenddistance%)
                                                                                                set(#ni[%#e%][%#q%],0)
                                                                                            endif
                                                                                        endif
                                                                                    next
                                                                                    set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                                                                                    if(#ni[%#e%]sum=0)
                                                                                        log(%&nick[%#e%]% %#dis[%#e%]%)
                                                                        //              playsound(custom.alert)
                                                                                    endif
                                                                                next
                                                                            else
                                                                                ifcontains(%@&clean%, "Players nearby")
                                                                                    match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2,&nick3,#dis3})
                                                                                    if(%&nick1%!="#dis1")
                                                                                        for(#e,1,3,1)
                                                                                            for(#q,1,10,1)
                                                                                                if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                                                                                    if(%dis[%#e%]%<%@#minenddistance%)
                                                                                                        set(#ni[%#e%][%#q%],0)
                                                                                                    endif
                                                                                                endif
                                                                                            next
                                                                                            set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                                                                                            if(#ni[%#e%]sum=0)
                                                                                                log(%&nick[%#e%]% %#dis[%#e%]%)
                                                                                //              playsound(custom.alert)
                                                                                            endif
                                                                                        next
                                                                                    else
                                                                                        ifcontains(%@&clean%, "Players nearby")
                                                                                            match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)\, ((.*))\(([0-9]+)m\)",{&nick1,#dis1,&nick2,#dis2})
                                                                                            if(%&nick1%!="#dis1")
                                                                                                for(#e,1,2,1)
                                                                                                    for(#q,1,10,1)
                                                                                                        if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                                                                                            if(%dis[%#e%]%<%@#minenddistance%)
                                                                                                                set(#ni[%#e%][%#q%],0)
                                                                                                            endif
                                                                                                        endif
                                                                                                    next
                                                                                                    set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                                                                                                    if(#ni[%#e%]sum=0)
                                                                                                        log(%&nick[%#e%]% %#dis[%#e%]%)
                                                                                        //              playsound(custom.alert)
                                                                                                    endif
                                                                                                next
                                                                                            else
                                                                                                ifcontains(%@&clean%, "Players nearby")
                                                                                                    match(%@&clean%, "Players nearby\: ((.*))\(([0-9]+)m\)",{&nick1,#dis1})
                                                                                                    if(%&nick1%!="#dis1")
                                                                                                        for(#e,1,1,1)
                                                                                                            for(#q,1,10,1)
                                                                                                                if(%&nick[%#e%]%!=%endfriend[%#q%]%)
                                                                                                                    if(%dis[%#e%]%<%@#minenddistance%)
                                                                                                                        set(#ni[%#e%][%#q%],0)
                                                                                                                    endif
                                                                                                                endif
                                                                                                            next
                                                                                                            set(#ni[%#e%]sum,%#ni[%#e%]sum%+#ni[%#e%][%#q%])
                                                                                                            if(#ni[%#e%]sum=0)
                                                                                                                log(%&nick[%#e%]% %#dis[%#e%]%)
                                                                                                //              playsound(custom.alert)
                                                                                                            endif
                                                                                                        next
                                                                                                    endif
                                                                                                endif
                                                                                            endif
                                                                                        endif
                                                                                    endif
                                                                                endif
                                                                            endif
                                                                        endif
                                                                    endif
                                                                endif
                                                            endif
                                                        endif
                                                    endif
                                                endif
                                            endif
                                        endif
                                    endif
                                endif
                            endif
                        endif
                    endif
                endif
            endif
        endif
    endif
    }$$
     
    #16 y0landi, Nov 23, 2016
    Last edited: Nov 23, 2016