1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Converting GUI into JASS

Discussion in 'Triggers & Scripts' started by GIMLI_2, Dec 16, 2015.

  1. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    you can leave it like that, but most vJASSers use scopes.
     
  2. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,433
    Resources:
    2
    Maps:
    2
    Resources:
    2
    ok

    is it possible to return 2 values? i want my function to return a location (2 real values)
     
  3. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    That is not possible.
    You can place them in global variables though or you can use a struct that defines an object like a location.
     
  4. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,433
    Resources:
    2
    Maps:
    2
    Resources:
    2
    is it ok to return a location then?
     
  5. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,532
    Resources:
    23
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    5
    JASS:
    3
    Resources:
    23
    You can write "return location", but you can not directly return 2 real values.
    Then you woul need to store them somewhere where you have public access.
     
  6. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,433
    Resources:
    2
    Maps:
    2
    Resources:
    2
    ok


    a trigger i just created, i'm not sure about the event, i think i've done sth wrong there probably. but it works :D

    Code (vJASS):

    function Trig_Explosive_Mines_Conditions takes nothing returns boolean

            local unit u = GetTriggerUnit()
            local player p = GetOwningPlayer(u)
            local unit m

        if ( GetUnitTypeId(u) == 'n000' and  GetUnitTypeId(GoblinHero[GetPlayerId(p)]) == 'H000' and GetRandomInt(0, 99) <= 17 ) then

            set m = CreateUnit(p, 'n006', GetUnitX(u), GetUnitY(u), bj_UNIT_FACING )
            call RemoveUnit(u)
            call SetUnitAnimation(m, "birth")
       
        endif
       
            set u = null
            set m = null
            set p = null
       
        return false
       
       
    endfunction



    //===========================================================================
    function InitTrig_Explosive_Mines takes nothing returns nothing
        local region r = CreateRegion()
        call RegionAddRect(r, bj_mapInitialPlayableArea)
        set gg_trg_Explosive_Mines = CreateTrigger(  )
        call TriggerRegisterEnterRegion( gg_trg_Explosive_Mines, r, null )
        call TriggerAddCondition( gg_trg_Explosive_Mines, Condition( function Trig_Explosive_Mines_Conditions ) )
        set r = null
    endfunction
     
     
  7. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,433
    Resources:
    2
    Maps:
    2
    Resources:
    2
    I have a problem with a function i made. Whenever i call the function in my trigger, the trigger wont continue from tha point. My function counts how many slots are used in the inventory. It takes a unit and returns an integer. I cannot show you the code right now, im not at home. It gives me no errors, it just stops the trigger
     
  8. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,433
    Resources:
    2
    Maps:
    2
    Resources:
    2
    So, i did take a look at timers and have some questions about that. you told me to use a timer system and i did a research on that and ended up with TimerUtils or TimerTools.
    From where do i get the code and which one should i use?