Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Scripted world info does not appear in the world info menu #5

Open
45adhoc opened this issue Aug 4, 2020 · 2 comments
Open

Scripted world info does not appear in the world info menu #5

45adhoc opened this issue Aug 4, 2020 · 2 comments

Comments

@45adhoc
Copy link

45adhoc commented Aug 4, 2020

Now that the world info is accessible mid-adventure, I decided to look at the world info of one of my scripted adventures, only to find that it was empty. The following code demonstrates that scripted world info does exist in memory when run in an adventure:

const modifier = (text) => {
  
  if (!state.worldInfoAdded) {
    state.worldInfoAdded = true
    addWorldEntry('foo', 'bar')
    return {text: JSON.stringify(worldEntries)}
  }

return {text: text}
}

modifier(text)

However, it will not show up in the world info menu, even after setting world info to be shown in the scenario settings.

Update: It looks like the problem is a missing variable. Running the the above code in a test scenario produced the following:

[{"keys":"You","entry":"You are a cool dude.","isNotHidden":true},{"id":"0.23626612215539655","keys":"foo","entry":"bar"}]

The left entry was added through the world info menu, and the right was added through the script. It seems addWorldEntry has not been updated to use isNotHidden, which means scripted world info will never appear in the menu.

@Zynj-git
Copy link

Zynj-git commented Aug 4, 2020

const modifier = (text) => {
  
  addWorldEntry(`${worldEntries.length}`, "This is entry");
  worldEntries.forEach(entry => entry["isNotHidden"] = true); // true / false doesn't matter since it doesn't have an inherent effect.
  state.message = JSON.stringify(worldEntries);
  return {text: modifiedText}
}

// Don't modify this part
modifier(text)

Even when changing the isNotHidden variable for the entries they will remain hidden from the Edit Adventure -> World Information menu. This also happens for entries created via Scenario -> World Information that have been correctly assigned the variable, but altered via the above script.

@Zeracronius
Copy link

Zeracronius commented Mar 24, 2021

The property "isNotHidden" was deprecated and replaced by "hidden", as seen when exporting world info set to visible.

This means that you need to do "addWorldEntry(keys, entry, hidden = false)" instead.
Seems that they haven't updated the readme to reflect this yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants