How to make @editable vars that turn on/off based off of other variables being true/false

As you may know the editor UEFN has many devices which can be inspected. Within these devices, some options are grayed out until you check a certain box to be true. Is there any way to do this in verse? Oh and bonus question: Is there a way to make a float/int value restricted between values in the editor? Example: variable “Health” which can only be set between 0.0 and 100.0

1 Like

Nope. Such things need to be manually added by the Dev’s. To see all of the “things” that can be changed in verse, take a browse through the three digest.verse files in VSCode’s Workspace panel. But yeah, we can make a case for something we want/need added to the API (just be aware that it may already be talked about, so search the forums first and post in the existing thread if already requested - make things easier for the staff :smiley: )

Is there a way to make a float/int value restricted between values in the editor? Example: variable “Health” which can only be set between 0.0 and 100.0

Could be wrong, but don’t think so. Would be a good feature to have though! I do believe they have mentioned plans to make @editable things much more user-friendly, and that is a good one.

Hey there!
I think I can anwser your 2nd question, but I have to make sure that I understand that correctly:

So you want that the var “Health” can’t get for example over a value of 100 & that it doesn’t go below 0?

Correct. But in the device settings within the UEFN editor itself. If you’ve seen other devices, they have ‘sliders’ which can go between two values. This is what I am trying to achieve.

There is no way to conditionally gray out certain properties as of yet but we hope to add more editor improvements in the future.

It is, however, possible to restrict a value like you’re describing and using code like this will show a clamped slider in the UI.

constrained_health := type{_X:float where 0.0 <= _X, _X <= 100.0 }

hello_world_device := class(creative_device):

    @editable Health:constrained_health = 0.0
10 Likes

Even though the latter is not possible yet, thank you for this solution!

Defining the valid range is such a lifesaver! Thanks for the share!

Taking it a step further, is there any way to define hover tooltip text so we can provide those working in the editor more context on the usage of that particular field?

2 Likes

Has this changed since then? Are there more ways to change how editables can be manipulated / shown in the editor? (ie: checkboxes, titles, tooltips, etc.)

TimeBetweenAttacksTip<localizes>:message = 
    "The amount of time between each attack"
@editable_slider(int):
    ToolTip := TimeBetweenAttacksTip,
    MinValue := option{0},
    MaxValue := option{100}
var TimeBetweenAttacks : int = 50
1 Like