HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why this bug now?

01-03-2009, 09:28 PM#1
Saishy
I was so happy because my code wasn't giving any errors, and then...

"Syntax Error"

Collapse JASS:
set u.pother[GetPlayerId(GetOwningPlayer(tempunit))] = GetUnitLoc(tempunit)

I know its probably something very dumb, but I can't find it!
01-03-2009, 09:54 PM#2
Ammorth
I would say the error is being caused by the whitespace both above and below the line. Aka: post the entire script so we can see it. A line does not help us, and nor does the ambiguity in "Syntax Error".
01-04-2009, 12:09 AM#3
Saishy
Quote:
Originally Posted by Ammorth
I would say the error is being caused by the whitespace both above and below the line. Aka: post the entire script so we can see it. A line does not help us, and nor does the ambiguity in "Syntax Error".
Ok, but the code is being converted from GUI to JASS and to use TimerUtils library. Its not finished yet.

Collapse JASS:
scope UnlimitedBladeWorks initializer Init_UBW

private struct UBW
    unit archer
    unit uother[12]
    location pother[12]
    integer count
endstruct

private function Trig_UBW_start_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A01W' ) ) then
        return false
    endif
    return true
endfunction

private function IsEnemyHero takes nothing returns boolean
    return (((IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()))) and (IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)) and (IsUnitIllusion(GetTriggerUnit()) == false)) == true)
endfunction

private function Trig_UBW_start_Func005Func005Func005Func005Func004A takes nothing returns nothing
    call RemoveLocation(udg_temppoint)
    set udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))] = GetUnitLoc(GetEnumUnit())
    call AddSpecialEffectLocBJ( udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))], "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl" )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    set udg_temppoint = PolarProjectionBJ(GetRectCenter(gg_rct_Unlimited_Blade_Works), 250.00, 270.00)
    call SetUnitPositionLoc( GetEnumUnit(), udg_temppoint )
    set udg_temppoint = GetRectCenter(gg_rct_Unlimited_Blade_Works)
    call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetEnumUnit()), udg_temppoint, 0 )
endfunction

private function Trig_UBW_start_Func005Func005Func005Func005Func021A takes nothing returns nothing
    call SetUnitPositionLoc( GetEnumUnit(), udg_UBW_Pos[GetConvertedPlayerId(GetEnumPlayer())] )
    call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))], 0 )
endfunction

private function UBW_ItemPos takes nothing returns nothing
    local location temppoint = Location(-2684.00, 5240.00)
    call SetItemPositionLoc( GetEnumItem(), temppoint)
    call RemoveLocation(temppoint)
endfunction

private function UBW_boolean takes nothing returns boolean
    if ( IsUnitAliveBJ(GetTriggerUnit()) == true ) then
        return true
    endif
    return false
endfunction

