• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] No GUI variables anymore

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

Well, this is one of the most things that makes me crazy at all! Before I start, with "GUI variables" I mean this variables, which are in this variable monitor when you press Crtl + B.

I'll take as an example my dialog "system". I needed it like this, that I have one part, which creates the dialog and another part which runs all the actions, that should happen when a button of this dialog is clicked.

The problem was now, I didn't get this into only one vJass trigger, so I used GUI variables, to store the dialog and the buttons. In this case I made two triggers, one which runs at game time 0.00 and create + store the dialog + buttons and the second checks what button is clicked and make actions.

Now the question is, when I store the dialog and the buttons only into struct members, can I refer in the second trigger somehow to this struct members?

=====

Also another thing, when I create a GUI variable and convert it into custom text, then I see that this variable starts with udg_ (what does this udg means btw?).
Would something happen, or can this be a solution, when I make an initialized trigger with this:

JASS:
globals
   public button array udg_buttons[4]
endglobals

Is this then a GUI variable which isn't just showed in the "GUI variable monitor (Ctrl + B)"? (I just typed "public" because for me its the most logical word for this case^^)

Note: I used the dialog thing as an example only, so please don't write "Use DialogUtils" - because I don't understand it anyway and I have to say I learn nothing from it when I just take some code an other dude made.


Hope someone understand what I'm trying to say and can help me with this!

Greetings and Peace
Dr. BøøM
 
Level 16
Joined
Aug 7, 2009
Messages
1,406
1, You can store variables as struct members and use them later whenever you want:

JASS:
struct foo
    static member fooUnit=<myUnit>
endstruct

----
function myFooFunction takes nothing returns nothing
    call KillUnit(foo.fooUnit)
endfunction

2, No, that's not a GUI variable. Variables created in GUI variable editor get that "udg_" prefix (it doesn't really have a meaning), but variables defined in triggers will be never visible and available in GUI.

Actually getting rid of GUI variables (and triggers) is a good thing. My map has exactly 0 GUI trigger and variable at the moment,and I have to say: it is much more readable than that GUI sh*t.
 
Level 9
Joined
Apr 26, 2011
Messages
403
1, if you define variable by vJASS, you can still access it in GUI by custom script or JASS.

eg :
library Test initializer init
globals
public integer My_Integer = 101
endglobals

in GUI, you can't find "My_Integer" from variable list, but you can access it by JASS code or custom script "set My_Integer = My_Integer +1"

2. when you create variable in GUI (Ctrl + B). eg : "My_String", it will automatic rename to "udg_My_String" because it is User Define Global.
 
Level 13
Joined
Mar 16, 2008
Messages
941
1, if you define variable by vJASS, you can still access it in GUI by custom script or JASS.

eg :
library Test initializer init
globals
public integer My_Integer = 101
endglobals

in GUI, you can't find "My_Integer" from variable list, but you can access it by JASS code or custom script "set My_Integer = My_Integer +1
Just a hint: Since you made it public, its Test_My_Integer or something like this ;)
Mixing GUI with vJass is realy not worth it.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Blizzard added a bj_ prefix to their variable names, and they say "WE KEPT TYPE AND TYPE THAT TAG THEY HAVE TO TYPE TOO" so they want us to suffer with them with udg_ prefix.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
To answer Boom's question in the first place. Instead of public, make them private and remove the variables from the variables editor. It should now work as long as the variable array in the variable editor was named buttons (and keep the udg_ prefix in the globals block).

Guess all people answered these anyway.
 
Status
Not open for further replies.
Top