# Absolute Value (Integer)

Grammar — Abs(value)
FlagsNative | Function

Returns the value of the integer without regard to the sign of the integer.

# Arguments

  • int — Value

Returns — int

native int AbsI(int x);

Category: Math / Arithmetic

# Examples

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignMissionLib.galaxy:705

    lv_incrementFrequency = 0.05;
    lv_currentAlpha = VisGetFoWAlpha(1);
    lv_increments = AbsI(FixedToInt((lp_duration / lv_incrementFrequency)));
    lv_alphaIncrement = ((lp_targetAlpha-lv_currentAlpha)/IntToFixed(lv_increments));
    autoF2E39D27_n = lv_increments;

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignMissionLib.galaxy:751

    VisResetFoWAlpha(1);
    lv_targetAlpha = VisGetFoWAlpha(1);
    lv_increments = AbsI(FixedToInt((lp_duration / lv_incrementFrequency)));
    lv_alphaIncrement = ((lv_targetAlpha-lv_currentAlpha)/IntToFixed(lv_increments));
    VisSetFoWAlpha(1, lv_currentAlpha);

mods/core.sc2modbase.sc2data/TriggerLibs/NativeLib.galaxy:1679

    // Variable Initialization
    lv_count = UnitBehaviorCount(lp_inUnit, lp_inBehavior);
    lv_delta = AbsI((lp_inCount - lv_count));

    // Implementation

