| 07-25-2008, 04:24 PM | #1 |
I have a function is one trigger then a second trigger below that with a jass script that calls the function in the trigger above it. Why does it keep telling me: "Expected a function name" when said function exist? Jass data below: I've placed them in this thread as it appears in my editor. JASS:function update_combat_log takes integer p, string s returns nothing local string array c local integer i = 1 loop exitwhen i > 10 set c[i] = GetStoredString(udg_wow_cache, "combatlog_"+I2S(p), "row_"+I2S(i)) set i = i + 1 endloop set i = 1 loop exitwhen i > 10 call StoreString(udg_wow_cache, "combatlog_"+I2S(p), "row_"+I2S(i), c[i+1]) set i = i + 1 endloop call StoreString(udg_wow_cache, "combatlog_"+I2S(p), "row_10", s) endfunction //=========================================================================== function InitTrig_Combat_Log_Main_Script takes nothing returns nothing endfunction JASS:function Trig_Attacked_Actions takes nothing returns nothing call update_combat_log( 1, GetUnitName(GetAttacker()) + " attacks " + GetUnitName(GetAttackedUnitBJ()) + I2S(GetRandomInt(1, 1000)) ) endfunction //=========================================================================== function InitTrig_Attacked takes nothing returns nothing set gg_trg_Attacked = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Attacked, EVENT_PLAYER_UNIT_ATTACKED ) call TriggerAddAction( gg_trg_Attacked, function Trig_Attacked_Actions ) endfunction |
| 07-25-2008, 04:33 PM | #2 |
Have you tried placing the update_combat_log function in the custom script section already? ---Edit--- If you don't know where it is, click on the map icon in the trigger editor. |
| 07-25-2008, 06:44 PM | #3 |
I think the problem is that the worldedit processes the triggers not in the order they are in the User Interface, but in the (chronological) order you create them. So either you go the way Fireeye explained (which will be imho the better one, since you prevent such things from happening generally) or you delete the first trigger and create it new. |
| 07-25-2008, 07:14 PM | #4 |
add content of first trigger into second one. since it isnt trigger (no event) this wotn affect game. |
| 07-26-2008, 02:29 AM | #5 |
This script JASS:function update_combat_log takes integer p, string s returns nothing local string array c local integer i = 1 loop exitwhen i > 10 set c[i] = GetStoredString(udg_wow_cache, "combatlog_"+I2S(p), "row_"+I2S(i)) set i = i + 1 endloop set i = 1 loop exitwhen i > 10 call StoreString(udg_wow_cache, "combatlog_"+I2S(p), "row_"+I2S(i), c[i+1]) set i = i + 1 endloop call StoreString(udg_wow_cache, "combatlog_"+I2S(p), "row_10", s) endfunction //=========================================================================== function InitTrig_Combat_Log_Main_Script takes nothing returns nothing endfunction JASS:function Trig_Attacked_Actions takes nothing returns nothing call update_combat_log( 1, GetUnitName(GetAttacker()) + " attacks " + GetUnitName(GetAttackedUnitBJ()) + I2S(GetRandomInt(1, 1000)) ) endfunction //=========================================================================== function InitTrig_Attacked takes nothing returns nothing set gg_trg_Attacked = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Attacked, EVENT_PLAYER_UNIT_ATTACKED ) call TriggerAddAction( gg_trg_Attacked, function Trig_Attacked_Actions ) endfunction |
| 07-26-2008, 01:11 PM | #6 |
This script works fine when isolated (if the second trigger is really beneath the first one), so please extract surrounding triggers/functions, it might be related to those. |
