HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Lol! Interesting little script, is it bad? :P

01-13-2009, 04:12 AM#1
Blackroot
Well I don't know about you but I was getting fed up making four seperate functions and four timers to handle the common remove of 'temporary' objects.

Then it hit me:
widgets.

I was like OMG WIDGETS LOLOL! So I made a function SetWidgetExpire. It's a long story, but it didin't work because there's no Remove/DestroyWidget :(

So needless to say I was angry at blizzard for the oversight. But then it came to me in a dream!

Expand JASS:

It works, the widget does expire. Besides the obvious fact that if you get the wrong integer to denote the type causing a thread crash or wc3 crash, it works. My question is, how reliable is this? I'm always suspect of return bugging, but I'm return bugging an integer handle to an integer handle, right?

At any rate, can anyone tell me if this is going to be reliable? I'd hate to start a general implementation and have my script start exploding.

[Note to self: Effect does not extend the widget type... Whoops :D.]
01-13-2009, 04:14 AM#2
Ammorth
What use would this be for?
01-13-2009, 04:16 AM#3
Blackroot
Observe:

Code:
function Trig_DoodadAnimTest_Func002002 takes nothing returns nothing
    local destructable d = GetEnumDestructable()
    call SetDestructableAnimationSpeed(d, .1)
    call SetDestructableAnimation(d, "death")
    call QueueDestructableAnimation(d, "Birth")
    call SetWidgetExpire(d, 6.00,  1)
endfunction

function Trig_DoodadAnimTest_Actions takes nothing returns nothing
    call AddSpecialEffectLocBJ( GetRectCenter(gg_rct_destr), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl" )
    call EnumDestructablesInRectAll( gg_rct_destr, function Trig_DoodadAnimTest_Func002002 )
endfunction

//===========================================================================
function InitTrig_DoodadAnimTest takes nothing returns nothing
    set gg_trg_DoodadAnimTest = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_DoodadAnimTest, gg_rct_Test )
    call TriggerAddAction( gg_trg_DoodadAnimTest, function Trig_DoodadAnimTest_Actions )
endfunction

This was what I designed it for. This and temporary projectiles that needed to be removed rather then expire. I wanted to avoid the use of creating multiple timer for each type.

Unfortunantly effect doesn't extend widget... So it's not quite as useful as I wanted. Really it just saves space.
01-13-2009, 06:32 AM#4
DioD
WIDGETS WTF LOL???


This is HANDLEs
01-13-2009, 06:56 AM#5
chobibo
Collapse from common.j:
type widget             extends     handle  // an interactive game object with life
type unit               extends     widget  // a single unit reference
type destructable       extends     widget
type item               extends     widget