MZ Visustella <Label Range>

Instead of a numerical value like:

<Label Range: 1>

is it possible to have the value of a variable?
For instance:

<Label Range: variable ID1>
As a rule, Notetags don't use JavaScript unless the instructions say they've been coded to accept it. You could spawn different versions of the event with different ranges depending on the variable, or you can submit a suggestion to VisuStella.
You can temporarily modify the range, but it wont persist on load, unless you ensure to continually modify it.
Code:
$gameMap._events[x]._labelWindow.visibleRange = y

On the current map, using the above script, x = event ID ; y = label range.
in this case, you can use a variable value.
Code:
$gameMap._events[x]._labelWindow.visibleRange = $gameVariables.value(y)

I'm not sure the value in doing this, but this is a way you can get what you were asking for.
It seems to be working quite well, thank you. Although the downside is that you need to use a parallel process for that.

I'm not sure the value in doing this, but this is a way you can get what you were asking for.

There is great value in dynamic labels as you can for instance create an exploration item that increases the distance from which you can notice an item. Or a sidequest that gives you extra knowledge etc.

If I could put directly the variable in the label, it would be much easier to maintain this system.

EDIT:
So is there no (tricky) way to include the variable DIRECTLY in the event?

1654842644913.png
I thought I gave you the tricky way.

You have to understand how notetags are used.
They are a part of the objects properties; they are loaded when the game loads.
The plugin is looking for a number value to change the range.
Spoiler: Numbers, please...
LabelRange.png
When we modify the property outside, the value of the variable is returned as a number in that moment.
Spoiler: Example setting
Code:
◆Show Choices:1, 5, 7, None (Window, Right, #1, #4)
:When 1
  ◆Control Variables:#0010 Temporary Variable 10 = 1
  ◆
:When 5
  ◆Control Variables:#0010 Temporary Variable 10 = 5
  ◆
:When 7
  ◆Control Variables:#0010 Temporary Variable 10 = 7
  ◆
:When None
  ◆
:End
◆Control Variables:#0010 Temporary Variable 10 = $gameMap._events[21]._labelWindow.visibleRange = $gameVariables.value(10)

When you change the variable, call the script and it will update for that very moment.

I'm not sure if I've explained this properly, but I hope it helps you to understand.
The difficult thing in the "tricky" way is to keep track individually of all the events that have a label. On a big map there can be a lot of these events.
So I'm wondering if there wouldn't be a way to make it simpler maybe?

Instead of addressing one "x" event in particular with "$gameMap._events[x]", have all the events with a given label (for instance

<Label: ??>) behave the same.
This way all I would have to do is run a script call changing ALL the labelled events with "visibleRange = $gameVariables.value(y)".

Much easier to manage.
If this is not possible, I would still take a way to manage all same events at the same time, for instance through a specific Note tag (like <Hidden>). Anything that allows me to identify and group them, so I can run something like:

$gameMap._events_with_Hidden_tag._labelWindow.visibleRange = $gameVariables.value(y)
wouldn't be possible for the visibleRange=Number to set it to Eval(Number(RegExp)['$1']))
so variables can be used?

unless there are more places like that to make it work though, or it could throw
error like that.

I know a plugin that can save the variable value, but I'm not sure it will work in MZ though.
but you can give it a try, so you can use the scriptcalls provided?

Olivia_MetaControls persist switches/variables, but need probably be tested in MZ,
unless FOSSIL can help on it?
wouldn't be possible for the visibleRange=Number to set it to Eval(Number(RegExp)['$1']))
so variables can be used?

unless there are more places like that to make it work though, or it could throw
error like that.

I know a plugin that can save the variable value, but I'm not sure it will work in MZ though.
but you can give it a try, so you can use the scriptcalls provided?

Olivia_MetaControls persist switches/variables, but need probably be tested in MZ,
unless FOSSIL can help on it?
I was thinking about that idea. to change the plugin itself. You would have to consider when the plugin updates, it would revert your changes.
If you're keen to try, make a backup of your project and try-- not sure if there's more to the code than what can be seen.

Do all events share the same range? you can use just the one variable if that's the case.

Since you are affecting the events on the map you are on, have an event in the corner of the map which updates the ranges variable. have it active on switch, and turn off the switch when you're done-- calling it only when you have range updates.
You have to think of creative solutions for your particular project/design.
I'm not sure what to change to be honest, is it somewhere there?

Code:
 * @param VisibleRange:num
 * @text Visible Range
 * @type number
 * @min 1
 * @desc Range the player has to be within the event to make its label visible.
 * @default 30
even if you use eval, the parameters need to be changes too,
if that is obfuscated as well, you need that method to a string.
than type would be left off, in order to use eval ( $gameVariables.value(n); ).

so I think you need to ask the visu team to make the change to use
numbers or eval for a valid JS code (switch, variables, etc).

than it could be done, so that way, I dont think so really.

Original thread: https://forums.rpgmakerweb.com/threads/visustella-label-range.148361/