private function UBW_Phrases takes nothing returns nothing
    local UBW u = GetTimerData(GetExpiredTimer())
    local timer t
    local location temppoint1
    local location temppoint2
    local group genemy
    local unit tempunit
    
    if ( UBW_boolean() and (u.count == 1) ) then
        call CreateTextTagUnitBJ( "I have created over a thousand blades.|nUnknown to death. Nor known to life.", u.archer, 0, 10, 100, 100, 100, 0 )
        call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
        call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.50 )
        
        if ( UBW_boolean() and (u.count == 2) ) then
            call CreateTextTagUnitBJ( "Have withstood pain to create many weapons.|nYet, those hands will never hold anything.", u.archer, 0, 10, 100, 100, 100, 0 )
            call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
            call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.50 )
            
            if ( UBW_boolean() and (u.count == 3) ) then
                call CreateTextTagUnitBJ( "So as I pray, Unlimited Blade Works.", u.archer, 0, 10, 100, 100, 100, 0 )
                call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
                call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.50 )
                
                if ( UBW_boolean() and (u.count == 4) ) then
                    set temppoint1 = GetUnitLoc(u.archer)
                    call AddSpecialEffectLocBJ( temppoint1, "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl" )
                    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
                    call RemoveLocation(temppoint1)
                    //call ForGroupBJ( GetUnitsInRangeOfLocMatching(600.00, udg_temppoint, Condition(function IsEnemyHero), function Trig_UBW_start_Func005Func005Func005Func005Func004A )
                    call GroupEnumUnitsInRangeOfLoc(genemy, temppoint1, 600, Condition(function IsEnemyHero)) 
                    
                    loop
                        set tempunit = FirstOfGroup(genemy)
                        exitwhen tempunit == null
                        set u.pother[GetPlayerId(GetOwningPlayer(tempunit))] = GetUnitLoc(tempunit)
                        call AddSpecialEffectLocBJ( udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))], "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl" )
                        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
                        set temppoint1 = GetRectCenter(gg_rct_Unlimited_Blade_Works)
                        set temppoint2 = PolarProjectionBJ(temppoint1, 250.00, 270.00)
                        call SetUnitPositionLoc( GetEnumUnit(), temppoint2 )
                        call RemoveLocation(temppoint2)
                        call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetEnumUnit()), temppoint1, 0 )
                        call RemoveLocation(temppoint1)
                    endloop
                    
                    set udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = GetUnitLoc(GetTriggerUnit())
                    set udg_temppoint = PolarProjectionBJ(GetRectCenter(gg_rct_Unlimited_Blade_Works), 250.00, 90.00)
                    call SetUnitPositionLoc( GetTriggerUnit(), udg_temppoint )
                    set udg_temppoint = GetRectCenter(gg_rct_Unlimited_Blade_Works)
                    call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), udg_temppoint, 0 )
                    call UnitAddAbilityBJ( 'A021', GetTriggerUnit() )
                    call SetUnitAbilityLevelSwapped( 'A01Y', GetTriggerUnit(), GetUnitAbilityLevelSwapped('A01W', GetTriggerUnit()) )
                    call SetPlayerAbilityAvailableBJ( false, 'A021', GetOwningPlayer(GetTriggerUnit()) )
                    call UnitAddAbilityBJ( 'A01X', GetTriggerUnit() )
                    call SetUnitAbilityLevelSwapped( 'A01X', GetTriggerUnit(), GetUnitAbilityLevelSwapped('A01W', GetTriggerUnit()) )
                    call UnitAddAbilityBJ( 'A01H', GetTriggerUnit() )
                    call SetUnitAbilityLevelSwapped( 'A01H', GetTriggerUnit(), GetUnitAbilityLevelSwapped('A01W', GetTriggerUnit()) )
                    call UnitAddAbilityBJ( 'A01Z', GetTriggerUnit() )
                    call SetUnitAbilityLevelSwapped( 'A01Z', GetTriggerUnit(), GetUnitAbilityLevelSwapped('A01W', GetTriggerUnit()) )
                    call EnableTrigger( gg_trg_UBW_mana_regen )
                    call TriggerSleepAction( ( 4.00 + ( 2.00 * I2R(GetUnitAbilityLevelSwapped('A01W', GetTriggerUnit())) ) ) )
                    call ForGroupBJ( GetUnitsInRectAll(gg_rct_Unlimited_Blade_Works), function Trig_UBW_start_Func005Func005Func005Func005Func021A )
                    call EnumItemsInRect(gg_rct_Unlimited_Blade_Works, null, function UBW_ItemPos)
                    call UnitRemoveAbilityBJ( 'A021', GetTriggerUnit() )
                    call UnitRemoveBuffBJ( 'B009', GetTriggerUnit() )
                    call UnitRemoveAbilityBJ( 'A01X', GetTriggerUnit() )
                    call UnitRemoveAbilityBJ( 'A01H', GetTriggerUnit() )
                    call UnitRemoveAbilityBJ( 'A01Z', GetTriggerUnit() )
                    call DisableTrigger( gg_trg_UBW_mana_regen )
                else
                endif
            else
            endif
        else
        endif
    else
    endif
    
    set u.count = u.count +1
    call ReleaseTimer(GetExpiredTimer())
    
    if (u.count < 5) then
        set t = NewTimer()
        call SetTimerData(t,u)
        call TimerStart(t, 2.5, false, function UBW_Phrases)
    else
        call PauseTimer(t)
        call DestroyTimer(t)
        set t = null
        call ReleaseTimer(GetExpiredTimer())
    endif
    
    call u.destroy()
    call RemoveLocation(temppoint1)
    call RemoveLocation(temppoint2)
    call RemoveLocation(udg_UBW_Pos[1])
    call RemoveLocation(udg_UBW_Pos[2])
    call RemoveLocation(udg_UBW_Pos[3])
    call RemoveLocation(udg_UBW_Pos[4])
    call RemoveLocation(udg_UBW_Pos[5])
    call RemoveLocation(udg_UBW_Pos[6])
    call RemoveLocation(udg_UBW_Pos[7])
    call RemoveLocation(udg_UBW_Pos[8])
    call RemoveLocation(udg_UBW_Pos[9])
    call RemoveLocation(udg_UBW_Pos[10])
    call RemoveLocation(udg_UBW_Pos[11])
    call RemoveLocation(udg_UBW_Pos[12])
