Anti GUI - Jass

N-a-z-g-u-l

New Member
Reaction score
30
well, you know the functions func001002004.... :p
and VERY simple BJs like GetKillingUnitBJ() instead of GetKillingUnit() or DestroyEffectBJ() instead of DestroyEffect()...

i had some older maps and wanted to convert them to Jass and then fix the leaks and optimize them, and it seemed impossible, because of replacing all the func00012031023-functions^^

http://mariusb.kilu3.de/antiguijass.htm
this very little script does about that for you... and i know, vexorians map optimizer does all that, but i did not want to optimize other things and so on, ok, should be possible, but nontheless i made the script ;)

perhaps someone can use this when converting GUI to Jass.. and dont think this fixes all problems with gui converted jass, only makes it editable...
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Hm... I entered this GUI converted code Hjalle made:
JASS:
function Trig_Leader_Func001Func001C takes nothing returns boolean
    if ( not ( GetPlayerSlotState(ConvertedPlayer(GetForLoopIndexA())) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return false
    endif
    if ( not ( GetPlayerController(ConvertedPlayer(GetForLoopIndexA())) == MAP_CONTROL_USER ) ) then
        return false
    endif
    return true
endfunction


And all it did was change it to this:
JASS:
function Trig_Leader_Func001Func001C takes nothing returns boolean
	if ( not ( GetPlayerSlotState(ConvertedPlayer(bj_forLoopAIndex)) == PLAYER_SLOT_STATE_PLAYING ) ) then
		return false
	endif
	if ( not ( GetPlayerController(ConvertedPlayer(bj_forLoopAIndex)) == MAP_CONTROL_USER ) ) then
		return false
	endif
	return true
endfunction


By indenting it more.

--------

Nice find though. :D

+rep
 

N-a-z-g-u-l

New Member
Reaction score
30
well, its for simple triggers, it searches for those functions:

Code:
function <name> takes nothing returns boolean
    if not (<condition>) then
        return false
    endif
    return true
endfunction

and inlines them into the functions from where they are called... besides that it replaces some functions, like your script contained... ConvertedPlayer() for example is not converted, because if i simply replaced "ConvertedPlayer(" to "Player(1+" it could have had a mistake... well, it couldnt xD i thought it could because of * and / have to be calculated before + and - etc... but in this case there couldnt be an error^^

and here a example code, for which it works fine :p

Code:
function Trig_Kill_Unit_Conditions takes nothing returns boolean
    if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == false ) ) then
        return false
    endif
    return true
endfunction

function Trig_Kill_Unit_Func001Func001C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hfoo' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Kill_Unit_Func001Func002C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hkni' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Kill_Unit_Func001Func003C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hgyr' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Kill_Unit_Func001Func004C takes nothing returns boolean
    if ( not ( GetUnitAbilityLevelSwapped('AUcb', GetTriggerUnit()) == 0 ) ) then
        return false
    endif
    return true
endfunction

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

function Trig_Kill_Unit_Actions takes nothing returns nothing
    if ( Trig_Kill_Unit_Func001C() ) then
        if ( Trig_Kill_Unit_Func001Func001C() ) then
            call AddSpecialEffectLocBJ( GetUnitLoc(GetTriggerUnit()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl" )
            call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        else
        endif
        if ( Trig_Kill_Unit_Func001Func002C() ) then
            call AddSpecialEffectLocBJ( GetUnitLoc(GetTriggerUnit()), "Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl" )
            call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        else
        endif
        if ( Trig_Kill_Unit_Func001Func003C() ) then
            call AddSpecialEffectLocBJ( GetUnitLoc(GetTriggerUnit()), "Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireMissile.mdl" )
            call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        else
        endif
        call KillUnit( GetTriggerUnit() )
    else
        if ( Trig_Kill_Unit_Func001Func004C() ) then
            call RemoveUnit( GetTriggerUnit() )
        else
        endif
    endif
endfunction

//===========================================================================
function InitTrig_Kill_Unit takes nothing returns nothing
    set gg_trg_Kill_Unit = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Kill_Unit, gg_rct_Gebiet_000 )
    call TriggerAddCondition( gg_trg_Kill_Unit, Condition( function Trig_Kill_Unit_Conditions ) )
    call TriggerAddAction( gg_trg_Kill_Unit, function Trig_Kill_Unit_Actions )
endfunction

... becomes ...

Code:
function Trig_Kill_Unit_Conditions takes nothing returns boolean
	return IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == false
endfunction

function Trig_Kill_Unit_Actions takes nothing returns nothing
	if IsUnitAliveBJ(GetTriggerUnit()) then
		if GetUnitTypeId(GetTriggerUnit()) == 'hfoo' then
			call AddSpecialEffectLocBJ( GetUnitLoc(GetTriggerUnit()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl" )
			call DestroyEffect( bj_lastCreatedEffect )
		endif
		if GetUnitTypeId(GetTriggerUnit()) == 'hkni' then
			call AddSpecialEffectLocBJ( GetUnitLoc(GetTriggerUnit()), "Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl" )
			call DestroyEffect( bj_lastCreatedEffect )
		endif
		if GetUnitTypeId(GetTriggerUnit()) == 'hgyr' then
			call AddSpecialEffectLocBJ( GetUnitLoc(GetTriggerUnit()), "Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireMissile.mdl" )
			call DestroyEffect( bj_lastCreatedEffect )
		endif
		call KillUnit( GetTriggerUnit() )
	else
		if GetUnitAbilityLevelSwapped('AUcb', GetTriggerUnit()) == 0 then
			call RemoveUnit( GetTriggerUnit() )
		endif
	endif
endfunction

//===========================================================================
function InitTrig_Kill_Unit takes nothing returns nothing
	set gg_trg_Kill_Unit = CreateTrigger(  )
	call TriggerRegisterEnterRectSimple( gg_trg_Kill_Unit, gg_rct_Gebiet_000 )
	call TriggerAddCondition( gg_trg_Kill_Unit, Condition( function Trig_Kill_Unit_Conditions ) )
	call TriggerAddAction( gg_trg_Kill_Unit, function Trig_Kill_Unit_Actions )
endfunction

and the trigger does not make sense, right :p
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Still doesn't work for me. I used your code and it just indented it. Maybe it was loading... I dunno... Lol :p

I looked at the page's source and mainly what it did was just replace BJs with common.j natives. I guess it can't actually switch around the parameters or w/e so I think it is limited a bit. :D
 

N-a-z-g-u-l

New Member
Reaction score
30
yes, thats why it is very limited^^

and that isnt the main part i think ;) the main part is, that it replaces the conditions like in the code ive put in my last post...
dont know why that does not work for you

i'll reupload it, perhaps there was a mistake somewhere

EDIT: still works fine for me...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top