HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Is there a limit of how many parameter can a function take ?

10-19-2006, 06:38 PM#1
zen87
Collapse JASS:
function Testing takes integer a, integer b, integer c, integer d... returns nothing

as title, for example, i have an function like above, is there a limit of how many paramemter a function can take ? well just to confrim something... I'm trying to make a creep table but it seems that the function didnt work too well...

currenly my fucntion takes around... 27 parameter... is that the trouble maker ?
10-19-2006, 06:54 PM#2
karukef
"it seems that the function didnt work too well..."

That is not a lot of information.

I doubt having 27 parameters is the problem.
10-19-2006, 07:19 PM#3
Vexorian
I can't think of any real life scenario in which you need so many arguments, but no limit there is documented, There *Should* be a limit but I wouldn't expect it to be 27
10-20-2006, 02:22 AM#4
zen87
hmm because i have a trigger to setup my creeptable like below
Collapse JASS:
function RespawnSystemSetup1 takes nothing returns nothing
 local integer i //Max Value of the Camp
 local integer p //Player Owner
 local integer q //Number of Mobs (a-d,1) (a-h,2) (a-l,3)
//Mob A
 local integer au //Unit-Type1 out of the CreepPool and group in mob A
 local integer an //Value of the previous Unit-Type
 local integer bu //Unit-Type2 out of the CreepPool and group in mob A
 local integer bn //Value of the previous Unit-Type
 local integer cu //Unit-Type3 out of the CreepPool and group in mob A
 local integer cn //Value of the previous Unit-Type
 local integer du //Unit-Type4 out of the CreepPool and group in mob A
 local integer dn //Value of the previous Unit-Type
//Mob B
 local integer eu //Unit-Type1 out of the CreepPool and group in mob B
 local integer en //Value of the previous Unit-Type
 local integer fu //Unit-Type2 out of the CreepPool and group in mob B
 local integer fn //Value of the previous Unit-Type
 local integer gu //Unit-Type3 out of the CreepPool and group in mob B
 local integer gn //Value of the previous Unit-Type
 local integer hu //Unit-Type4 out of the CreepPool and group in mob B
 local integer hn //Value of the previous Unit-Type
//Mob C
 local integer iu //Unit-Type1 out of the CreepPool and group in mob C
 local integer in //Value of the previous Unit-Type
 local integer ju //Unit-Type2 out of the CreepPool and group in mob C
 local integer jn //Value of the previous Unit-Type
 local integer ku //Unit-Type3 out of the CreepPool and group in mob C
 local integer kn //Value of the previous Unit-Type
 local integer lu //Unit-Type4 out of the CreepPool and group in mob C
 local integer ln //Value of the previous Unit-Type

//--------------------------------------------------------
//--------------------------------------------------------
//CreepPool
set udg_respawnsystem_UnitType[1] = 'nitw'//ice troll warlord
set udg_respawnsystem_UnitType[2] = 'nitr'//ice troll
set udg_respawnsystem_UnitType[3] = 'nitt'//ice troll trapper
set udg_respawnsystem_UnitType[4] = 'nitp'//ice troll priest
set udg_respawnsystem_UnitType[5] = 'nfpl'//polar furbolg
set udg_respawnsystem_UnitType[6] = 'nfps'//polar furbolg shaman
set udg_respawnsystem_UnitType[7] = 'nfpt'//polar furbolg tracker
set udg_respawnsystem_UnitType[8] = 'ndqn'//succubus
set udg_respawnsystem_UnitType[9] = 'ndqv'//vile tormentor
set udg_respawnsystem_UnitType[10] = 'ndqt'//vile tempress
...

//Camp 1
set i = 7
set p = 12
set q = 2

