| 09-17-2004, 02:27 PM | #1 |
function VarifyTypeofD takes nothing returns nothing local destructable curr = GetEnumDestructable() local string label = GetDestructableName(curr) if label=="Rocks" then set udg_num_of_ore = udg_num_of_ore + 1 elseif label=="Young Crop" then set udg_num_of_food = udg_num_of_food + 1 else set udg_num_of_trees = udg_num_of_trees + 1 endif endfunction function Trig_Test_Display_all_Resorces_Actions takes nothing returns nothing set udg_num_of_trees=0 set udg_num_of_ore=0 set udg_num_of_food=0 call EnumDestructablesInCircleBJ( 500.0 , GetUnitLoc(GetConstructedStructure()), VarifyTypeofD()) call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "Food: " + I2S(udg_num_of_food) ) ) call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "Ore: " + I2S(udg_num_of_ore) ) ) call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "Trees: " + I2S(udg_num_of_trees) ) ) endfunction //=========================================================================== function InitTrig_Test_Display_all_Resorces takes nothing returns nothing set gg_trg_Test_Display_all_Resorces = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Test_Display_all_Resorces, EVENT_PLAYER_UNIT_CONSTRUCT_FINISH ) call TriggerAddAction( gg_trg_Test_Display_all_Resorces, function Trig_Test_Display_all_Resorces_Actions ) endfunction Error: Invalid argument type (void) for line: call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "Food: " + I2S(udg_num_of_food) ) ) !!! wtf do i have to put there to make this thing happy?!? |
| 09-17-2004, 09:04 PM | #2 |
The JASS parser in WE gave you as usual the wrong line. In fact the real line is the one above the displayed one. The last parameter in the enum needs to be function VarifyTypeofD. |
| 09-18-2004, 01:55 AM | #3 |
er, so u dont need to () when sending code? lol that is so against everything that makes sence to me.... but i guess it does make sence if u think about it..... EDIT: BTW, 2 related questions, how would i get rid of any memory leeks in this code, and is there a way to creat a "global" function? where would i have to declare it and the such, like for many things, i will have to do them when a building is built, and again every few min. |
| 09-18-2004, 02:42 AM | #4 |
You have to use "function VarifyTypeofD" without the ". The reason is that you pass a function reference here and do not call that function and pass the return value. |
