[ Package Index | Mudlib Index | Effect Index ]

File /std/learning.c

Register a lesson with the learning system.

Includes

This class includes the following files /include/money.h, /include/shops/bank.h and /include/tasks.h

Class Index

 o lesson
 o step

Method index

 o add_step(string, string *, string, int, string *, string *, string, string, string)
Add a step to a lesson plan.
 o has_required_cash(string, object)
has_required_cash( string name, object player ) Give some, get some.
 o has_required_materials(string, object)
has_required_materials( string name, object player ) Materials: Materials are objects which are necessary for a student to learn something.
 o has_required_skills(string, object)
has_required_skills( string name, object player ) Skills: Skills and skill levels which may be necessary to learn something For instance, one should learn to walk before one learns to run.
 o lesson_end(string, object)
 o lesson_response(string, object, int, string)
 o lesson_step(string, object, int)
 o query_lessons()
This method returns an array of the registered lessons.
 o register_lesson(string, mapping, mapping, string *, int, string, string *, object)
 o start_lesson(string, object)
This method starts a lesson for a given player.

Public Functions

These are functions that everyone can access.

.
 * add_step
int add_step(string lesson_name,
             string * blurbs,
             string skill,
             int diff,
             string * responses,
             string * params,
             string award_mess,
             string succeed_mess,
             string fail_mess)
Add a step to a lesson plan. This is the interaction between student and teacher. One step should be defined for each thing you want the student to learn.

Parameters:
lesson_name - the name of the lesson this lesson plan is associated with.
blurbs - An array of strings in order that they should be given during the lesson. This is what the teacher says to the student. ', :, #, etc. can be used for say, emote and execute a command respectively.
skill - The skill being learned.
difficulty - The bonus level of the skill being learned.
responses - An array of strings. These are the expected responses to the teacher's blurbs.
params - an array of strings given as arguments to the responses in order.
award_mess - The string a player sees if they get a TM award during this step. It should not end in a newline \n.
succeed_mess - The string a player gets if they are successful in doing what the step asks. It should not end in a newline \n.
fail_mess - A string telling the player that they've failed. It should not end in a newline \n.
 * has_required_cash
int has_required_cash(string name,
                      object player)
has_required_cash( string name, object player ) Give some, get some. Money makes a teacher more likely to teach you.

Parameters:
name - name of the lesson they're trying to learn
player - player object of the player trying to learn
 * has_required_materials
int has_required_materials(string name,
                           object player)
has_required_materials( string name, object player ) Materials: Materials are objects which are necessary for a student to learn something. For instance, to learn to speak a language, you might need a textbook. To learn to ride a horse, you might want to require a helmet.

Parameters:
name - name of the lesson they're trying to learn
player - player object of the player trying to learn
 * has_required_skills
int has_required_skills(string name,
                        object player)
has_required_skills( string name, object player ) Skills: Skills and skill levels which may be necessary to learn something For instance, one should learn to walk before one learns to run. If you don't have sufficient skill levels in walking, you won't be able to learn how to run.

Parameters:
name - name of the lesson they're trying to learn
player - player object of the player trying to learn
 * lesson_end
int lesson_end(string name,
               object student)
 * lesson_response
int lesson_response(string name,
                    object student,
                    int lessonstep,
                    string args)
 * query_lessons
string * query_lessons()
This method returns an array of the registered lessons.

Returns:
a list of lesson names.
 * register_lesson
int register_lesson(string name,
                    mapping minimum_skills,
                    mapping maximum_skills,
                    string * materials,
                    int cost,
                    string currency,
                    string * lesson_ending,
                    object teacher)
 * start_lesson
int start_lesson(string name,
                 object player)
This method starts a lesson for a given player.

Parameters:
the - lesson name
the - player

Protected Functions

These are functions that only objects inheriting the class can access.

 * lesson_step
void lesson_step(string name,
                 object student,
                 int lessonstep)

Classes

These are nice data types for dealing with... Data!

 * lesson
class lesson {
               mapping minimum_skills;
               mapping maximum_skills;
               string * materials;
               int cost;
               string currency;
               string * lesson_ending;
               object teacher;
               class step * plan;
}

 * step
class step {
             string * blurbs;
             string skill;
             int difficulty;
             string * responses;
             string * params;
             string award_mess;
             string succeed_mess;
             string fail_mess;
}


Discworld MUD's distribution world wide web pages.
brought to you by
Cut Me Own Throat Dibbler's Sensational Sausages; buy one while they are hot.
File last modified: Sat, 06 Sep 2003 03:24:40 GMT

Lost? Try Discworld's home page.