HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Editing the World Editor?

01-06-2004, 11:55 PM#1
alastor_ac
can anyone tell me how to alter my world editor to do three things

one is that when i am required to have a variable of a certain type or to call a function returning that type (in the GUI), i can call a local variable using the a function call called Local which takes the local variable name and returns the value (in other words it does absolutely nothing in the code besides inserting the value).

the second and third things are that i can set and initialize local variables using the GUI. any help would be greatly appreciated thank you. I no nothing of altering the editor though.
01-07-2004, 07:12 AM#2
PitzerMike
there is no way for really allowing them for GUI use but Lord Vexorian discovered a pretty good workaround.

Initialize a local var with a custom text call (eg local real udg_MyReal = 0.3), the preset udg_ is important
Then create a global var with the name MyReal and you'll be able to refer to the local variable by using the global variable with the same name
01-07-2004, 08:31 AM#3
Starcraftfreak
Quote:
Originally posted by PitzerMike
there is no way for really allowing them for GUI use but Lord Vexorian discovered a pretty good workaround.

Initialize a local var with a custom text call (eg local real udg_MyReal = 0.3), the preset udg_ is important
Then create a global var with the name MyReal and you'll be able to refer to the local variable by using the global variable with the same name

What sense does it make to define a global again with the same name as local?
I'd just make a a Custom Text call to initialize locals like this:
Code:
local real r = 0.5
local integer i = 6
local real myreal = udg_myreal

The last line defines a local var called myreal, that is initialized to the value of the global var myreal (in jass udg_myreal).

Note that all locals have to be at the beginning of the trigger actions. Otherwise you'll get a compile error.
01-07-2004, 11:14 AM#4
PitzerMike
Quote:
Originally posted by Starcraftfreak
What sense does it make to define a global again with the same name as local?


That's called scope. You'll be able to use the local variable by placing the global variable with the same name in your GUI actions.

A local variable with the name of a global variable always has higher priority.

You'll only need one custom text call to setup the local variable and everything else (accessing this variable) can be done with ordinary GUI actions.


To make it clear: that global is never used, its just a helper to make the local variable available for the GUI