-
Notifications
You must be signed in to change notification settings - Fork 26
SIML guidelines
When writing SIML for our AI brain, it's a good idea to stick with some common guidelines and best practices to write clean, efficient and properly working code. Those guidelines are general tips that you should take into account when writing SIML.
If given <Pattern>
is not expected to be called by user, it should be prefixed with {Name}_
of the <Concept>
.
For example, instead of:
<Concept Name="_bob">
<Model>
<Pattern>GET_RANDOM_CAT</Pattern>
</Model>
</Concept>
You can write:
<Concept Name="_bob">
<Model>
<Pattern>_bob_GET_RANDOM_CAT</Pattern>
</Model>
</Concept>
Thanks to that we won't need to fight with potential conflicts if the same pattern is declared twice in two different files.
For example, instead of:
<Concept Name="_bob">
<Model>
<Pattern>WHO IS KALEITH</Pattern>
<Pattern>WHO IS THIELAK</Pattern>
</Model>
</Concept>
You can write:
<Concept Name="_bob">
<Model>
<Pattern>WHO IS (KALEITH|THIELAK)</Pattern>
</Model>
</Concept>
At the same time you should still stick with multiple patterns if they're entirely different or they do not differ only by a few words. This approach makes it easier for us, humans, to read the code.
A pattern such as:
<Concept Name="_bob">
<Model>
<Pattern>:awoo:</Pattern>
</Model>
</Concept>
Will work only with literal :awoo: text, as in - user who isn't permitted to use the emoticon.
When actual emoticon is used, Steam network encodes standard :
into ː
. If you want to target emoticon usage, you should instead write:
<Concept Name="_bob">
<Model>
<Pattern>ːawooː</Pattern>
</Model>
</Concept>
This can also be used to tell when given emoticon is actually executed by user, and not faked with text.
<Concept Name="_bob">
<Model>
<Pattern>:awoo:</Pattern>
<Response>You don't own that emoticon, why you're trying to use it?</Response>
</Model>
<Model>
<Pattern>ːawooː</Pattern>
<Response>Wow, you actually bought that expensive emote? You're crazy!</Response>
</Model>
</Concept>