• 🏆 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] Dialog Variable Assigning

Status
Not open for further replies.
Level 3
Joined
Nov 23, 2008
Messages
18
I've recently started using JASS within the trigger editor, and noticing that the GUI was very inefficient, i decided to switch to pure JASS.

Im creating an RPG in which you need to pick a race and class. Im doing this with dialog boxes. However, when i finished the human class buttons and variable sets, i saved and received the error 'invalid number of arguments' for all of my lines assigning variables to the buttons.
Code:
function Trig_Initialization_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(  ), "Welcome to the Legend's Quest Campaign! Please wait until the dialog boxes show up to begin." )
// Dialog Rename
    call DialogSetMessageBJ( udg_dialogRace, "Pick Your Race" )
    call DialogSetMessageBJ( udg_dialogClassHuman, "Pick Your Class" )
    call DialogSetMessageBJ( udg_dialogClassOrc, "Pick Your Class" )
    call DialogSetMessageBJ( udg_dialogClassUndead, "Pick Your Class" )
    call DialogSetMessageBJ( udg_dialogClassElf, "Pick Your Class" )
// Race Buttons
    call DialogAddButton( udg_dialogRace, "Human (+Intelligence)" )
    set udg_buttonRace[0] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogRace, "Orc (+Strength)" )
    set udg_buttonRace[1] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogRace, "Elf (+Agility)" )
    set udg_buttonRace[2] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogRace, "Undead (+Regeneration)" )
    set udg_buttonRace[3] = GetLastCreatedButtonBJ(  )
// Human Buttons
    call DialogAddButton( udg_dialogClassHuman, "Warrior (Vital Strike / Strength)" )
    set udg_buttonClassHuman[0] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogClassHuman, "Ninja (Blunt Force Trauma / Strength)" )
    set udg_buttonClassHuman[1] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogClassHuman, "Viking (Determination Aura / Strength)" )
    set udg_buttonClassHuman[2] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogClassHuman, "Magician (Brilliance Aura / Intelligence)" )
    set udg_buttonClassHuman[3] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogClassHuman, "Wizard (Magic Missile / Intelligence)" )
    set udg_buttonClassHuman[4] = udg_GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogClassHuman, "Cleric (Cure / Intelligence)" )
    set udg_buttonClassHuman[5] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogClassHuman, "Archer ( / Agility)" )
    set udg_buttonClassHuman[6] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogClassHuman, "Sniper (Lucky Shot / Agility)" )
    set udg_buttonClassHuman[7] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogClassHuman, "Thief, (Invisibility / Agility)" )
    set udg_buttonClassHuman[8] = GetLastCreatedButtonBJ(  )
    call DialogAddButton( udg_dialogClassHuman, "Random" )
    set udg_buttonClassHuman[9] = GetLastCreatedButtonBJ(  )
endfunction

//===========================================================================
function InitTrig_Initialization takes nothing returns nothing
    set gg_trg_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Initialization, function Trig_Initialization_Actions )
endfunction

Does anyone know how to fix it? ive checked the variable names and everything...
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
JASS:
function Trig_Initialization_Actions takes nothing returns nothing
    call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Welcome to the Legend's Quest Campaign! Please wait until the dialog boxes show up to begin.")
// Dialog Rename
    call DialogSetMessage( udg_dialogRace, "Pick Your Race" )
    call DialogSetMessage( udg_dialogClassHuman, "Pick Your Class" )
    call DialogSetMessage( udg_dialogClassOrc, "Pick Your Class" )
    call DialogSetMessage( udg_dialogClassUndead, "Pick Your Class" )
    call DialogSetMessage( udg_dialogClassElf, "Pick Your Class" )
// Race Buttons
    set udg_buttonRace[0] = DialogAddButton(udg_dialogRace,"Human (+Intelligence)",0)
    set udg_buttonRace[1] = DialogAddButton(udg_dialogRace,"Orc (+Strength)",0)
    set udg_buttonRace[2] = DialogAddButton(udg_dialogRace,"Elf (+Agility)",0)
    set udg_buttonRace[3] = DialogAddButton(udg_dialogRace,"Undead (+Regeneration)",0)