endfunction

private function Trig_UBW_start_Actions takes nothing returns nothing
    local item tempitem
    local UBW u = UBW.create()
    local timer t = NewTimer()
    set u.archer = GetTriggerUnit()
    call CreateTextTagUnitBJ( "I am the bone of my sword.|nSteel is my body, and fire is my blood.", u.archer, 0, 10, 100, 100, 100, 0 )
    call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
    call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.50 )
    set u.count = 1
    call SetTimerData(t,u)
    call TimerStart(t, 2.5, false, function UBW_Phrases)
    set u.archer = null
endfunction

//===========================================================================
private function Init_UBW takes nothing returns nothing
    local trigger UBW_start = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( UBW_start, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( UBW_start, Condition( function Trig_UBW_start_Conditions ) )
    call TriggerAddAction( UBW_start, function Trig_UBW_start_Actions )
    set UBW_start = null
endfunction

endscope
01-04-2009, 03:43 AM#4
Vexorian
Are you sure the message is "Syntax Error" and that the line in question is that one?

I can't think of an explanation for this, I also copied that line and made my own struct with a pother location array and a local tempunit unit, but it doesn't trigger syntax errors.
01-04-2009, 03:50 AM#5
Pyrogasm
You forgot "array":
Collapse JASS:
private struct UBW
    unit archer
    unit array uother[12]
    location array pother[12]
    integer count
endstruct
01-04-2009, 01:07 PM#6
Saishy
Quote:
Originally Posted by Saishy
I know its probably something very dumb, but I can't find it!
Quote:
Originally Posted by Pyrogasm
You forgot "array":
Collapse JASS:
private struct UBW
    unit archer
    unit array uother[12]
    location array pother[12]
    integer count
endstruct
Lol thanks!

Thanks all the others too!

Edit: When using TimerUtil after I attach my struct to the timer, do I need to clean leaks?
01-04-2009, 01:23 PM#7
akolyt0r
i think you have to clean them after you are totally finished with them and wont use them again !?

Eh and i spotted a TriggerSleepAction in your trigger, notice that TriggerSleepAction continues running even when game is paused etc ...this might fuck your ability if that happens.
Use PolledWait instead (but that one leaks slightly ...so use PolledWait2 see below)
Expand JASS:
01-04-2009, 01:51 PM#8
Saishy
Quote:
Originally Posted by akolyt0r
i think you have to clean them after you are totally finished with them and wont use them again !?

Eh and i spotted a TriggerSleepAction in your trigger, notice that TriggerSleepAction continues running even when game is paused etc ...this might fuck your ability if that happens.
Use PolledWait instead (but that one leaks slightly ...so use PolledWait2 see below)
Expand JASS:

Because of that I changed my ability to use timers, but only the first phrase is show, could someone help-me?

Collapse JASS:
scope UnlimitedBladeWorks initializer Init_UBW

private struct UBW
    unit archer
    location parcher
    unit array uother[12]
    location array pother[12]
    integer count
endstruct

private function Trig_UBW_start_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A01W' ) ) then
        return false
    endif
    return true
endfunction

private function IsEnemyHero takes nothing returns boolean
    return (((IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()))) and (IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)) and (IsUnitIllusion(GetTriggerUnit()) == false)) == true)
