| 08-31-2009, 03:02 AM | #1 |
I can't seem to get this to work - all LoadWhatever calls return null. It's as if the hashtable isn't initialized (which it is). Am I missing something basic here? Btw I tried similar code in an empty map where it worked fine. I'd be thankful for any help you can give me. JASS:function Trig_Initialization_Actions takes nothing returns nothing set udg_oth_handles = InitHashtable() //other init stuff //... endfunction JASS:function Trig_ResearchPoints_RepeatOrder takes nothing returns nothing local timer t = GetExpiredTimer() local integer h = GetHandleId(t) call IssueImmediateOrderById(LoadUnitHandle(udg_oth_handles, h, 0), LoadInteger(udg_oth_handles, h, 1)) call FlushChildHashtable(udg_oth_handles, h) call DestroyTimer(t) set t = null endfunction function Trig_ResearchPoints_Actions takes nothing returns nothing local timer t local integer h //irrelevant stuff //... //end irrelevant stuff if ( GetResearched() == udg_ai_repeat_order_tech[GetUnitUserData(GetResearchingUnit())] or GetResearched() == udg_ai_repeat_order_civic[GetUnitUserData(GetResearchingUnit())] ) then set t = CreateTimer() set h = GetHandleId(t) call SaveUnitHandle(udg_oth_handles, h, 0, GetResearchingUnit()) call SaveInteger(udg_oth_handles, h, 1, GetResearched()) call TimerStart(t, 0.0, false, function Trig_ResearchPoints_RepeatOrder) set t = null endif endfunction |
| 08-31-2009, 08:19 AM | #2 |
Hmm... you sure the Trig_Initialization_Actions function run before the other functions? Does the other init stuffs run correctly? Maybe you forgot to make the trigger run on map initialization? |
| 08-31-2009, 03:05 PM | #3 |
This is strange. When I change JASS:function Trig_Initialization_Actions takes nothing returns nothing set udg_oth_handles = InitHashtable() //other init stuff //... endfunction to JASS:function Trig_Initialization_Actions takes nothing returns nothing call BJDebugMsg("before ht init") set udg_oth_handles = InitHashtable() call BJDebugMsg("after ht init") //other init stuff //... endfunction it works as expected. That is both the hashtable and the messages. EDIT: The problem was probably a corrupted wc3/jngp on my laptop. The original code compiles and works correctly on my desktop pc. |
