I am learning some vJass so I played with struct so I have the ability to move local vars across functions. Here is an example I have so far.
Setup Data Trigger
Data Show Trigger
It shows "I am being called!" Debug message but it doesn't not show the data being transferred.
Setup Data Trigger
JASS:
struct Peasant
unit u
real x
real y
endstruct
function Trig_Setup_Data_Actions takes nothing returns nothing
local Peasant pea = Peasant.create()
local unit u = gg_unit_hpea_0001
local real y = GetUnitY(u)
local real x = GetUnitX(u)
set pea.u = u
set pea.y = y
set pea.x = x
endfunction
//===========================================================================
function InitTrig_Setup_Data takes nothing returns nothing
set gg_trg_Setup_Data = CreateTrigger( )
call TriggerAddAction( gg_trg_Setup_Data, function Trig_Setup_Data_Actions )
endfunction
Data Show Trigger
JASS:
function Trig_DataShow_Actions takes nothing returns nothing
local Peasant pea
call BJDebugMsg("I am being called!")
call BJDebugMsg(GetUnitName(pea.u))
call BJDebugMsg(R2S(pea.x))
call BJDebugMsg(R2S(pea.y))
endfunction
//===========================================================================
function InitTrig_DataShow takes nothing returns nothing
set gg_trg_DataShow = CreateTrigger( )
call TriggerRegisterTimerEvent( gg_trg_DataShow, 5, false)
call TriggerAddAction( gg_trg_DataShow, function Trig_DataShow_Actions )
endfunction
It shows "I am being called!" Debug message but it doesn't not show the data being transferred.