///
interface SavedEventOptions extends StoredVariableOptions {
description : string;
valueDescription : (value : T) => string;
}
class SavedEvent extends StoredVariable {
private description : string;
public getValueDescription : (value : T) => string;
public constructor (options : SavedEventOptions) {
super(options);
this.description = options.description;
this.getValueDescription = options.valueDescription;
}
public getDescription () {
return this.description;
}
}
//Example
let EVENT_ORC_CHIEF_KILLED = new SavedEvent(
> {
id: "EVENT_ORC_CHIEF_KILLED",
description: "Describer whether the orc chief is alive or dead.",
value: false,
valueDescription: (value: boolean) => {
if (EVENT_ORC_CHIEF_KILLED.value) {
return "The orc chief has been killed.";
} else {
return "The orc chief is alive."
}
}
}
);