Here's a simple example. The heart of it is a turn script:
<turnscript name="Follower">
<enabled />
<script><![CDATA[
if (dog.parent <> game.pov.parent) {
dog.parent = game.pov.parent
msg ("The dog follows you.")
}
]]></script>
</turnscript>
The full example is here:
<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Follower">
<gameid>5287577f-78af-4165-a6df-90da78b21ccb</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="bedroom">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="dog">
<inherit name="editor_object" />
</object>
<exit alias="east" to="living room">
<inherit name="eastdirection" />
</exit>
</object>
<turnscript name="Follower">
<enabled />
<script><![CDATA[
if (dog.parent <> game.pov.parent) {
dog.parent = game.pov.parent
msg ("The dog follows you.")
}
]]></script>
</turnscript>
<object name="kitchen">
<inherit name="editor_room" />
<exit alias="west" to="living room">
<inherit name="westdirection" />
</exit>
</object>
<object name="den">
<inherit name="editor_room" />
<exit alias="north" to="living room">
<inherit name="northdirection" />
</exit>
</object>
<object name="living room">
<inherit name="editor_room" />
<exit alias="west" to="bedroom">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="kitchen">
<inherit name="eastdirection" />
</exit>
<exit alias="south" to="den">
<inherit name="southdirection" />
</exit>
</object>
</asl>