Personal notebook controller - part 3 of 3
func add_entry(entry_id: String, title: String, body: String,
character_id: String = "") -> void:
var owner: String = ActivePlayer() if character_id.is_empty() else character_id
var values: Dictionary = Runtime.get("variables")
var key: String = "journal_" + owner
var entries: Array = values.get(key, []).duplicate(true)
var found: bool = false
for entry: Dictionary in entries:
if str(entry.get("id", "")) == entry_id:
entry["text"] = title
entry["body"] = body
found = true
break
if not found:
entries.append({"id":entry_id, "text":title, "body":body})
await SetVariable({"name":key, "value":entries})
render()add_entry duplicates the saved array, updates an existing matching ID or adds a new dictionary, then writes the array through Set Variable. The displayed list refreshes from that saved source.
Omitting character_id writes to ActivePlayer(). Supplying another reusable character ID writes to that owner’s array. Declare the intended owner arrays in the Variable Designer.
This is a saved personal-notes system. It does not change the engine’s shared quest manager or create independent per-character quest-state objects.
