hellmonja27
Member
- Reaction score
- 16
i've been GUI triggering for more than 2 years now and i think it's time to move to JASS. as of now i'm still very new to the stuff. I've been trying to convert a bunch of my spells from GUI to Jass to make them MUI, at least that's my goal for now.
so as a nooby, here's my problem:
this is a directly converted from my GUI Trigger and i'm trying to do away with global variables. i'm having problems with the integer variable "udg_HS_SeismicSlide", on how i should pass it's value around. what i understand in JASS is you can't pass values of local variables between functions. udg_HS_SeismicSlide's value is set on function "Main" and is used on functions "Group_Func" as a global it's no problem. but it's not MUI so how do i make it into a local? i tried using Kattana's handles but it seem to only work with timers...
so as a nooby, here's my problem:
function Flight takes nothing returns nothing
call SetUnitFlyHeightBJ( GetEnumUnit(), 0.00, I2R(udg_HS_SeismicSlide) )
endfunction
function Slide_Check takes nothing returns boolean
if ( not ( udg_HS_SeismicSlide >= 1400 ) ) then
return false
endif
return true
endfunction
function Group_Func takes nothing returns nothing
call UnitAddAbilityBJ( 'Amrf', GetEnumUnit() )
call UnitRemoveAbilityBJ( 'Amrf', GetEnumUnit() )
call SetUnitFlyHeightBJ( GetEnumUnit(), 400.00, I2R(udg_HS_SeismicSlide) )
endfunction
function Switcher takes nothing returns boolean
return ( udg_HS_SeismicSlide <= 0 )
endfunction
function Toggle takes nothing returns boolean
if ( not ( udg_HS_SeismicDownSlide == false ) ) then
return false
endif
return true
endfunction
function Main takes nothing returns nothing
if ( Toggle() ) then
set udg_HS_SeismicSlide = ( udg_HS_SeismicSlide - 100 )
call ForGroupBJ( udg_HS_SeismicGroup, function Group_Func )
if ( Switcher() ) then
set udg_HS_SeismicDownSlide = true
else
call DoNothing( )
endif
else
set udg_HS_SeismicSlide = ( udg_HS_SeismicSlide + 70 )
call ForGroupBJ( udg_HS_SeismicGroup, function Flight )
if ( Slide_Check() ) then
call DestroyGroup (udg_HS_SeismicGroup)
call DisableTrigger( GetTriggeringTrigger() )
else
endif
endif
endfunction
//===========================================================================
function InitTrig_Seismic_Vert_Slide takes nothing returns nothing
set gg_trg_Seismic_Vert_Slide = CreateTrigger( )
call DisableTrigger( gg_trg_Seismic_Vert_Slide )
call TriggerRegisterTimerEventPeriodic( gg_trg_Seismic_Vert_Slide, 0.03 )
call TriggerAddAction( gg_trg_Seismic_Vert_Slide, function Main )
endfunction
this is a directly converted from my GUI Trigger and i'm trying to do away with global variables. i'm having problems with the integer variable "udg_HS_SeismicSlide", on how i should pass it's value around. what i understand in JASS is you can't pass values of local variables between functions. udg_HS_SeismicSlide's value is set on function "Main" and is used on functions "Group_Func" as a global it's no problem. but it's not MUI so how do i make it into a local? i tried using Kattana's handles but it seem to only work with timers...