endfunction

//private function Trig_UBW_start_Func005Func005Func005Func005Func004A takes nothing returns nothing
//    call RemoveLocation(udg_temppoint)
//    set udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))] = GetUnitLoc(GetEnumUnit())
//    call AddSpecialEffectLocBJ( udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))], "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl" )
//    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
//    set udg_temppoint = PolarProjectionBJ(GetRectCenter(gg_rct_Unlimited_Blade_Works), 250.00, 270.00)
//    call SetUnitPositionLoc( GetEnumUnit(), udg_temppoint )
//    set udg_temppoint = GetRectCenter(gg_rct_Unlimited_Blade_Works)
//    call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetEnumUnit()), udg_temppoint, 0 )
//endfunction

//private function Trig_UBW_start_Func005Func005Func005Func005Func021A takes nothing //returns nothing
//    call SetUnitPositionLoc( GetEnumUnit(), //udg_UBW_Pos[GetConvertedPlayerId(GetEnumPlayer())] )
//    call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), //udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))], 0 )
//endfunction

private function UBW_ItemPos takes nothing returns nothing
    local location temppoint = Location(-2684.00, 5240.00)
    call SetItemPositionLoc( GetEnumItem(), temppoint)
    call RemoveLocation(temppoint)
    set temppoint = null
endfunction

private function UBW_boolean takes nothing returns boolean
    if ( IsUnitAliveBJ(GetTriggerUnit()) == true ) then
        return true
    endif
    return false
endfunction

private function UBW_battle takes nothing returns nothing
    local UBW u = GetTimerData(GetExpiredTimer())
    local integer ti = 0
    local group genemy
    local unit tempunit
    
    //call ForGroupBJ( GetUnitsInRectAll(gg_rct_Unlimited_Blade_Works), function Trig_UBW_start_Func005Func005Func005Func005Func021A )
    call SetUnitPositionLoc(u.archer, u.parcher)
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(u.archer), u.parcher, 0)
    set genemy = GetUnitsInRectMatching(gg_rct_Unlimited_Blade_Works, null)
    
    loop
        set tempunit = FirstOfGroup(genemy)
        exitwhen tempunit == null
        call SetUnitPositionLoc(tempunit, u.pother[GetPlayerId(GetOwningPlayer(tempunit))])
        call PanCameraToTimedLocForPlayer(GetOwningPlayer(tempunit), u.pother[GetPlayerId(GetOwningPlayer(tempunit))], 0)
        //call SetUnitPositionLoc( u.uother[GetPlayerId(GetEnumPlayer())], u.pother[GetPlayerId(GetEnumPlayer())])
        //call PanCameraToTimedLocForPlayer( GetOwningPlayer(tempunit), udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))], 0 )
    endloop
    
    call EnumItemsInRect(gg_rct_Unlimited_Blade_Works, null, function UBW_ItemPos)
    call UnitRemoveAbilityBJ( 'A021', u.archer )
    call UnitRemoveBuffBJ( 'B009', u.archer )
    call UnitRemoveAbilityBJ( 'A01X', u.archer )
    call UnitRemoveAbilityBJ( 'A01H', u.archer )
    call UnitRemoveAbilityBJ( 'A01Z', u.archer )
    call DisableTrigger( gg_trg_UBW_mana_regen )
     
    set ti = 0
    loop
    exitwhen ti == 11
    set u.pother[ti] = null
    call RemoveLocation(u.pother[ti])
    set u.pother[ti] = null
    set ti = ti + 1
    endloop
    
    set u.archer = null
    call DestroyGroup(genemy)
    call ReleaseTimer(GetExpiredTimer())
    call u.destroy()
endfunction