set au = 1
set an = 4
set bu = 2
set bn = 1
set cu = 3
set cn = 1
set du = 4
set dn = 1
set eu = 5
set en = 1
set fu = 6
set fn = 2
set gu = 7
set gn = 2
set hu = 59
set hn = 7
call StoreInteger(udg_gc,"1","VC",i)
call StoreInteger(udg_gc,"1","PO",p)
call StoreInteger(udg_gc,"1","QO",q)
call StoreInteger(udg_gc,"1","U11",au)
call StoreInteger(udg_gc,"1","V11",an)
call StoreInteger(udg_gc,"1","U12",bu)
call StoreInteger(udg_gc,"1","V12",bn)
call StoreInteger(udg_gc,"1","U13",cu)
call StoreInteger(udg_gc,"1","V13",cn)
call StoreInteger(udg_gc,"1","U14",du)
call StoreInteger(udg_gc,"1","V14",dn)
call StoreInteger(udg_gc,"1","U21",eu)
call StoreInteger(udg_gc,"1","V21",en)
call StoreInteger(udg_gc,"1","U22",fu)
call StoreInteger(udg_gc,"1","V22",fn)
call StoreInteger(udg_gc,"1","U23",gu)
call StoreInteger(udg_gc,"1","V23",gn)
call StoreInteger(udg_gc,"1","U24",hu)
call StoreInteger(udg_gc,"1","V24",hn)

//Camp 2
set i = 7
set p = 10
set q = 2

set au = 8
set an = 1
set bu = 9
set bn = 2
set cu = 10
set cn = 2
set du = 0
set dn = 0
set eu = 11
set en = 1
set fu = 12
set fn = 2
set gu = 13
set gn = 3
set hu = 0
set hn = 0
call StoreInteger(udg_gc,"2","VC",i)
call StoreInteger(udg_gc,"2","PO",p)
call StoreInteger(udg_gc,"2","QO",q)
call StoreInteger(udg_gc,"2","U11",au)
call StoreInteger(udg_gc,"2","V11",an)
call StoreInteger(udg_gc,"2","U12",bu)
call StoreInteger(udg_gc,"2","V12",bn)
call StoreInteger(udg_gc,"2","U13",cu)
call StoreInteger(udg_gc,"2","V13",cn)
call StoreInteger(udg_gc,"2","U14",du)
call StoreInteger(udg_gc,"2","V14",dn)
call StoreInteger(udg_gc,"2","U21",eu)
call StoreInteger(udg_gc,"2","V21",en)
call StoreInteger(udg_gc,"2","U22",fu)
call StoreInteger(udg_gc,"2","V22",fn)
call StoreInteger(udg_gc,"2","U23",gu)
call StoreInteger(udg_gc,"2","V23",gn)
call StoreInteger(udg_gc,"2","U24",hu)
call StoreInteger(udg_gc,"2","V24",hn)
endfunction

the function above is working, after that i wanted to simplify the thing so i did this

Collapse JASS:
function SaveCreepCamp takes integer camp, integer i, integer p, integer q, integer au, integer an, integer bu, integer bn, integer cu, integer cn, integer du, integer dn... returns nothing
 local string c
 set c = I2S(camp)
 call StoreInteger(udg_gc,"c","VC",i)
 call StoreInteger(udg_gc,"c","PO",p)
 call StoreInteger(udg_gc,"c","QO",q)
 call StoreInteger(udg_gc,"c","U11",au)
 call StoreInteger(udg_gc,"c","V11",an)
 call StoreInteger(udg_gc,"c","U12",bu)
 call StoreInteger(udg_gc,"c","V12",bn)
 call StoreInteger(udg_gc,"c","U13",cu)
 call StoreInteger(udg_gc,"c","V13",cn)
 call StoreInteger(udg_gc,"c","U14",du)
 call StoreInteger(udg_gc,"c","V14",dn)
 call StoreInteger(udg_gc,"c","U21",eu)
 call StoreInteger(udg_gc,"c","V21",en)
 call StoreInteger(udg_gc,"c","U22",fu)
 call StoreInteger(udg_gc,"c","V22",fn)
 call StoreInteger(udg_gc,"c","U23",gu)
 call StoreInteger(udg_gc,"c","V23",gn)
 call StoreInteger(udg_gc,"c","U24",hu)
 call StoreInteger(udg_gc,"c","V24",hn)
 call StoreInteger(udg_gc,"c","U31",iu)
 call StoreInteger(udg_gc,"c","V31",in)
 call StoreInteger(udg_gc,"c","U32",ju)
 call StoreInteger(udg_gc,"c","V32",jn)
 call StoreInteger(udg_gc,"c","U33",ku)
 call StoreInteger(udg_gc,"c","V33",kn)
 call StoreInteger(udg_gc,"c","U34",lu)
 call StoreInteger(udg_gc,"c","V34",ln)
 set c=null
