VioneT

joined 1 year ago
MODERATOR OF
[–] VioneT 2 points 3 months ago (1 children)

Maybe the locker-plugin might be a better example. It essentially stores the 'locked' value, so when update() is used, it would only return the 'locked' value.

[–] VioneT 1 points 3 months ago (5 children)

What is being locked is the entire 'unevaluated' item (since we are using .selectOne). Unfortunately, evaluating the tooltip-plugin instances seems to remove the tooltip function. Which is why most of the time we are using the .evaluateItem so that only the 'text' and 'evaluated' string is saved, no more randomization, no more perchance syntax, etc, but it doesn't work with the tooltip-plugin.

Some explanations which might not explain really well.

For the first one:

  1. You are selecting one item from the indirecttext list with indirecttext.selectOne.
  2. If the item selected is the [tooltip(...)] it would lock properly. This is because the item to be saved is just that item.
  3. If the item selected is the [text.evaluateItem]. It would save the [text.evaluateItem] which would then 'evaluate' its text, meaning it would randomize again. Which is why it isn't locking, since what you have locked is [text.evaluateItem] which resolves into random items from the text list.
  4. indirecttext.selectOne -> then [text.evaluateItem], is selected, then, is locked. Upon randomizing -> locker gets the locked value, which is [text.evaluateItem] -> evaluates to any of items in the text list -> shows that the item is not locked.

The item locked is only either [text.evaluateItem] or [tooltip(...)], the lock doesn't propagate into its items.

For the second one:

  1. You are selecting the [tooltip(...)]. In which case the whole [tooltip(...)] is locked.
  2. It re-randomizes since you are re-calling the [tooltip(...)] which would re-evaluate it, or create the tooltip again, in which it re-randomizes the {1-5} that you have to it.
  3. [tooltip("...{1-5}", "...")] -> ... (random number 3) ... -> clicked randomize -> recreates the saved [tooltip(...)] which means it re-selects the {1-5} upon display, which results it in not being 'locked' while it is locked.

The item locked is:

  [tooltip("this text (random number {1-5})", "This tooltip will not become inaccessible, but the field will not properly lock.")]

However, it doesn't appear locked since the tooltip has a 'randomization' with {1-5} which are evaluated after.

[–] VioneT 1 points 3 months ago (7 children)

I guess that is just how the plugin works. Mostly caters only to spoiler texts.

Here is a simple one I made that allows HTML as an input.: https://perchance.org/9xaiky68ni

[–] VioneT 1 points 3 months ago* (last edited 3 months ago) (7 children)

Seems like [locker("txt", text.selectOne)] works, it still has a tooltip even after pressing the randomize button.

Using the [locker("txt", text)] doesn't lock the selection since you are locking a list not a single item. [locker("txt", text.evaluateItem)] seems to lock the single item, but the 'function' of tooltip seems to not carry over.

[–] VioneT 1 points 3 months ago (3 children)

Yup, a good example of it is the tap-plugin, different outputs but is remembered by the page.

[–] VioneT 1 points 3 months ago (9 children)

Can you give an example of what you are using the [] in the HTML panel for? It might be easier to write the script that you want to execute on the List Editor instead of writing the whole thing inside the [] in the HTML editor.

[–] VioneT 1 points 3 months ago (5 children)

You can also probably just set the value you want to retrieve again to a window variable as well, then just return window.savedValue instead of returning nothing.

yourFunction() =>
  if (!window.yourFunctionHasBeenRan) {
    // do things
    window.savedValue = 'theValue'
    window.yourFunctionHasBeenRan = true
  }
  return window.savedValue
[–] VioneT 1 points 3 months ago* (last edited 3 months ago) (7 children)

Most of the time, you can create a variable on the window object, then check that variable again if the content has already been added.

yourFunction() =>
  if (!window.yourFunctionHasBeenRan) {
    // do things
    window.yourFunctionHasBeenRan = true
  }
  return ""
[–] VioneT 1 points 3 months ago (1 children)

I think it is meant to work like that. But it is recommended that your odds are inside the square brackets.

Anything after ^ is considered on the odds. So ^[1]2 would be ^12. For example, you have a variable a = {0-100}, then you have ^[a]/100 it would then be ^33/100 which would be the odds.

p.s. Post Body Mentions doesn't work
@[email protected]

[–] VioneT 1 points 3 months ago (1 children)

There seems to be a delay/caching that happens when the lore is downloaded and loaded. After a while (not sure how long), the lorebook would delete the cache and re-download the new content. If you want an immediate change, you can directly add the new lore on the text editor on the top.

view more: ‹ prev next ›