mods/heroesbrawlmods/arenamodemods/templearena.stormmodbase.stormdata/LibAMCT.galaxy:2632

                else {
                }
                libAMCT_gf_MMCapturePointsUISetTempleCaptureProgress(lv_itTemplIndex, lv_ownerTeam, AbsI(libGame_gf_CapturePointCounter(libAMCT_gv_aRMSkyTemple[lv_itTemplIndex].lv_beaconIndex)), libGame_gf_CapturePointCounterMax(libAMCT_gv_aRMSkyTemple[lv_itTemplIndex].lv_beaconIndex));
                if ((TimerIsPaused(libAMCT_gv_aRMSkyTempleTimedTempleTimer) == false) && (TimerGetRemaining(libAMCT_gv_aRMSkyTempleTimedTempleTimer) >= 0.0) && (TimerGetRemaining(libAMCT_gv_aRMSkyTempleTimedTempleTimer) <= 7.0)) {
                    libNtve_gf_SetDialogItemText(libAMCT_gv_mMCapturePointsPanel.lv_capturePointsTempleTimerLabel[lv_itTemplIndex], FixedToText(TimerGetRemaining(libAMCT_gv_aRMSkyTempleTimedTempleTimer), 1), PlayerGroupAll());

mods/heroesbrawlmods/brawlmapmods/coop/deadmansstand.stormmodbase.stormdata/LibPEB1.galaxy:2812

    for (auto6897257E_i = 1; auto6897257E_i <= auto6897257E_n; auto6897257E_i += 1) {
        lv_gapIndex = RandomInt(4, 12);
        if ((AbsI((lv_gapIndex - libPEB1_gv_previousGapIndex)) >= 4)) {
            break;
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/AILib.galaxy:2610

    else {
        libGame_gf_ResetTokenCount("AITokenTeamLevelAdvantage", libGame_gv_teams[lv_teamID].lv_core);
        UnitSetTokenCount(libGame_gv_teams[libGame_gf_EnemyTeam(lv_teamID)].lv_core, ("AITokenTeamLevelAdvantage"), AbsI(lv_teamLevelAdvantage), libGame_gv_teams[libGame_gf_EnemyTeam(lv_teamID)].lv_core);
    }
}

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:11312

    libGame_gf_ScoreValuesReportIntegerValueAndLog(lp_player, "ExperienceFromRegenGlobes", FixedToInt(libGame_gv_players[lp_player].lv_xPRecievedFromRegenGlobe));
    lv_trackedXPValueSum = (FixedToInt(libGame_gv_players[lp_player].lv_xPRecievedFromMinions) + FixedToInt(libGame_gv_players[lp_player].lv_xPRecievedFromCreeps) + FixedToInt(libGame_gv_players[lp_player].lv_xPRecievedFromHeroes) + FixedToInt(libGame_gv_players[lp_player].lv_xPRecievedFromStructures) + FixedToInt(libGame_gv_players[lp_player].lv_xPRecievedFromTrickle));
    if (((libCore_gv_sYSGameMode == libCore_ge_GameModes_Normal) || (libCore_gv_sYSGameMode == libCore_ge_GameModes_ArenaMode) || (libCore_gv_sYSGameMode == libCore_ge_GameModes_AttackDefend)) && (AbsI((lv_earnedMetaXPValue - lv_trackedXPValueSum)) > 2)) {
        TextExpressionSetToken("Param/Expression/lib_Game_63D9F63A", "A", IntToText(lp_player));
        TextExpressionSetToken("Param/Expression/lib_Game_63D9F63A", "B", IntToText(lv_earnedMetaXPValue));

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/UILib.galaxy:15748


    lv_talentTierGap = (libUIUI_gv_teamXPPartyFrameTeamTalentTier[lv_localPlayerTeamID] - libUIUI_gv_teamXPPartyFrameTeamTalentTier[lv_enemyTeamID]);
    if ((AbsI(lv_talentTierGap) > 1)) {
        lv_talentgappluralcontroller = TextExpressionAssemble("Param/Expression/lib_UIUI_5AAD1E27");
    }

mods/heroesmapmods/battlegroundmapmods/skytemple.stormmodbase.stormdata/LibMLCP.galaxy:3220

                    else {
                    }
                    libMLCP_gf_MMSkyTempleUISetTempleCaptureProgress(lv_itTemplIndex, lv_ownerTeam, AbsI(libGame_gf_CapturePointCounter(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beaconIndex)), libGame_gf_CapturePointCounterMax(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beaconIndex));
                    libMLCP_gf_MMSkyTempleUISetTempleContested(lv_itTemplIndex, libGame_gf_CapturePointContested(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beaconIndex));
                }

mods/heromods/dehaka.stormmodbase.stormdata/LibHDEH.galaxy:1090

    lv_dehakaUnit = libGame_gv_players[lv_player].lv_heroUnit;
    if ((UnitIsAlive(libGame_gv_players[lv_player].lv_heroUnit) == true) && (UnitHasBehavior2(libGame_gv_players[lv_player].lv_heroUnit, "DehakaEssenceCollectionEssenceDevourerQuestToken") == true)) {
        lv_essenceStacksfromGlobes = AbsI(CatalogFieldValueGetAsInt(c_gameCatalogEffect, "DehakaEssenceCollectionEssenceDevourerTalentModifyChargeCount", "Cost[" + IntToString(0) + "].ChargeCountUse", lv_player));
        UnitCreateEffectUnit(lv_dehakaUnit, "DehakaEssenceCollectionTissueRegenerationProcSet", lv_dehakaUnit);
        libHDEH_gf_HeroDehakaTalentEnhancedAgilityAddEssenceForPlayer(lv_player, lv_essenceStacksfromGlobes);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:7151

    lv_incrementFrequency = 0.05;
    lv_currentAlpha = VisGetFoWAlpha(lp_player);
    lv_increments = AbsI(FixedToInt((lp_duration / lv_incrementFrequency)));
    lv_alphaIncrement = ((lp_targetAlpha-lv_currentAlpha)/IntToFixed(lv_increments));
    autoE1EEDFCD_n = lv_increments;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:7204

    VisResetFoWAlpha(lp_player);
    lv_targetAlpha = VisGetFoWAlpha(lp_player);
    lv_increments = AbsI(FixedToInt((lp_duration / lv_incrementFrequency)));
    lv_alphaIncrement = ((lv_targetAlpha-lv_currentAlpha)/IntToFixed(lv_increments));
    VisSetFoWAlpha(lp_player, lv_currentAlpha);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:1188


        if ((lv_useVespene == true)) {
            libCOMU_gv_cT_StatOrderCostMineralsLost[lv_microPlayer] += MinI(PlayerGetPropertyInt(lv_microPlayer, c_playerPropMinerals), MaxI(AbsI(FixedToInt(lv_orderCost)), 1));
            libCOMU_gv_cT_StatOrderCostVespeneLost[lv_microPlayer] += MinI(PlayerGetPropertyInt(lv_microPlayer, c_playerPropVespene), MaxI(AbsI(FixedToInt(lv_orderCost)), 1));
            libCOMI_gf_GivePlayerResources(PointWithOffset(UnitGetPosition(lp_orderedUnit), -0.36, 0.0), libCOMI_ge_CacheResourceType_Mineral, MinI(FixedToInt(lv_orderCost), -1), null, null, lv_microPlayer);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:1189

        if ((lv_useVespene == true)) {
            libCOMU_gv_cT_StatOrderCostMineralsLost[lv_microPlayer] += MinI(PlayerGetPropertyInt(lv_microPlayer, c_playerPropMinerals), MaxI(AbsI(FixedToInt(lv_orderCost)), 1));
            libCOMU_gv_cT_StatOrderCostVespeneLost[lv_microPlayer] += MinI(PlayerGetPropertyInt(lv_microPlayer, c_playerPropVespene), MaxI(AbsI(FixedToInt(lv_orderCost)), 1));
            libCOMI_gf_GivePlayerResources(PointWithOffset(UnitGetPosition(lp_orderedUnit), -0.36, 0.0), libCOMI_ge_CacheResourceType_Mineral, MinI(FixedToInt(lv_orderCost), -1), null, null, lv_microPlayer);
            libCOMI_gf_GivePlayerResources(PointWithOffset(UnitGetPosition(lp_orderedUnit), 0.36, 0.0), libCOMI_ge_CacheResourceType_Vespene, MinI(FixedToInt(lv_orderCost), -1), null, null, lv_microPlayer);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:1196

            lv_orderCost *= 2.0;
            libCOMI_gf_GivePlayerResources(UnitGetPosition(lp_orderedUnit), libCOMI_ge_CacheResourceType_Mineral, MinI(FixedToInt(lv_orderCost), -1), null, null, lv_microPlayer);
            libCOMU_gv_cT_StatOrderCostMineralsLost[lv_microPlayer] += MinI(PlayerGetPropertyInt(lv_microPlayer, c_playerPropMinerals), MaxI(AbsI(FixedToInt(lv_orderCost)), 1));
        }
    }