endfunction


function RespawnSystemSetup takes nothing returns nothing
//--------------------------------------------------------
//CreepPool
//--------------------------------------------------------
set udg_respawnsystem_UnitType[1] = 'nitw'//ice troll warlord
set udg_respawnsystem_UnitType[2] = 'nitr'//ice troll
set udg_respawnsystem_UnitType[3] = 'nitt'//ice troll trapper
set udg_respawnsystem_UnitType[4] = 'nitp'//ice troll priest
set udg_respawnsystem_UnitType[5] = 'nfpl'//polar furbolg
set udg_respawnsystem_UnitType[6] = 'nfps'//polar furbolg shaman
set udg_respawnsystem_UnitType[7] = 'nfpt'//polar furbolg tracker
set udg_respawnsystem_UnitType[8] = 'ndqn'//succubus
set udg_respawnsystem_UnitType[9] = 'ndqv'//vile tormentor
set udg_respawnsystem_UnitType[10] = 'ndqt'//vile tempress
...
//--------------------------------------------------------
//SaveCreepCamp takes : camp no, max value, owner, n mobs, u1mob1, v1mob1, u2mob1...

call SaveCreepCamp(1, 7,12,2, 1,4,2,1,3,1,4,1, 5,1,6,2,7,2,59,7, 0,0,0,0,0,0,0,0)
call SaveCreepCamp(2, 7,10,2, 8,1,9,2,10,2,0,0, 11,1,12,2,13,3,0,0 0,0,0,0,0,0,0,0)
call SaveCreepCamp(3, 7,10,2, 8,1,9,2,10,2,0,0, 11,1,12,2,13,3,0,0 0,0,0,0,0,0,0,0)
endfunction
10-20-2006, 04:20 AM#5
Vexorian
If it was a limit then it would have shown a syntax error or crash world editor when saving, what do you mean by "it did not seem to work well" ?
10-20-2006, 04:33 AM#6
zen87
uhm, the above trigger are saving the creep type to be spawn in a creepcamp

trigger 1: saving the creepcamp 1by1, the creep spawn for the camp
trigger 2: compile the saving trigger and calling them, but it seems that the creep wasn't saved, the creep does not respawn for the creepcamp

the both trigger do exactly the same thing, but trigger 1 is working but trigger 2 is not...

so i was thinking is it because my parameter is too long and the function cant read it =|

=================================

basically... the trigger below is not saving the integer in the game cache where this should not happen... arghhhhhh i just cant figure it out what causes it...

Collapse JASS:
function SaveCreepCamp takes string c, integer i, integer p, integer q, integer au, integer an, integer bu, integer bn, integer cu, integer cn, integer du, integer dn, integer eu, integer en, integer fu, integer fn, integer gu, integer gn, integer hu, integer hn, integer iu, integer in, integer ju, integer jn, integer ku, integer kn, integer lu, integer ln returns nothing
 call StoreInteger(udg_gc,c,"VC",i)
 call StoreInteger(udg_gc,c,"PO",p)
 call StoreInteger(udg_gc,c,"QO",q)
 call StoreInteger(udg_gc,c,"U11",au)
 call StoreInteger(udg_gc,c,"V11",an)
 call StoreInteger(udg_gc,c,"U12",bu)
 call StoreInteger(udg_gc,c,"V12",bn)
 call StoreInteger(udg_gc,c,"U13",cu)
 call StoreInteger(udg_gc,c,"V13",cn)
 call StoreInteger(udg_gc,c,"U14",du)
 call StoreInteger(udg_gc,c,"V14",dn)
 call StoreInteger(udg_gc,c,"U21",eu)
 call StoreInteger(udg_gc,c,"V21",en)
 call StoreInteger(udg_gc,c,"U22",fu)
 call StoreInteger(udg_gc,c,"V22",fn)
 call StoreInteger(udg_gc,c,"U23",gu)
 call StoreInteger(udg_gc,c,"V23",gn)
 call StoreInteger(udg_gc,c,"U24",hu)
 call StoreInteger(udg_gc,c,"V24",hn)
 call StoreInteger(udg_gc,c,"U31",iu)
 call StoreInteger(udg_gc,c,"V31",in)
 call StoreInteger(udg_gc,c,"U32",ju)
 call StoreInteger(udg_gc,c,"V32",jn)
 call StoreInteger(udg_gc,c,"U33",ku)
 call StoreInteger(udg_gc,c,"V33",kn)
 call StoreInteger(udg_gc,c,"U34",lu)
 call StoreInteger(udg_gc,c,"V34",ln)