private function UBW_Phrases takes nothing returns nothing
    local UBW u = GetTimerData(GetExpiredTimer())
    local timer t
    local location temppoint1
    local location temppoint2
    local group genemy
    local unit tempunit
    local integer ti
    
    if ( UBW_boolean() and (u.count == 1) ) then
        call CreateTextTagUnitBJ( "I have created over a thousand blades.|nUnknown to death. Nor known to life.", u.archer, 0, 10, 100, 100, 100, 0 )
        call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
        call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.50 )
        
        if ( UBW_boolean() and (u.count == 2) ) then
            call CreateTextTagUnitBJ( "Have withstood pain to create many weapons.|nYet, those hands will never hold anything.", u.archer, 0, 10, 100, 100, 100, 0 )
            call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
            call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.50 )
            
            if ( UBW_boolean() and (u.count == 3) ) then
                call CreateTextTagUnitBJ( "So as I pray, Unlimited Blade Works.", u.archer, 0, 10, 100, 100, 100, 0 )
                call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
                call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.50 )
                
                if ( UBW_boolean() and (u.count == 4) ) then
                    set temppoint1 = GetUnitLoc(u.archer)
                    call AddSpecialEffectLocBJ( temppoint1, "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl" )
                    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
                    call RemoveLocation(temppoint1)
                    //call ForGroupBJ( GetUnitsInRangeOfLocMatching(600.00, udg_temppoint, Condition(function IsEnemyHero), function Trig_UBW_start_Func005Func005Func005Func005Func004A )
                    call GroupEnumUnitsInRangeOfLoc(genemy, temppoint1, 600, Condition(function IsEnemyHero)) 
                    
                    loop
                        set tempunit = FirstOfGroup(genemy)
                        exitwhen tempunit == null
                        set u.pother[GetPlayerId(GetOwningPlayer(tempunit))] = GetUnitLoc(tempunit)
                        call AddSpecialEffectLocBJ( udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))], "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl" )
                        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
                        set temppoint1 = GetRectCenter(gg_rct_Unlimited_Blade_Works)
                        set temppoint2 = PolarProjectionBJ(temppoint1, 250.00, 270.00)
                        call SetUnitPositionLoc( GetEnumUnit(), temppoint2 )
                        call RemoveLocation(temppoint2)
                        call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetEnumUnit()), temppoint1, 0 )
                        call RemoveLocation(temppoint1)
                    endloop
                    
                    //set udg_UBW_Pos[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = GetUnitLoc(GetTriggerUnit())
                    set u.parcher = GetUnitLoc(u.archer)
                    set temppoint1 = GetRectCenter(gg_rct_Unlimited_Blade_Works)
                    set temppoint2 = PolarProjectionBJ(temppoint1, 250.00, 90.00)
                    call SetUnitPositionLoc( u.archer, temppoint2 )
                    call PanCameraToTimedLocForPlayer( GetOwningPlayer(u.archer), temppoint1, 0 )
                    call UnitAddAbilityBJ( 'A021', u.archer )
                    call SetUnitAbilityLevelSwapped( 'A01Y', u.archer, GetUnitAbilityLevelSwapped('A01W', u.archer) )
                    call SetPlayerAbilityAvailableBJ( false, 'A021', GetOwningPlayer(u.archer) )
                    call UnitAddAbilityBJ( 'A01X', u.archer )
                    call SetUnitAbilityLevelSwapped( 'A01X', u.archer, GetUnitAbilityLevelSwapped('A01W', u.archer) )
                    call UnitAddAbilityBJ( 'A01H', u.archer )
                    call SetUnitAbilityLevelSwapped( 'A01H', u.archer, GetUnitAbilityLevelSwapped('A01W', u.archer) )
                    call UnitAddAbilityBJ( 'A01Z', u.archer )
                    call SetUnitAbilityLevelSwapped( 'A01Z', u.archer, GetUnitAbilityLevelSwapped('A01W', u.archer) )
                    call EnableTrigger( gg_trg_UBW_mana_regen )
                    //call TriggerSleepAction( ( 4.00 + ( 2.00 * I2R(GetUnitAbilityLevelSwapped('A01W', GetTriggerUnit())) ) ) )
                else
                endif
            else
            endif
        else
        endif
    else
    endif
    
    set u.count = u.count +1
    call ReleaseTimer(GetExpiredTimer())
    
    if (u.count < 5) then
        set t = NewTimer()
        call SetTimerData(t,u)
        call TimerStart(t, 2.5, false, function UBW_Phrases)
    else
        set ti = (( 4 + ( 2 * (GetUnitAbilityLevelSwapped('A01W', GetTriggerUnit())))))
        set t = NewTimer()
        call SetTimerData(t,u)
        call TimerStart(t, ti, false, function UBW_battle)
    endif
    
    set ti = 0
    loop
    exitwhen ti == 11
    set u.pother[ti] = null
    call RemoveLocation(u.pother[ti])
    set u.pother[ti] = null
    set ti = ti + 1
    endloop
    
    set u.archer = null
    call u.destroy()
    call DestroyGroup(genemy)
    call RemoveLocation(temppoint1)
    call RemoveLocation(temppoint2)
