HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

why is it not happening ?

09-03-2008, 10:25 AM#1
Flame_Phoenix
Ok guys, this is the second day I waste trying to fix this, but although everything looks fine to me, I just can't find what's wrong ....
Can some one tell me what I am doing wrong in this code ?
The BJ message is displayed, but the dialog box never shows =S

Collapse JASS:
scope ChooseTactic initializer Init
    globals 
        private constant integer NE_MAIN = 'e001'
        private constant string DIALOG_TITLE = "Choose your Tactic"
        private constant string BUTTON_ONE = "Ranged: Archers+Dryads+Talons"
        private constant string BUTTON_TWO = "Misc: Huntress + dryads"
        private constant string BUTTON_THREE = "Don't need help, thanks"
    endglobals

//===========================================================================
    private function Conditions takes nothing returns boolean
        return GetUnitTypeId(GetTriggerUnit()) == NE_MAIN
    endfunction
//===========================================================================
    private function Actions takes nothing returns nothing
        local player p = GetOwningPlayer(GetTriggerUnit())
        local integer playerNumber = GetPlayerId(p)
        
        //some stupid test dialog box
        local dialog d
        local button b
        
        call TriggerSleepAction(1.)
        
        call BJDebugMsg("SHOW ME !")
        call DialogClear(d)
        call DialogSetMessage(d, DIALOG_TITLE)   
        set b = DialogAddButton(d, BUTTON_ONE, 0)
        call DialogDisplay(p, d, true)
        
       // call DialogClear(boxes[playerNumber])   //clear the player's box
       // call DialogSetMessage(boxes[playerNumber], DIALOG_TITLE)    //set the title
        
        //We create the 3 buttons with the 3 options
       // set playerButtons[playerNumber][0] = DialogAddButton(boxes[playerNumber], BUTTON_ONE, 0)
       // set playerButtons[playerNumber][1] = DialogAddButton(boxes[playerNumber], BUTTON_TWO, 0)
       // set playerButtons[playerNumber][2] = DialogAddButton(boxes[playerNumber], BUTTON_THREE, 0)
        
        //we show the box
       // call DialogDisplay(p, boxes[playerNumber], true)
        
        set p = null
    endfunction
//===========================================================================
    private function Init takes nothing returns nothing
        local trigger ChooseTacticTrg = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ( ChooseTacticTrg, EVENT_PLAYER_UNIT_UPGRADE_FINISH )
        call TriggerAddCondition(  ChooseTacticTrg, Condition( function Conditions ) )
        call TriggerAddAction(  ChooseTacticTrg, function Actions )
        
        set ChooseTacticTrg = null
    endfunction
endscope
09-03-2008, 11:11 AM#2
Alexander244
Collapse JASS:
local dialog d           
09-03-2008, 01:07 PM#3
Zandose
For the answer...
Hidden information:
Collapse JASS:
local dialog d = DialogCreate()