Trigger_limits = 11
function trigger_creator()   --create the trigger
local screenNo =we_bas_getshort("@W_HDW100")  --Get the screen No.
local triggerID =we_bas_getword("@W_HDW102")  --Get the trigger ID
local triggerType =we_bas_getword("@W_HDW104")--Get the trigger type
trigger.create(screenNo, triggerID, triggerType, "@B_HDX0.0", add)
we_bas_setbit("@B_HDX1.0", 1) --trigger to start the getType()
--timer.create(a,b,c,demo)
end
function trigger_getType() --get the current type of trigger
local screenNo =we_bas_getshort("@W_HDW100")
local triggerID =we_bas_getword("@W_HDW102")
local triggerType = trigger.get_type(screenNo, triggerID) 
  if  triggerType~= nil then --Determine the current trigger state
  --print("triggerType:"..triggerType)
  we_bas_setshort("@W_HDW105", triggerType) --Display the status on the object
  end 
end
function trigger_modification()  --modify the trigger type of trigger
local screenNo =we_bas_getshort("@W_HDW100")
local triggerID =we_bas_getword("@W_HDW102")
local triggerType =we_bas_getword("@W_HDW104")
trigger.set_type(screenNo, triggerID, triggerType)

end
function trigger_getStatus()   --get the current status of trigger
local screenNo =we_bas_getshort("@W_HDW100")
local triggerID =we_bas_getword("@W_HDW102")
local status = trigger.get_status(screenNo, triggerID)
we_part_setstate("0_Lua_1", status)  
end
function trigger_statusSwitch()  --Enable the trigger or not
local screenNo =we_bas_getshort("@W_HDW100")
local triggerID =we_bas_getword("@W_HDW102")
local status = (we_part_getstate("0_Lua_3"))  --Get the status of trigger
  if status == 0 then                      
      trigger.set_status(screenNo, triggerID, 0)          --Disable the trigger
      we_part_setstate("0_Lua_3", 1)
  else
      trigger.set_status(screenNo, triggerID, 1)          --Enable the trigger
      we_part_setstate("0_Lua_3", 0)
  end
end
function add()   --demonstration function
 print("Hello world")
 local val1 = we_bas_getword("@W_HDW10")  
 local val2 = we_bas_getword("@W_HDW12")
 res = val1 + val2
 we_bas_setword("@W_HDW14", res)     --Addition
 
end