We’re going to need to save our goals to the database. Since goals are a facet of a character, it makes the most sense to add them to the
Create a file named
aresmush/plugins/custom. Give it the following contents:
module AresMUSH class Character attribute :goals end end
In the game, type
load custom to reload the custom plugin.
ruby enactor.update(goals: "Test goals") to set some goals on yourself.
ruby enactor.goals to view them.
Character is one of the core database models in Ares (along with Room, Exit and Game). Database models contain multiple data fields, called attributes. A character will have a name, an alias, a description, etc.
Ruby lets you extend classes in multiple files. Even though the Character class is defined in the engine, you can add new fields to it from different plugins.
Database fields can take many forms - strings, numbers, lists, hashes, etc. Fields are strings unless otherwise specified, so in the example above we’ve defined a string field named “goals”.
Tip: Since database fields can be defined across multiple files, most plugins prefix their db fields with the plugin name (e.g. fs3_skills) to avoid name collisions.