3 thoughts on “What is LPC”

  1. Chapter 1 LPC program and programming environment
    --------------------------------------------------------------------------- ---------------------rnrn第一节编程环境rnrn通常我们所见到的Mud大多It's LPMUD. LPMUDS uses Unix's instructions and file structures. If you know the unix, some instructions in LPMUD and its file structure are basically the same as ordinary unix.如果你从未使用过Unix,那么它与Dos不同的是在文件的路径用"/",而不是Dos的"".rn一个典型的LpMud的文件是这样的:rn/ Clone/Player/Player.c
    "/Clone/Player/" is the path, Player.c is a file name.
    In most LPMUD, the basic unix instructions below can be used:
    pwd, CD, LS, RM, MV, CP, MKDIR, RMDIR, more, tAIL, ED r, ED
    If you have never used unix, then the following table may be useful.
    pwd: Display the current directory
    cd: Change your current working directory, the same as the CD of DOS.
    LS: List all files in the specified directory. If no directory specifies, then list the files under the current directory. Like the DOS DIR.
    RM: Delete a file like the RMDIR of the DOS
    mv: Like the name of a file as the DOS MOVE
    cp: Copy a file as dos Copy
    mkdir nrmdir: Delete a directory
    more: Press the page to display a file on your current screen.
    cat: Show the entire file. Like DOS Type.
    tail: Show the end of a file.
    ew: Allow you to use the editor with MUD to edit a file.
    ---------------------------------------------------------------------------------------------- ------------

    The second section LPC program

    2.1 LPC program.
    LPC programs seem to be different from ordinary C, and the grammar is basically the same, but the LPC and general language are fundamentally different. The LPC program is to write "Object" one by one. What is the difference? The general program is in the process of execution, and there is usually an obvious start and end. The program starts in one place, then executes in order, and it is interrupted at the end. LPC's Object is not like this.
    The so -called different MUDs are actually different performances of some different LPC Object on a Driver. In other words, LPC's Object is running on a driver. These Objects form a colorful world of LPMUD. Driver almost does not participate in creating the world you are in contact with, and the work it does is to let those Objects of LPCs move. LPC's Object may not have a significant start and end sign, it may
    , like general programs, the LPC "program" is also composed of one or more files. A LPC Object is executed as follows: Driver reads the file related to this object into memory, and then explains the execution. But remember that when reading in memory, it does not mean that it starts to execute in order.

    2.2 Driver and Mudlib relationship
    In some games, the entire game includes Driver and the game world. It is impossible for them to add anything in the game. LPMUD is the opposite. Driver should have almost no direct connection with the world that players come into contact with. The game world should be independent, and it is "played and added". This is why LPMUD uses LPC as a programming language. It allows you to create a game world, and then Driver reads into interpretation when needed. LPC is even simpler and easier to understand than C, but it can create a world that allows many people to play above.
    Is when you write a LPC file, it exists on the hard disk of the host. In the game, when the entire Object is needed, this file will be transferred to the memory, and a special function is called to initialize some variables of this Object. Now you do n’t need to care about what is a variable, what is a function, and how the game itself calls this object. You just remember that Driver reads a file from the hard disk, and then placed in the memory, if there is no

    2.3 A object is installed.
    Object does not have a characteristic place for Driver to execute it. Usually Drvier will find a place in Object to initialize it. This function is usually called create ().
    LPC's Object is a combination of some variables (its value can be changed) and functions (functions are usually used to manipulate those programs of those variables). The function of the function to manipulate variables is: call other functions, use the function (EFUN) defined by Driver, basic LPC expression and flow control.
    Let's look at a variable example: wiz_level. This variable records your wizard level. If it is 0, it is usually ordinary players. If this value is bigger, the higher the level of your wizard. This also controls whether you can execute some wizards. Basically, an object is something that is "piled" together. Object has changed, that is, one or some variables change. Overall, if an Object is called by another Object in the memory, Driver will find the pile of the variable of this Object. If these variables are not worth it, then Driver will call a specific function create to initialize these. variable.
    but the create () is not where the LPC code starts, but most Object starts here. In fact, create () does not exist. If this Object does not need to initialize the variable, then the create () can not exist. Then the place where such Object starts to execute is completely different from ordinary Object, which can start from anywhere.
    So what exactly is the Object of LPC? The Object of LPC is a collection of a bunch of variables. It has one or more functions to control these variables. The order of the function of the function is indifferent. It has no effect on the characteristics of this Object.

    2.3 code style
    The order of function on it has no effect on the characteristics of this object. But a program with a good code style is important to LPMUD. Because LPMUD is usually not done by one person, if the program is not good, then it is difficult for others to understand your "work". And there is a good program style that can give people an elegant feeling, so I hope that the LPC program you write can have a good style. Some of everyone may join the XO Team to create their dreams in the future. We ask you to use the following format writing procedures.

    2.3.1 header file
    Themid at the beginning of a file is a description. The following format is used:

    /* /u/trill/obj/test.c R r case library
    * Test Object
    * Created by Trill 19970808
    * Version @(#) test.c 2.1 (#)
    * Last modified by trill 19971008
    * Test Tell_wizard this simul_efun n*/
    The line is the absolute path of this file, which is the entire path.
    The second line is its Mudlib
    The third line is a simple description of its function, which can exceed one line.
    The fourth line is the author and creation time of this file.
    The fifth line is its version number, which may be modified many times, or even rewritten. This number 2.1 marks how many changes it has made.
    The sixth line is the last modified person and time.
    The line of line is the last some modification.
    For an Object, we must have such an explanation, especially the five elements in the previous five elements must exist. If you make a change, you must add the last two lines. In this way, we can understand some very important information from this description.

    The following are some files and inheritance (Inherit) some objects.

    #include u003CnSi.h>
    #include/test.h "

    Inherit npc;
    n files of the system first system , Later some of the header files. What is particularly required is that there must be a ".h" file with the same name as the Object. For example #include "include/test.h".
    It defines the original form of all functions used in test.c in test.h, as well as defining some macro and constants.
    The advantages of doing this are:
    It no function does not have a function when referenced,
    If the second, if you want to know what functions of this object Looking at the test.c, it may be very long.
    It if a Help system is established to query the function of each object, then you can read test.h directly, otherwise it is a very troublesome thing.

    Is we are in the inheritance part of Inherit.

    2.3.2 Variable description

    In the variable description section, everyone is better to add a simple explanation behind each variable.

    2.3.3 Function

    The order and name of a function of an object have no effect on the performance of this object. But in order to make this Object good readability, we require an Object function to arrange and name it in the following ways:
    first is the interface part of the variable. Use a get variable to return the value of the variable. For example,

    static int level;

    void self (int i)
    level = i;

    INT GetLevel ()
    Rturn level;
    On the second is some functions that control and control variables. For example,

    void addLevel (int i)
    The order and name of a function of an object have no effect on the performance of this object. But in order to make this Object good readability, we require an Object function to arrange and name it in the following ways:
    first is the interface part of the variable. Use a get variable to return the value of the variable. For example,

    static int level;

    void self (int i)
    level = i;

    INT GetLevel ()
    Rturn level;
    On the second is some functions that control and control variables. For example,

    void addLevel (int i)
    level = i;

    One letters uppercase.

    is the events that can be done by some Object, such as fighting, marriage, and so on. For example,

    void eventquit ()

    For example, and so on.

    It the following is some functions called by Driver, such as Create (), Heart_beat, Setup ().

    The last Object's own private functions to complete some special functions. These functions usually let the lowercase required for each word, which is separated by the line (_) in the middle.

    The note is to separate each function with an empty line.

    This are the overall requirements for a file. If you are interested in writing programs in XO Team in the future, it is best to develop such programming habits from now on. If you are a wizard in other MUDs, I think it is best to have a unified and neat style in a MUD.
    Maybe you will ask, is it necessary? This is too troublesome, the program can understand it. This is wrong. LPMUD is a project in cooperation with everyone. Will use it, it may always "die" on the hard disk. And the unified naming method can find the functions you need as soon as possible, and it can also improve the readability of the entire program.
    Is have some other requirements for code style XO. We will introduce it in the future articles. If you join XO Team, the code style will be the first article to read.

    About the LPC program and programming environment, here is introduced. After reading this chapter, I think you need to remember that LPMUD uses LPC as a programming language, and the UNIX file structure is used as a file tissue form. LPC is a language that writes Object. Its program does not have a special sign and ending. If Object is used, then it is transferred to memory. If this object has a function called Create (), it is first executed to initialize some variables.
    LPC's Object is a collection of a bunch of variables, with some functions that can manipulate to change these variables. LPC's code style, I think a MUD is best to have a unified style, and special XO has its own special requirements.

    It questions:
    The wizards for a long time, and also wrote something with LPC. I have been trying to understand LPC, because I see if a wizard does not really understand LPC, he cannot really understand LPMUD. Understanding LPC does not just mean it can be used. Many wizards can use it but do not really understand it. I hope that in this LPC introduction article, I can give you an overall impression of LPC, truly grasp and understand LPC, and create the world of dreams in my heart.
    ---------------------------------------------------------------------------------------------- ------------

    ------------------------------------------------------------------------- ------------------------------rn第二章Lpc的数据类型rn----- ------------------------------------------------ ----

    Pelasium first preface

    LPC's Object is composed of zero or more variables that are manipulated by one or more functions. The order of function arrangement in the code does not affect the characteristics of Object, but affects the readability of the code. When the Object you wrote was first called, Driver put the code you wrote into the memory. When each other is transferred to the memory, all variables are worthless. Create () is called to initialize the Object value.
    create () The function is immediately called immediately after the memory is installed in the memory. When you read this article, you may know nothing about programming. You may not know what the function is and how it is called; maybe you have some programming experience, you may call the newly created Object function. How to start to be confused. Before these confuses are resolved, it is necessary for you to understand what these functions are manipulating control. So you'd better read this chapter first: the data type of LPC. It can be said that almost 90 % of errors (including loss {} and ()) are due to errors using LPC data types. I think this chapter can help you make more easily programming.

    --------------------------------------------------------------------------------------------------- ----------------- rnrn第二节让计算机理解你rnrn2.1 计算机语言rn众所周知的The language that the computer understands is actually a machine code composed of "0" and "1". Computers do not understand the natural language of human beings at all. In fact, it does not understand the advanced language we use, such as Basic, C, C , Pascal and so on. These advanced languages ​​make us easier to realize our ideas. However, these advanced languages ​​are ultimately translated into computer language composed of "0" and "1".
    The two methods can translate advanced languages ​​into computer languages: compile and interpretation. The compilation class uses a compiler to translate it into a computer language after the program is written. The compilation is completed before the program is executed. The process of interpreting the translation process is performed during the program execution. Because the language program of the interpretation class is explained while executing, it is generally slower than compilation and compilation.
    Wet, they will eventually be translated to 0 and 1. But variables,
    The variables in your memory cannot be just 0 and 1.
    So you must have a method in the programming language used by you
    to tell the computer that 0 and 1 should be used as
    thing. In this way, the
    is used to use the data type.

    2.2 Data type
    A simple example: You have a variable now, you call it ‘x’ and
    give it a decimal meal value 65. You can do this in LPC:

    x = 65;

    In the following things you can do:

    Write (x "n");
    y = x 5;
    Plip 65 and letters" a "on the screen in the first line
    Pay in variable y
    has a problem for the computer: it does not know what you call X = 65; what does 65 mean.
    do you think it is 65, but the computer may think:

    , but for the computer, the letters A is also regarded as:

    So when you want the computer to understand WRITE (x "n"); Then it must have a method
    knows that you want to see 65 instead of A.
    The computer is to distinguish 65 and A. A. A data type simply n Somewhere in memory, where it represents or pointed to a given variable, these memory
    what type of data stored data. Each LPC variable must have its corresponding variable type.
    The example given above should have the following lines before those code:

    int x;
    ---- r

    The line tells what type of value of Driver X, which should be used as a data type INT
    . int is a 32 -bit integer. At this point, you should have the basic data type
    , and why there must be data types. They can let Driver know that the computer exists
    What is 0 and 1 in memory.

    2.3 LPC data type r r r r r r r r

    The Driver of all LPMUD will have the following data types:

    void, int, string, object, mixed, int *, string *,
    object *, mixed *

    D. Most Driver will have these important data types below:

    float, mapping, float *, mapping *

    The following data types:

    Function, Struct, Class, CHAR

    The data types supported by Mudos: (take v22pre8 as an example)
    nvoid , Int, String, Object, Float, MAPPING, Function,
    Class, MIXED, Int *, String *, Object *, Float *,
    mapping *, Function *, class *

    2.4 Some simple data types
    In the entry of LPC, the following data types will be introduced:
    void, int, float, string, object, and mixed. For complex data
    Types such as: mapping, array, and some unusual types such as: class,
    function, I will introduce it in the LPC advance. This section mainly introduces three data categories Type:
    int (integer), Float (floating point number) and string (string).

    A int (integer) is an integer, such as 1, 42, -18, 0 , -10002938 These
    are integer. In Mudos, an integer is a 32 -bit integer, with symbolic integers.
    , for example, the talent of creatures, age, etc. are usually int (integer).
    one float (floating point number) is a real number, such as 2.034, -102.3453, 0.0,
    .33 These are a floating -point number. A floating point number in Mudos is also a real number of
    32 -bit, and the real number of symbols. Float is usually not commonly used.
    In the value nature of Object, we usually do it. Use int and float, and even use
    int. In the initialization of variables, int and float automatically are automatically assigned to 0. But the general Driver
    . For example, Mudos does not check the value of the values. The INT and Float
    are both the number of symbols. Pay attention to these two points.
    string (string) is composed of one or more characters, such as "a", "I am a bird!" ,
    "42", "Flying Bird 15 years old.", "I am trill.", these are string. Note that
    string is "" "" It can distinguish the int (integer) 42 and string (word
    string) "42", and the second can distinguish the variable name (such as Room) and string of the same name (such as
    "Room"). When the string type variable is initialized, if it is not explicitly given a
    string, such as: empty string "", that will be 0, that is, an empty pointer.
    as the most basic data type type INT, FLOAT and String are the basis of some complicated data
    . Operating and operating operators for this data will be introduced later,
    The operating symbols are consistent. Just one thing is to add directly to
    LPC to support String and int or Float directly, for example, what we mentioned above:

    Write (x "(x "n");

    "n"It is a character, X is a integer variable. In the LPC interpretation execution, the value of
    x represents the value of
    x into a string, and then connects the two string together. Use a variable in programming, you must first let Driver know about this variable
    what kind of data type represents. This process is called variable declaration. Disclaimer. How to do it? It is to put the name of the
    in front of the variable name you want to use. For example:

    void add_x_and_y ( )
    int x;
    int y;

    x = 2;
    y = x x * x;
    } n-- ---

    The above is a complete function. The function name is add_x_and_y (). In this function,
    The data type supported by MUDOS:
    A integer (32 -bit).
    A floating point number (32 -bit).
    The unlimited long string.
    Pripped to the pointer of an object.
    A relationship type array. (Object, function name) such a combination.
    The declaration of array uses a basic type.
    It is useful to the function. It shows that this function
    does not return any value.
    This is a special data type that can point to any data type. Mixed, then Driver will not check it.
    The customized data type, similar to C's struct, is different from C and Class. Type.

    to a variable, Driver needs to know about 0 and 1 in the computer memory
    what to refer to, so that we introduce the type of data. Three simple data
    , at the same time, understand the various data types supported by MUDOS. For various operators, no
    has different operating symbols in the same data type, such as you let "flying birds"/ "Trill", then
    driver will definitely return an error. Most number of operators and C/C The same,
    is just support string and numbers.

    -------------------------------------------------------------------------------------------- ------------------------------------

    ---------------------------------------------- ------------------------------------------------ -
    Chapter 3 LPC's function
    --------------------------------------------------------------------------------------------------------------------------------- ------------------------rnrn第一节序言rnrn在前面的介绍中, Everyone should know that LPC's Object contains functions that can process variables.
    When the function is executed, its work is to handle the operating variable, and the call (call) other letters
    numbers. The variable is changed in a function. The variable must have a data type so that the computer can understand
    The "0" and "1" in the memory it pointed to the memory. The nature of an object is usually determined by the variables contained in its
    , but the performance of its characteristics depends on the function it contains. One
    object does not contain any function, which is unimaginable. So: What is a function.

    --------------------------------------------------------------------------------------------------- ----------------- rnrn第二节函数rnrn2.1 什么是函数?
    is the same as the function of mathematics. You give the LPC function a value, and it can return a value. Some words
    , such as Pascal, which will distinguish between processes and functions. LPC is the same as C/C . There is no process, but
    is useful to understand this difference. Pascal is called the process of the process, and the LPC is called the function of the VOID
    . In other words, the process is a function that returns nothing. Pascal is called function,
    must return something. In the LPC, the most boring, the simplest, but also the correct function
    This is:

    void () {}

    This This function does not receive any input, does not execute instructions, and does not return any value.

    each LPC function consists of three parts:
    1) Function
    2) Function
    3) function call

    is the same as variables as variables The function must have a statement first. This allows Driver to know:
    1) What kind of data type will this function return.
    2) What are the inputs and how much. The input is usually called the parameter.
    A function declaration is usually like this:
    type function name name (parameter 1, parameter 2, ..., parameter n);
    There is a string
    parameter, which returns an int.

    int (string str);

    In the statement above, STR is the input parameter The variable name can not be. That is to say, it is possible to
    m as a statement below ()

    int (string);
    r The n function definition is code, which describes what this function does to the parameters of the descendants.
    The function calls are other functions that use this function anywhere. A function will never be called after it is written. The only significance of the existence of this function can only be a waste of memory and
    hard disk. The purpose of a function is to be called.
    The following is an example of the two functions calling each other. The two functions are () and
    add (),
    n -------
    /* The first is the function function Disclaimer, this is usually in the beginning of an Object.

    void ();
    int add (int x, int y);

    /* The function definition of function write_vals (). We assume that this function will be called
    * is to describe this object.
    void ()
    int x;
    nx = ADD (2, 2); // We specify the value returned after the X receives the call function ADD ().
    Write (x "n");

    / * The function definition of the function ADD (). nreturn (x y);

    The point is indicated. In the style of XO, we require that all functions must be sound
    , this is explained at the beginning of us. But in fact, the function of the function declared by the function
    is those that are called before the function definition. It is only regulated, but it will bring benefits to programming.

    In this section we know what functions are, what functions are composed of. It is for it to call it. A function will never be called, then it will
    lost the existence value. Usually others use the functions you wrote, usually only care about the parameters of the descendants
    What to do is what is the function of this function and what is returned. Therefore, a function name of a function of a
    function can directly describe the function of this function. One chapter illustrates the naming mechanism of the function stipulated by XO. The unified naming method is
    to help cooperate with each other to improve efficiency. After saying the word EFUN, they are the function of external definition, and they are abbreviations of
    defined functions. That is to say, they are defined by Mud Driver
    . LPC's code, you may find this
    -like expression: this_player (), strcmp (), implode (), file (),
    , etc., it looks like a function, and you Find the entire Object inheritance of the entire Object
    , all of all Objects, which indicates that they are EFUN.efun's existence of value
    because they are executed than the functional speed of the functional function of the ordinary Object. Fast, why
    fast, because they exist in the form of binary that can be directly understood by a computer. For the functions defined by Object

    The main work is to write some Objects composed of LFUN.
    The two functions in the () in the above example, the first is
    function ADD (), which is available for What you declare and define, this is LFUN. The second call,
    is to call the function write ().
    is good. You just call it.
    efun is founded for
    1) It is very commonly used, and many functions will be called every day.
    2) The input and output of the internet socket is processed.
    3) and some LPCs are difficult to deal with, after all, LPC is a small subset of C.
    efun is written in C and embedded in Driver. Before MUD gets up, compile with Driver
    , they will execute much faster. But as you expect, their
    calls are exactly the same as the method of calling the function you wrote. Overall, the
    is the same as the general function, what parameters need to be passed, and it will return.

    How to get some EFUN information, such as the parameter and the type returned, usually in a
    mud, you can find it under the directory like this/doc/eFun, or directly
    Then instructions with Help u003CEFUN name> instructions can be helped. EFUN and Driver, which depends on your MUD
    , is very different from different Driver.
    For XO, Mudos is used, general EFUN, as long as you use the HELP instructions to get
    help, or you can see how the source code is used to see how others use it. R n Why can't you understand an EFUN, you can ask the big wizard, they are usually happy to explore
    to discuss it. But one point pointed out that it is best to solve the problems that can be solved by yourself.

    2.3 Handwritten function

    The function of writing Object with LPC is to express the characteristics of this object. The
    function of this feature is actually arranged in order in order, and the order of arrangement determines this function. One
    is called by a function, and the code of the function is executed in order according to the definition of the function. In
    (), the following sentence:

    x = add (2, 2);

    must be called before Efun: write (), if you want to see the correct result.

    In to return this letter

  2. DLL file is a dynamic link library file, which is an executable file that allows the program to share the code and other resources necessary for the execution of special tasks. The DLL file provided by Windows contains many functions and resources that allow Windows -based programs to operate under the Windows environment.

    dll Most of the files with DLL extensions, but may also be exe or other extension names. They provide code, data, or functions to programs running under Windows operating systems. The program can open, enable, query, disable and turn off the driver according to the instructions in the DLL file.

    dll's full name is Dynamic Link Library, which is called "dynamic link file" in Chinese. In the Windows operating system, DLL is very important for program execution, because when the program is executed, it must be linked to the DLL file to run correctly. And some DLL files can be shared by many programs. Therefore, program designers can use DLL files so that the program is not too huge. However, when there are more and more installation programs, there will be more and more DLL files. If you delete the program, the DLL file that is not used is not deleted, which will cause the system burden over time.

    dll is a dynamic connection library. Some of the advantages of using dynamic connection libraries are:
    1. Multiple applications sharing code and data: For example, each component of Office software has similar appearances and functions, which is achieved by sharing dynamic connection libraries.
    2. Dynamic connection libraries must be used when the hook program filtering system message.
    3. The dynamic connection library divides a large application into several small modules in a natural way, which is conducive to the division of labor and cooperation of members inside the group. Moreover, each module can be upgraded independently. If a member in the group develops a group of practical routines, he can put these routines in a dynamic connection library to use other members of the group.
    4. In order to achieve the internationalization of the application, dynamic connection libraries are often needed. Using a dynamic connection library can store information for a certain country and language. For different versions, use different dynamic connection libraries. When using AppWizard to generate an application, we can specify the language used by resource files, which is achieved by providing different dynamic connection libraries.
    VC , C Builder, Delphi can all write DLL files. Visual Basic 5.0 above versions can also write a special DLL, namely Activex DLL.

    dll is not a program that runs independently. It is a part of a certain program. It can only be called by the procedure. Users can't, and don't need to open it.

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
Scroll to Top