Difference between revisions of "Manual:DIL Manual/cmdptr"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
==cmdptr==
+
<span id="cptr"></span>
'''cmdptr fields'''
+
'''Type:  '''<i><!--CODE-->cmdptr</i><!--ENDCODE-->
 +
'''cmdptr fields'''
  
  
Line 19: Line 20:
  
  
The cmdptr can be used to search the command list or display all the commands.
+
  The cmdptr can be used to search the command list or display all the commands.
It is also now possible to sort the commands by type by defining your own command
+
I0t is also now possible to sort the commands by type by defining your own command
types and using the type field to sort on.
+
types and using the type field to sort on.
  
In order to get the first command in the list you use the following function:
+
  In order to get the first command in the list you use the following function:
 +
'''Function:  '''<i><!--CODE-->chead();</i><!--ENDCODE-->
 +
If you want to get a specific command then you use the following function:
 +
'''Function:  '''<i><!--CODE-->cmdptr := getcommand (s : string );</i><!--ENDCODE-->
 +
'''Example:'''
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
  
'''Function: '''chead();
+
  dilbegin cmdtst(arg : string);
If you want to get a specific command then you use the following function:
+
var
'''Function: '''cmdptr := getcommand (s : string );
+
  cmd : cmdptr;
 +
  st : string;
  
===Example===
+
code
 +
dilend
  
  dilbegin cmdtst(arg : string);
+
---~---~---~---~---~---~---~---~---
  var
+
 
    cmd : cmdptr;
+
</i><!--ENDCODE-->
    st : string;
+
 
  code
+
 
  {
+
---~---~---~---~---~---~---~---~---
    cmd := chead();
+
<span id="cptr"></span>
    while (cmd)
+
'''Type: '''<i><!--CODE-->cmdptr</i><!--ENDCODE-->
    {
+
'''cmdptr fields'''
      st := cmd.name + " " + itoa(cmd.level) + " " + itoa(cmd.type) + " " +
+
 
      itoa(cmd.loglevel) + " " + itoa(cmd.position);
+
 
      act("CMD: $2t", A_ALWAYS, self, st, null, TO_CHAR);
+
'''name'''
      cmd := cmd.next;
+
            string - command name
    }
+
'''type'''
    cmd:=getcommand("kick");
+
            integer - command type like social or skill or just command
    sendtext ("You must be "+itoa(cmd.level+" to use kick&amp;n",self);
+
'''level'''
    quit;
+
            integer - minimum level to use command
  }
+
'''loglevel'''
  dilend
+
            integer - level of character that can see the log 0 for no logs
 +
'''position'''
 +
            integer - minimum position to use command
 +
'''next'''
 +
            cmdptr - pointer to the next cmdptr
 +
'''previous'''
 +
            cmdptr - pointer to the previous cmdptr
 +
 
 +
 
 +
  The cmdptr can be used to search the command list or display all the commands.
 +
I0t is also now possible to sort the commands by type by defining your own command
 +
types and using the type field to sort on.
 +
 
 +
  In order to get the first command in the list you use the following function:
 +
'''Function:  '''<i><!--CODE-->chead();</i><!--ENDCODE-->
 +
If you want to get a specific command then you use the following function:
 +
'''Function:  '''<i><!--CODE-->cmdptr := getcommand (s : string );</i><!--ENDCODE-->
 +
'''Example:'''
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
 +
 
 +
dilbegin cmdtst(arg : string);
 +
var
 +
  cmd : cmdptr;
 +
  st : string;
 +
 
 +
code
 +
dilend
 +
 
 +
---~---~---~---~---~---~---~---~---
 +
 
 +
</i><!--ENDCODE-->
 +
 
 +
 
 +
---~---~---~---~---~---~---~---~---

Latest revision as of 22:36, 4 December 2025

Type:  cmdptr
cmdptr fields


name
            string - command name
type
            integer - command type like social or skill or just command
level
            integer - minimum level to use command
loglevel
            integer - level of character that can see the log 0 for no logs
position
            integer - minimum position to use command
next
            cmdptr - pointer to the next cmdptr
previous
            cmdptr - pointer to the previous cmdptr


  The cmdptr can be used to search the command list or display all the commands.
I0t is also now possible to sort the commands by type by defining your own command
types and using the type field to sort on.
  In order to get the first command in the list you use the following function:
Function:  chead();
If you want to get a specific command then you use the following function:
Function:  cmdptr := getcommand (s : string );
Example:

---~---~---~---~---~---~---~---~---
dilbegin cmdtst(arg : string);
var
  cmd : cmdptr;
  st : string;
code

dilend

---~---~---~---~---~---~---~---~---


---~---~---~---~---~---~---~---~---

Type:  cmdptr
cmdptr fields


name
            string - command name
type
            integer - command type like social or skill or just command
level
            integer - minimum level to use command
loglevel
            integer - level of character that can see the log 0 for no logs
position
            integer - minimum position to use command
next
            cmdptr - pointer to the next cmdptr
previous
            cmdptr - pointer to the previous cmdptr


  The cmdptr can be used to search the command list or display all the commands.
I0t is also now possible to sort the commands by type by defining your own command
types and using the type field to sort on.
  In order to get the first command in the list you use the following function:
Function:  chead();
If you want to get a specific command then you use the following function:
Function:  cmdptr := getcommand (s : string );
Example:

---~---~---~---~---~---~---~---~---
dilbegin cmdtst(arg : string);
var
  cmd : cmdptr;
  st : string;
code

dilend

---~---~---~---~---~---~---~---~---


---~---~---~---~---~---~---~---~---