endfunction


function RespawnSystemSetup takes nothing returns nothing
//--------------------------------------------------------
//CreepPool
//--------------------------------------------------------
set udg_respawnsystem_UnitType[1] = 'nitw'//ice troll warlord
set udg_respawnsystem_UnitType[2] = 'nitr'//ice troll
set udg_respawnsystem_UnitType[3] = 'nitt'//ice troll trapper
set udg_respawnsystem_UnitType[4] = 'nitp'//ice troll priest
set udg_respawnsystem_UnitType[5] = 'nfpl'//polar furbolg
set udg_respawnsystem_UnitType[6] = 'nfps'//polar furbolg shaman
set udg_respawnsystem_UnitType[7] = 'nfpt'//polar furbolg tracker
set udg_respawnsystem_UnitType[8] = 'ndqn'//succubus
set udg_respawnsystem_UnitType[9] = 'ndqv'//vile tormentor
set udg_respawnsystem_UnitType[10] = 'ndqt'//vile tempress
set udg_respawnsystem_UnitType[11] = 'nvdl'//lesser voidwalker
set udg_respawnsystem_UnitType[12] = 'nvdw'//voidwalker
set udg_respawnsystem_UnitType[13] = 'nvdg'//greater voidwalker
set udg_respawnsystem_UnitType[14] = 'nvde'//elder voidwalker
set udg_respawnsystem_UnitType[15] = 'nrvs'//frost revenant
set udg_respawnsystem_UnitType[16] = 'nrvi'//ice revenant (stronger)
set udg_respawnsystem_UnitType[17] = 'nska'//skel archer
set udg_respawnsystem_UnitType[18] = 'nskf'//burnign archer
set udg_respawnsystem_UnitType[19] = 'nskm'//skel marksman
set udg_respawnsystem_UnitType[20] = 'nskg'//giant skel warr
set udg_respawnsystem_UnitType[21] = 'ngh1'//ghost
set udg_respawnsystem_UnitType[22] = 'ngh2'//wraith (stronger)
set udg_respawnsystem_UnitType[23] = 'nfpu'//polar furbolg ursa warr
set udg_respawnsystem_UnitType[24] = 'nplb'//polar bear
set udg_respawnsystem_UnitType[25] = 'nban'//bandit
set udg_respawnsystem_UnitType[26] = 'nbrg'//brigand
set udg_respawnsystem_UnitType[27] = 'nenf'//enforcer
set udg_respawnsystem_UnitType[28] = 'ndrf'//draenei guardian
set udg_respawnsystem_UnitType[29] = 'ndrm'//draenei disciple
set udg_respawnsystem_UnitType[30] = 'odrh'//draenei harbinger
set udg_respawnsystem_UnitType[31] = 'nspd'//nerubian spiderling
set udg_respawnsystem_UnitType[32] = 'nnwl'//nerubian webspinner
set udg_respawnsystem_UnitType[33] = 'nnwr'//nerubian seer
set udg_respawnsystem_UnitType[34] = 'nanb'//barbed arachnathid
set udg_respawnsystem_UnitType[35] = 'nane'//arachnathid erath-borer
set udg_respawnsystem_UnitType[36] = 'nano'//overlord arachanathid
set udg_respawnsystem_UnitType[37] = 'nwiz'//apprentice wiz
set udg_respawnsystem_UnitType[38] = 'nwzr'//rogue wiz
set udg_respawnsystem_UnitType[39] = 'nwzg'//renegade wiz
set udg_respawnsystem_UnitType[40] = 'nsra'//stormreaver apprentice
set udg_respawnsystem_UnitType[41] = 'nsrh'//stormreaver hermit
set udg_respawnsystem_UnitType[42] = 'nsrn'//stormreaver necrolyte
set udg_respawnsystem_UnitType[43] = 'nhfp'//fallen priest
set udg_respawnsystem_UnitType[44] = 'nhdc'//deceiver
set udg_respawnsystem_UnitType[45] = 'nhhr'//heretic
set udg_respawnsystem_UnitType[46] = 'nfor'//faceless trickster
set udg_respawnsystem_UnitType[47] = 'nfot'//faceless terror(stronger)
set udg_respawnsystem_UnitType[48] = 'nfgu'//felguard
set udg_respawnsystem_UnitType[49] = 'nfgb'//bloodfiend (stronger)
set udg_respawnsystem_UnitType[50] = 'nerw'//eredar warlock
set udg_respawnsystem_UnitType[51] = 'nfod'//faceless deathbringer
set udg_respawnsystem_UnitType[52] = 'nfov'//overlord
set udg_respawnsystem_UnitType[53] = 'ndmu'//zombie warr
set udg_respawnsystem_UnitType[54] = 'nmrl'//murloc tiderunner
set udg_respawnsystem_UnitType[55] = 'nmrr'//murloc huntsman
set udg_respawnsystem_UnitType[56] = 'nmrm'//murloc nightcrawler
set udg_respawnsystem_UnitType[57] = 'nmpg'//murloc plaguebearer
set udg_respawnsystem_UnitType[58] = 'nmfs'//murloc flesheater
set udg_respawnsystem_UnitType[59] = 'nith'//ice troll wizard
set udg_respawnsystem_UnitType[60] = 'nwzd'//dark wizard
set udg_respawnsystem_UnitType[61] = 'nslh'//salamander
set udg_respawnsystem_UnitType[62] = 'nslr'//enraged salamander
set udg_respawnsystem_UnitType[63] = 'nvde'//elder voidwalker
set udg_respawnsystem_UnitType[64] = 'nnht'//nether drag hatchling
set udg_respawnsystem_UnitType[65] = 'nndk'//nether drake
set udg_respawnsystem_UnitType[66] = 'nsrn'//
set udg_respawnsystem_UnitType[67] = 'nsrn'//
set udg_respawnsystem_UnitType[68] = 'nsrn'//
set udg_respawnsystem_UnitType[69] = 'nsrn'//

