• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Vex's spell sample is buggy?

Status
Not open for further replies.
Level 11
Joined
Jul 12, 2005
Messages
764
I read Vexorian's tutorial about vJass, structs, and the MUI timer method without HandleVars.
Now here is my problem. In the third part. He gave a sample, i followed it, copied it, compared it, everything.. I think i understood the whole structure. But it is not that MUI as it supposed to be :S
JASS:
scope NewScope

private struct data
    integer n = 0
    boolean DestroyStruct = false
endstruct

globals
    private data array DataArray
    private integer Total = 0
    private timer Timer = CreateTimer()
endglobals

private function NewScopeTimer takes nothing returns nothing
    local integer i = 0
    local data d
    loop
        exitwhen i == Total
        set d = DataArray[Total-1]
            
        if d.DestroyStruct then
            set DataArray[i] = DataArray[Total-1]
            set Total = Total - 1
            call d.destroy()
            set i = i - 1
        else

//Am i doing sthg wrong here??
//
//            if d.n > 500 then
//                set d.DestroyStruct = true
//            else
//                set d.n = d.n + 1
//            endif
//

        endif

        set i = i + 1
    endloop

    if Total == 0 then
        call PauseTimer(Timer)
    endif
endfunction

private function Trig_Test_Actions takes nothing returns nothing
    local data d = data.create()
    if Total == 0 then
        call TimerStart(Timer, 0.01, true, function NewScopeTimer)
    endif
    set Total = Total + 1
    set DataArray[Total-1] = d
endfunction

endscope

I don't post the whole trigger cause it wuold just complicate it. So is this correct? Because it is not MUI.

"scoping" it is not a problem, i removed the "private" tags, but the problem is still there.

Also, here is a template:
http://www.thehelper.net/forums/showthread.php?t=57079
Uses exactly the same structure...

Here, i attached the whole trigger:
 

Attachments

  • TestNotWorking.txt
    2.3 KB · Views: 81
Last edited:
Status
Not open for further replies.
Top