• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] A (most likely) Simple Question

Status
Not open for further replies.
Level 1
Joined
Apr 26, 2007
Messages
4
This has no actions yet so ignor that part, but id like to know what i put for the second condition in the TriggerRegisterDialogEButtonEvent?

JASS:
function Trig_Call_Inventory_Menu_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_Call_Inventory_Menu takes nothing returns nothing
    set gg_trg_Call_Inventory_Menu = CreateTrigger(  )
    call TriggerRegisterDialogEButtonEvent( gg_trg_Call_Inventory_Menu, )
    call TriggerAddAction( gg_trg_Call_Inventory_Menu, function Trig_Call_Inventory_Menu_Actions )
endfunction


It is originally from here


JASS:
function Trig_Call_Menu_Actions takes nothing returns nothing
    call DialogClear( udg_ESC_Menu_Main )
    call DialogSetMessageBJ( udg_ESC_Menu_Main, "Main Menu" )
    call DialogAddButton( udg_ESC_Menu_Main, "Inventory", 1 )
    call DialogAddButton( udg_ESC_Menu_Main, "Change Menu", 2 )
    call DialogAddButton( udg_ESC_Menu_Main, "LogBook", 3 )
    call DialogAddButton( udg_ESC_Menu_Main, "Return", 4 )
    call DialogDisplayBJ( true, udg_ESC_Menu_Main, Player(0) )
endfunction

function InitTrig_Call_Menu takes nothing returns nothing
    set gg_trg_Call_Menu = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Call_Menu, Player(0) )
    call TriggerAddAction( gg_trg_Call_Menu, function Trig_Call_Menu_Actions )
    set gg_trg_Call_Menu = null
endfunction


I am completely new to JASS, havnt made maps in a while, saw some tutorials, read em, and am trying to learn it. Any help will be appreciated.
 
Last edited by a moderator:
Level 5
Joined
Jul 17, 2006
Messages
145
well first of all im assuming you ment
"TriggerRegisterDialogButtonEvent"
instead of
"TriggerRegisterDialogEButtonEvent"

ok what this does is takes a specific button and returns an even, ie when it is clicked. assuming you have the dialog button as a global variable, you just put in the variable for the button that you want to trigger this spell with. If its a local variable, just use that one, but as far as i know you cannot make dialog buttons without a variable.

for example:
JASS:
call TriggerRegisterDialogButtonEvent( gg_trg_Call_Inventory_Menu, udg_Chose_Orcs)

when a person clicks the button related to this variable, it will set off the trigger.

btw please use
JASS:
tags, though i know Hive Workshop dosent have buttons at the top for them (or anything O_O)
 
Level 1
Joined
Apr 26, 2007
Messages
4
Alright thanks for the help, i got The 2nd screen working now. I added some variable but i need to know how to get the condnition to work. It brings it up if any of the buttons on the first screen are clicked.

JASS:
function Trig_Call_Inventory_Menu_Conditions takes nothing returns boolean
    if ( GetClickedButtonBJ() == udg_Main_Menu_Button_Inventory ) then
        return true
    endif
    return true
endfunction

//==========================================================================
function Trig_Call_Inventory_Menu_Actions takes nothing returns nothing
    call DialogClear( udg_ESC_Menu_Main )
    call DialogSetMessageBJ( udg_ESC_Inventory_Menu, "Inventory" )
    call DialogAddButton( udg_ESC_Inventory_Menu, "Store Items", 1 )
    set udg_Inv_Menu_Button_Store_Item = GetLastCreatedButtonBJ()
    call DialogAddButton( udg_ESC_Inventory_Menu, "Retrieve Items", 2 )
    call DialogAddButton( udg_ESC_Inventory_Menu, "Equip Items", 3 )
    call DialogAddButton( udg_ESC_Inventory_Menu, "Unequip Items", 4 )
    call DialogAddButton( udg_ESC_Inventory_Menu, "Return", 5 )
    call DialogDisplayBJ( true, udg_ESC_Inventory_Menu, Player(0) )
endfunction

//===========================================================================
function InitTrig_Call_Inventory_Menu takes nothing returns nothing
    set gg_trg_Call_Inventory_Menu = CreateTrigger(  )
    call TriggerRegisterDialogEvent( gg_trg_Call_Inventory_Menu, udg_ESC_Menu_Main )
    call TriggerAddCondition( gg_trg_Call_Inventory_Menu, Condition( function Trig_Call_Inventory_Menu_Conditions ) )
    call TriggerAddAction( gg_trg_Call_Inventory_Menu, function Trig_Call_Inventory_Menu_Actions )
    set gg_trg_Call_Inventory_Menu = null
endfunction
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
function Trig_Call_Inventory_Menu_Conditions takes nothing returns boolean
if ( GetClickedButtonBJ() == udg_Main_Menu_Button_Inventory ) then
return true
endif
return true
endfunction
Please spare me ><. That condition type sucks in general, and the way you wrote it has a 100% chance to return true =O. Also, GetClickedButtonBJ() is equivelant to GetClickedButton(). Use the following;

JASS:
function Trig_Call_Inventory_Menu_Conditions takes nothing returns boolean
    return GetClickedButton() == udg_Main_Menu_Button_Inventory
endfunction
 
Level 1
Joined
Apr 26, 2007
Messages
4
I rewrote the condition like you said and it dosen't appear to ever bring back true now, do i have to change anything else?

Thxs for the help tho.
 
Level 5
Joined
Jul 17, 2006
Messages
145
>_> im assuming youv set udg_Main_Menu_Button_Inventory to something, right?

and instead of:
JASS:
call DialogAddButton( udg_ESC_Inventory_Menu, "Store Items", 1 )
set udg_Inv_Menu_Button_Store_Item = GetLastCreatedButtonBJ()

try something like this:
JASS:
call DialogAddButton ( udg_Inv_Menu_Button_Store_Item, "Store Items", 1 )

gl with this ^^
 
Status
Not open for further replies.
Top