//--------------------------------------------------------
//SaveCreepCamp takes : camp no, max value, owner, n mobs, u1mob1, v1mob1, u2mob1...
// eg call SaveCreepCamp(0, 0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0)

 call SaveCreepCamp("1",  7,12,2,  1,4,2,1,3,1,4,1,     5,1,6,2,7,2,59,7,    0,0,0,0,0,0,0,0)
 call SaveCreepCamp("2",  7,10,2,  8,1,9,2,10,2,0,0,    11,1,12,2,13,3,0,0,  0,0,0,0,0,0,0,0)
 call SaveCreepCamp("3",  7,10,2,  8,1,9,2,10,2,0,0,    11,1,12,2,13,3,0,0,  0,0,0,0,0,0,0,0)
 call SaveCreepCamp("4",  7,10,1,  17,1,18,2,19,2,20,4, 0,0,0,0,0,0,0,0,     0,0,0,0,0,0,0,0)
 call SaveCreepCamp("5",  6,12,1,  21,2,22,4,0,0,0,0,   0,0,0,0,0,0,0,0,     0,0,0,0,0,0,0,0)
 call SaveCreepCamp("6",  5,11,1,  23,5,24,5,0,0,0,0,   0,0,0,0,0,0,0,0,     0,0,0,0,0,0,0,0)
 call SaveCreepCamp("7",  8,12,2,  25,1,26,1,27,3,0,0,  28,1,29,1,30,3,0,0,  0,0,0,0,0,0,0,0)
 call SaveCreepCamp("8",  6,11,2,  1,4,2,1,3,1,4,1,     5,1,6,2,7,2,59,7,    0,0,0,0,0,0,0,0)
 call SaveCreepCamp("9",  8,10,2,  31,1,32,2,33,3,0,0,  34,1,35,2,36,3,0,0,  0,0,0,0,0,0,0,0)

