I watched Both Beider's and Quickshot14's tutorials on presets. However im still having trouble understanding them. I understand that i can use them to represent numbers, sort of how with booleans 0= false and 1= true, except you can use more integers. Is it possible for them to be used in reverse? So that a number represents a string or a unit type?
For example when making an array to hold 30 unit types. Instead of creating 30 set variable actions to set them all up, would it be possible to create a preset and then have it loop through all of them and set it up?
Im not sure if this is possible, but i just have a feeling i might be able to use presets to make this easier. I dont know how they work though.
If that's not clear, it's an integer variable where the set of possible values is constrained. The GUI trigger editor hides the integer constants associated with the named values. So no, presets aren't ways of storing data.
they aren't useful for looping through, since there is no way to retrieve the preset values for the looping. the preset values are purely for cosmetic reasons (sc2editor gui) and not for usage in triggers.
They're only used in actions if the action uses that specific preset, eg. Show/Hide UI Frame uses 2 presets, the "Show/Hide" one, and the "UI Frame".
to be a bit more clear:
Presets are only used to make action values readable. (eg. instead of a 1 it would display the option "Show", for a Show/Hide Action)
Presets are not available on runtime, they're replaced with their actual values. (so on runtime it would not use the word "Show" but the value 1)
How presets can be used in conjunction with action definitions, usually in libraries:
If you create an action definition and you want to give the user limited number of values, you can use presets to define these.
you can use strings, or unit types for presets, but that is usually not needed unless you have a special case that requires a string value that is better hidden from the user since the value does not state what it does correctly or because it is just plain ugly. (eg. "Create Dialog Item using Template MinimapPanel/MinimapPanelTemplate" would be ugly, while "Create Dialog Item using Template Minimap" looks a lot better)
I watched Both Beider's and Quickshot14's tutorials on presets. However im still having trouble understanding them. I understand that i can use them to represent numbers, sort of how with booleans 0= false and 1= true, except you can use more integers. Is it possible for them to be used in reverse? So that a number represents a string or a unit type?
For example when making an array to hold 30 unit types. Instead of creating 30 set variable actions to set them all up, would it be possible to create a preset and then have it loop through all of them and set it up? Im not sure if this is possible, but i just have a feeling i might be able to use presets to make this easier. I dont know how they work though.
@gizmachu:
A preset is equivalent to a C++ enum.
If that's not clear, it's an integer variable where the set of possible values is constrained. The GUI trigger editor hides the integer constants associated with the named values. So no, presets aren't ways of storing data.
@gizmachu: Go
they aren't useful for looping through, since there is no way to retrieve the preset values for the looping. the preset values are purely for cosmetic reasons (sc2editor gui) and not for usage in triggers.
They're only used in actions if the action uses that specific preset, eg. Show/Hide UI Frame uses 2 presets, the "Show/Hide" one, and the "UI Frame".
to be a bit more clear:
How presets can be used in conjunction with action definitions, usually in libraries:
@RileyStarcraft: Go
you can use strings, or unit types for presets, but that is usually not needed unless you have a special case that requires a string value that is better hidden from the user since the value does not state what it does correctly or because it is just plain ugly.
(eg. "Create Dialog Item using Template MinimapPanel/MinimapPanelTemplate" would be ugly, while "Create Dialog Item using Template Minimap" looks a lot better)