View Single Post
Old 12-26-2006, 07:13 AM   #37
BlinkBoy
User
 
BlinkBoy's Avatar


Respected User
 
Join Date: Dec 2003
Posts: 835

Submissions (4)

BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)

Outstanding Tutorial

Default

So you adding to it anything new?. I think you should add Events for Objects.

Collapse JASS:
// Just a simple example, to help encapsulation
struct data
         string dat = ""
         // Events only takes values, they don't return any message
         Event CreatedData takes  data TriggeringData
         static method Create takes string s returns data
                  local data d = data.create()
                  set d.dat = s
                  // calls a function that makes every trigger with this event to run
                  call data.RaiseEvent(CreatedData(d))
                  return d
          endmethod
endstruct

function Trig_Test2_Actions takes nothing returns nothing
         call BJDebugMsg("Someone just created a Data type with dat: " + data.TriggeringData.dat)
endfunction

//===========================================================================
function InitTrig_Test2 takes nothing returns nothing
    set gg_trg_Test2 = CreateTrigger(  )
    call data.RegisterEvent(gg_trg_Test2, CreatedData)
    call TriggerAddAction( gg_trg_Test, function Trig_Test2_Actions )
endfunction

function Trig_Test_Actions takes nothing returns nothing
local data mydat = data.Create("I just filled the string")
call mydat.destroy()
endfunction

//===========================================================================
function InitTrig_Test takes nothing returns nothing
    set gg_trg_Test = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Test, 2.00 )
    call TriggerAddAction( gg_trg_Test, function Trig_Test_Actions )
endfunction
       
BlinkBoy is offline   Reply With Quote