endfunction

//===========================================================================
function InitTrig_Setup_Respawn_System takes nothing returns nothing
 local trigger t = CreateTrigger(  )
    call TriggerAddAction( t, function RespawnSystemSetup )
 set t = null
endfunction

10-20-2006, 08:37 AM#7
blu_da_noob
I need to write a guide on how to post in this place -.-.
We (that is, the people wanting to help) cannot possibly help you (that is, you) with any problem (that is, the problem you may post) if we have no idea (that is, knowledge or understanding) of what this problem (that is, the one you may or may not post) could possibly be. If you (that is, you, the poster who requires help) would care to provide us (that is, those wishing to help you) with the vital information (that is, what the hell your problem actually is) then we (that is, us) could possibly help you (that is, solve your problem). Until such a time (that is, when we are told what your problem is) we (that is, us) will be unable (that is, incapable) to help (that is, provide aid and/or solve your problem) you (that is, you the person with the problem). Do you (that is, the one with the problem) understand (that is, comprehend)?
10-20-2006, 08:43 AM#8
zen87
...........

i tot i've said that :
Quote:
basically... the trigger below is not saving the integer in the game cache where this should not happen... arghhhhhh i just cant figure it out what causes it...

never mind... i also don't know to explain my problem... I'll figure my own way out, thanks for helping me to know that i shouldent ask for help u_u
10-20-2006, 12:43 PM#9
Rising_Dusk
Quote:
thanks for helping me to know that i shouldent ask for help u_u
Stop being a drama-queen.
Nowhere did anyone say that.
If you want to interpret us trying to figure out what the crap you were asking as telling you that, then you need to grow up.

Quote:
basically... the trigger below is not saving the integer in the game cache where this should not happen... arghhhhhh i just cant figure it out what causes it...
Let me translate what we can get out of this statement for you.
Quote:
"The trigger below isn't saving to cache."
To be fair, it probably IS saving properly and you're just not moderating the values correctly.
And did you try BJDebugMsg()s to see if the function was running or not?
Then once that is done, did you try calling and retrieving these values elsewhere?
10-20-2006, 12:52 PM#10
Vexorian
Your code got too big, un-understandable and complicated, even if you fix the issue right now it would be hard to maintain. When you learn about modularity in college level a golden rule is to avoid to have a lot of arguments. I really, really encourage you to redo this trigger, there should be a cleaner way. Cause right now I can't debug it by reading the code, and even debugging by text messages would be hard.
10-20-2006, 12:59 PM#11
iNfraNe
You probably did not initialize the cache variable.
10-20-2006, 01:28 PM#12
zen87
Quote:
Originally Posted by Rising_Dusk
To be fair, it probably IS saving properly and you're just not moderating the values correctly.
And did you try BJDebugMsg()s to see if the function was running or not?
Then once that is done, did you try calling and retrieving these values elsewhere?
yes i did, i've made a trigger to call back my saved value but it all returns to 0

Quote:
Originally Posted by Vexorian
Your code got too big, un-understandable and complicated, even if you fix the issue right now it would be hard to maintain. When you learn about modularity in college level a golden rule is to avoid to have a lot of arguments. I really, really encourage you to redo this trigger, there should be a cleaner way. Cause right now I can't debug it by reading the code, and even debugging by text messages would be hard.
uhm okay, doing it now, i'll try to save the gamecache separately, and it seems so far so good with some smaller trial, maybe more typing but... as long as it is save

Quote:
Originally Posted by iNfraNe
You probably did not initialize the cache variable.
Well i did... I've even shifted the initialization of my cache right below the trigger, but it wasn't loaded.

========

and sorry for being some drama queen or rude, this is really freak me out when looking at bunch of number for too long and can't see the mistakes.