HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

There is a time limitation in Trigger Execution

04-26-2005, 05:02 AM#1
Jackyquah
Synthoms :

Note : the Variable is declare in edited Blizzard.j which import into my maps
Here is my Map Initialized Trigger : ( Costum Script )

Code:
function Trig_Melee_Initialization_Actions takes nothing returns nothing
    call ConditionalTriggerExecute( gg_trg_Init2 )
    call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "DDlg Init" ) )
endfunction

//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction

Here is my gg_Trg_Init2 Trigger : (Costum Script)

Code:
function JQA_ResetGVars takes nothing returns nothing
   local integer TInt = 0
   loop
      exitwhen TInt > 8000
      call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "TInt : " + I2S(TInt) ) )
      set jqa_GInt[TInt] = 0
      set jqa_GBool[TInt] = false
      set jqa_GUnit[TInt] = null
      set jqa_DDlg[TInt] = null
      set jqa_DDlgBut[TInt] = null
      set TInt = TInt + 1
   endloop
endfunction

function Trig_Init2_Actions takes nothing returns nothing
    call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "Reset Variablet" ) )
    call JQA_ResetGVars()
endfunction

//===========================================================================
function InitTrig_Init2 takes nothing returns nothing
    set gg_trg_Init2 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Init2, function Trig_Init2_Actions )
endfunction
.
some how the trigger is endup until TInt= 3982 and never run the rest of the loop which should be until TInt > 8000
and run the next Map Initialized (call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "DDlg Init" ) ) )[/code]

I change my JQA_ResetGVars into this :

Code:
function JQA_ResetGVars takes nothing returns nothing
   local integer TInt = 0
   loop
      exitwhen TInt > 8000
      call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "TInt : " + I2S(TInt) ) )
      set jqa_GInt[TInt] = 0
      set jqa_GBool[TInt] = false
      set jqa_GUnit[TInt] = null
      set jqa_DDlg[TInt] = null
      set jqa_DDlgBut[TInt] = null
      set TInt = TInt + 1
      if ( ModuloInteger(TInt, 3500) == 0 ) then
         call TriggerSleepAction(0.10)
      endif
   endloop
endfunction

some how the trigger is endup until TInt= 2598 and never run the rest of the loop which should be until TInt > 8000
and run the next Map Initialized (call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "DDlg Init" ) ) )


I change again my JQA_ResetGVars into this :

Code:
function JQA_ResetGVars takes nothing returns nothing
   local integer TInt = 0
   loop
      exitwhen TInt > 8000
      call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, ( "TInt : " + I2S(TInt) ) )
      set jqa_GInt[TInt] = 0
      set jqa_GBool[TInt] = false
      set jqa_GUnit[TInt] = null
      set jqa_DDlg[TInt] = null
      set jqa_DDlgBut[TInt] = null
      set TInt = TInt + 1
      if ( ModuloInteger(TInt, 2500) == 0 ) then
         call TriggerSleepAction(0.10)
      endif
   endloop
endfunction

Some how the trigger gg_Trg_Init2 runs like this
it's loop 0-2499
and wait a few second ( I don't count exact but approximately 1.5 second )
then it's again loops 2500-4999
and wait a few second ( I don't count exact but approximately 1.5 second )
then it's again loops 5000-7499
and wait a few second ( I don't count exact but approximately 1.5 second )
then it's again loops 7500-8000
it's works fine only the trigger sleep more then it's should be


conclusion :
I think Blizzard program for the trigger to run only a given time, if it's more than is should be it's cut in middle of the code and never run the rest of them.
but somehow if we wait(call TriggerSleepAction( ...) ) before the time is up it will reset the given time, when the trigger run again. ?

Need Feedback Am I wrong ?
I run them at : Pentium II 350 Mhz ( which is bellow minimum requirement Pentium II 400 Mhz ) and 128 MB ram.
if you had better computer and the symthom never come up perhaps you should double the action in loop in JQA_ResetGVars Function.
if it's still never come up perhaps it's only bugs in my computer ?
04-26-2005, 01:23 PM#2
Tommi
This is common knowledge. There is a limit how many actions you can process in one thread at once. TriggerSleepAction() allows other threads to process their actions, and thus it resets the action count for the thread it is called in.
04-27-2005, 09:35 PM#3
Jackyquah
Quote:
Originally Posted by Tommi
This is common knowledge. There is a limit how many actions you can process in one thread at once. TriggerSleepAction() allows other threads to process their actions, and thus it resets the action count for the thread it is called in.

How can I know :
How much Action point(Number of Action) limit for a trigger run at once without using TriggerSleepAction ?

is All Function counted as one Action or it's not ?

if not Is there a list of Action point for a function ?
like StoreInteger() function how much Action point it used ?

Is there a way to delimit the actions I can process ? ( without using TriggerSleepAction() )
04-28-2005, 12:00 PM#4
Tommi
You need to ask Blizzard. They programmed the whole thing. ;)
04-28-2005, 05:00 PM#5
Vexorian
IT actually depends on the time the actions take rather than the number of actions, at least weaaddar claimed that.

Also you can get around that without using TriggerSleepAction, use ExecuteFunc to create another thread

Moved to the script section
04-29-2005, 07:46 PM#6
Jackyquah
Is there a way to passing parameter using ExecuteFunc without using Global variable ?
04-29-2005, 09:48 PM#7
Jackyquah
Is ExecuteFunc always run it in the first place when the other thread/trigger is waiting in line or it's wait in line too ?

I mean there is trigger 1 which have action that set global variable aaa, then call ExecuteFunc( "Function1" ). in function1 there is a code that set local variable with the value of global variable aaa which is set by trigger1.
and there is no wait action between set aaa, ExecuteFunc and set local variable, are they save( aaa remain unchanged until it's value passed to local variable ) ?
04-29-2005, 11:17 PM#8
Vexorian
Code:
function a takes nothing returns nothing
    set udg_global=3
    call ExecuteFunc("oh")
    set udg_global=1
    call BJDebugMsg("----")
    call ExecuteFunc("oh")
    call BJDebugMsg("wait")
endfunction

function oh takes nothing returns nothing
    call BJDebugMsg(I2S(udg_global))
    call TriggerSleepAction(0)
    call BJDebugMsg(I2S(udg_global))

endfunction

if you run a() it will show:

3
----
1
Wait
1
1