// Human Buttons
    set udg_buttonClassHuman[0] = DialogAddButton(udg_dialogClassHuman,"Warrior (Vital Strike / Strength)",0)
    set udg_buttonClassHuman[1] = DialogAddButton(udg_dialogClassHuman,"Ninja (Blunt Force Trauma / Strength)",0)
    set udg_buttonClassHuman[2] = DialogAddButton(udg_dialogClassHuman,"Viking (Determination Aura / Strength)",0)
    set udg_buttonClassHuman[3] = DialogAddButton(udg_dialogClassHuman,"Magician (Brilliance Aura / Intelligence)",0)
    set udg_buttonClassHuman[4] = DialogAddButton(udg_dialogClassHuman,"Wizard (Magic Missile / Intelligence)",0)
    set udg_buttonClassHuman[5] = DialogAddButton(udg_dialogClassHuman,"Cleric (Cure / Intelligence)",0)
    set udg_buttonClassHuman[6] = DialogAddButton(udg_dialogClassHuman,"Archer ( / Agility)",0)
    set udg_buttonClassHuman[7] = DialogAddButton(udg_dialogClassHuman,"Sniper (Lucky Shot / Agility)",0)
    set udg_buttonClassHuman[8] = DialogAddButton(udg_dialogClassHuman,"Thief, (Invisibility / Agility)",0)
    set udg_buttonClassHuman[9] = DialogAddButton(udg_dialogClassHuman,"Random",0)
endfunction

function InitTrig_Initialization takes nothing returns nothing
    set gg_trg_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Initialization, function Trig_Initialization_Actions )
endfunction

Code:
function Trig_Initialization_Actions takes nothing returns nothing
    call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Welcome to the Legend's Quest Campaign! Please wait until the dialog boxes show up to begin.")
// Dialog Rename
    call DialogSetMessage( udg_dialogRace, "Pick Your Race" )
    call DialogSetMessage( udg_dialogClassHuman, "Pick Your Class" )
    call DialogSetMessage( udg_dialogClassOrc, "Pick Your Class" )
    call DialogSetMessage( udg_dialogClassUndead, "Pick Your Class" )
    call DialogSetMessage( udg_dialogClassElf, "Pick Your Class" )
// Race Buttons
    set udg_buttonRace[0] = DialogAddButton(udg_dialogRace,"Human (+Intelligence)",0)
    set udg_buttonRace[1] = DialogAddButton(udg_dialogRace,"Orc (+Strength)",0)
    set udg_buttonRace[2] = DialogAddButton(udg_dialogRace,"Elf (+Agility)",0)
    set udg_buttonRace[3] = DialogAddButton(udg_dialogRace,"Undead (+Regeneration)",0)
// Human Buttons
    set udg_buttonClassHuman[0] = DialogAddButton(udg_dialogClassHuman,"Warrior (Vital Strike / Strength)",0)
    set udg_buttonClassHuman[1] = DialogAddButton(udg_dialogClassHuman,"Ninja (Blunt Force Trauma / Strength)",0)
    set udg_buttonClassHuman[2] = DialogAddButton(udg_dialogClassHuman,"Viking (Determination Aura / Strength)",0)
    set udg_buttonClassHuman[3] = DialogAddButton(udg_dialogClassHuman,"Magician (Brilliance Aura / Intelligence)",0)
    set udg_buttonClassHuman[4] = DialogAddButton(udg_dialogClassHuman,"Wizard (Magic Missile / Intelligence)",0)
    set udg_buttonClassHuman[5] = DialogAddButton(udg_dialogClassHuman,"Cleric (Cure / Intelligence)",0)
    set udg_buttonClassHuman[6] = DialogAddButton(udg_dialogClassHuman,"Archer ( / Agility)",0)
    set udg_buttonClassHuman[7] = DialogAddButton(udg_dialogClassHuman,"Sniper (Lucky Shot / Agility)",0)
    set udg_buttonClassHuman[8] = DialogAddButton(udg_dialogClassHuman,"Thief, (Invisibility / Agility)",0)
    set udg_buttonClassHuman[9] = DialogAddButton(udg_dialogClassHuman,"Random",0)
endfunction

function InitTrig_Initialization takes nothing returns nothing
    set gg_trg_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Initialization, function Trig_Initialization_Actions )
endfunction

You fix it by learning JASS. You need to pass the correct number and type of values to the natives for them to work. You also need to not use GUI structures when using JASS natives as they do not work.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
His WE told him of the errors...

Like I said he did not pass the natives enough arguments.

That was the least of his worries as the code still was broken as he was referencing null variables as he used the native to make them which does not set the global that GUI uses to the object.
 
Status
Not open for further replies.
Top