endfunction

private function Trig_UBW_start_Actions takes nothing returns nothing
    local item tempitem
    local UBW u = UBW.create()
    local timer t = NewTimer()
    set u.archer = GetTriggerUnit()
    call CreateTextTagUnitBJ( "I am the bone of my sword.|nSteel is my body, and fire is my blood.", u.archer, 0, 10, 100, 100, 100, 0 )
    call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
    call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.50 )
    set u.count = 1
    call SetTimerData(t,u)
    call TimerStart(t, 2.5, false, function UBW_Phrases)
    set u.archer = null
endfunction

//===========================================================================
private function Init_UBW takes nothing returns nothing
    local trigger UBW_start = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( UBW_start, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( UBW_start, Condition( function Trig_UBW_start_Conditions ) )
    call TriggerAddAction( UBW_start, function Trig_UBW_start_Actions )
    set UBW_start = null
endfunction

endscope

Also, there isn't any problems in using that polledwait2? Because if isn't, I just wasted some hours of my life...
Edit: Also, how do I use it?
01-04-2009, 06:34 PM#9
Zerzax
Firstly: You do not need to clean TimerUtils stack timers, only release them. Do not do anything else to "clean" them. Also, use these timers (only 1 if possible) instead of any waits, especially since you are already using them.
01-04-2009, 07:44 PM#10
Themerion
Quote:
Also, there isn't any problems in using that polledwait2? Because if isn't, I just wasted some hours of my life...
Edit: Also, how do I use it?

Ehrm...

http://www.wc3campaigns.net/showthread.php?t=103890
01-04-2009, 10:19 PM#11
Saishy
Quote:
Originally Posted by Zerzax
Firstly: You do not need to clean TimerUtils stack timers, only release them. Do not do anything else to "clean" them. Also, use these timers (only 1 if possible) instead of any waits, especially since you are already using them.
I didn't got it...
What I'm doing wrong exactly?
01-04-2009, 11:05 PM#12
Zerzax
I'm answering your question: You don't need to clean TimerUtils timers, only recycle them with NewTimer and ReleaseTimer. Second, I recommend those in place of using any waits, such as PolledWait2
01-05-2009, 02:05 PM#13
Saishy
Quote:
Originally Posted by Zerzax
I'm answering your question: You don't need to clean TimerUtils timers, only recycle them with NewTimer and ReleaseTimer. Second, I recommend those in place of using any waits, such as PolledWait2
Thanks, but what about the structs?

But someone can help-me why my spell just say the first phrase and stop working?
01-05-2009, 02:33 PM#14
Zerzax
Okay, I don't really understand what's going on. Rephrase the problem and I'll try to help
01-05-2009, 07:44 PM#15
Saishy
Quote:
Originally Posted by Zerzax
Okay, I don't really understand what's going on. Rephrase the problem and I'll try to help
I mean, I need to do this? (I'm using // to show the lines...)

Collapse JASS:
private struct mystruct
    unit runit
    location rloc
endstruct

Collapse JASS:
local mystruct lol
local timer t = NewTimer()
call SetTimerData(t,u)
call TimerStart(t, 2.5, false, function Bellow)
//call RemoveLocation(lol.rloc)
//set lol.runit = null

Collapse JASS:
local mystruct lol = GetTimerData(GetExpiratedTimer())
call ReleaseTimer(GetExpiredTimer())
//call RemoveLocation(lol.rloc)
//set lol.runit = null

And, why my spell don't work? Only the function Trig_UBW_start_Actions ran.