HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Maxium calls per function?

01-02-2004, 09:35 PM#1
weaaddar
Alright guys its sad but true but there is a limit to number of functions callable per function.
Heres a debug function you can try to see
Code:
function getMax takes nothing returns nothing
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        //if (bj_forLoopAIndex>6000) then
        call DisplayTextToForce( GetPlayersAll(), I2S(GetForLoopIndexA()) )
        //endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call DisplayTextToForce( GetPlayersAll(), I2S(GetForLoopIndexA()) )
         
endfunction

function Trig_deb_Actions takes nothing returns nothing
    set bj_forLoopAIndexEnd = 10000
    call getMax()
endfunction

//===========================================================================
function InitTrig_deb takes nothing returns nothing
    set gg_trg_deb = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_deb, Player(0), "", false )
    call TriggerAddAction( gg_trg_deb, function Trig_deb_Actions )
endfunction
This should run 10,000 times. It only runs to around 6250. Now run it again and it'll reach the limit. To execute this trigger just hit enter in war3 and hit space.

http://www.battle.net/forums/war3/th...nt=3#post92581
01-02-2004, 09:46 PM#2
Peppar
This is because Warcraft kills threads that takes too much time. This was concluded in the Jass Function Pack-thread.

A solution to this problem would be to have two functions, each parsing one half of your array, and calling them with RunSeperate (which starts a function in a brand new thread) located in The Jass Vault. You can use globals to pass parameters.

I used this "trick" in my submission to the Weekly Mapping Challenge, for the computing-intensive pathing-engine.
01-03-2004, 07:53 PM#3
Starcraftfreak
1) Actually, the most info on this is on page 4 of the Jass Function pack thread (especially my last post):
http://www.wc3campaigns.com/forums/s...5&pagenumber=4
2) As explained there, you can also increase the number by using common.j functions instead of blizzard.j functions. That won't help in your case, but is helpful in general.