Type: cmdptr
cmdptr fields
string - command name
integer - command type like social or skill or just command
integer - minimum level to use command
integer - level of character that can see the log 0 for no logs
integer - minimum position to use command
cmdptr - pointer to the next cmdptr
cmdptr - pointer to the previous cmdptr
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 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
{
cmd := chead();
while (cmd)
{
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);
cmd := cmd.next;
}
cmd:=getcommand("kick");
sendtext ("You must be "+itoa(cmd.level+" to use kick&n",self);
quit;
}
dilend
Type: intlist
This variable type allows you to keep an ordered list of integers with out having to create a variable for each integer.
Example: Setting an intlist
myintlist:={1,5,9,2,8,5};
myintlist.[10]:=50;
If you set a index that is higher then the highest index every index in between will be set to zero. For example if you only have to values in the intlist and you set index value 10 to 50 all indexes between 2 and 10 will be set to 0.
Example: Using intlists
if (myintlist.[5]==5){
stuff
}
if (myintlist<myint){
stuff
}
i:=0;
ln:=length(myintlist);
while (i<ln){
myintlist.[i]:=i;
i:=i+1;
}
See Also Insert a string into a stringlist or integer into an intlist by index and Remove a string from a stringlist or integer from an intlist by index
The only change is that extra pointers now have a intlist attached. An example of defining one in a zone file would look like this.
Example:
extra {"old extra"}
"old extra descrs"
extra {"new extra"}{1,5,9}
"new extra descrs"
Both the old and new format works so you decide if you need the intlist. If you need a Dil can add an intlist later online.
Example:
myext.vals.[5]:=6
myext2.vals:={5,4,3,2,1};
if ( myext.vals.[2]==5){
do stuff
}
>WARNING:
Please be very careful witht he Zoneptr variable type. Understand
that Zoneptr's are not finished and could be unstable. All bugs that
you find please report and make sure you send any suggestions to
'whistler@valhalla.com'
Type: zoneptr
Zone Pointer Fields
unitptr - pointer to next zoneptr
unitptr - pointer to previous zone
stringlist - list of creators
string - zone name (%zone)
string - zone title (title "")
unitptr - pointer to the base room
unitptr - pointer to the base objects of the zone
unitptr - pointer to base NPCs of the zone
integer- reset mode of zone in 'values.h'
integer - the reset time of the zone
integer - the access level of the zone
integer - the loadlevel of the zone
integer - the paystatus of the zone
integer - the number of rooms in a zone
integer - the numbner of objects in a zone
integer - the number of npcs/mobiles in a zone
string - the filename of a zone
string - the Zone Notes
string - the Zone Help
The 'zoneptr' works like a unitptr but it has some serious differences.
WARNING:
The 'rooms', 'objs'', and 'npcs' fields point to the base unit not
to a regular unitptr. This means if you change what these fields point
to it will change all instances of that object that have not been
loaded. Further more currently there is no protection so if you delete
the object it could cause nasty things. We suggest you do not delete
these units it could cause you serious head ache.
To get the first zoneptr in the global list of zones you use 'zhead'.
Example: zoneptr := zhead();
Zone list command
dilbegin zonelist (arg:string);
var
z:zoneptr;
buf:string;
code
{
z:=zhead();
while (z)
{
buf:="Name: "+z.name+"&n";
buf:=buf+"Filename: "+z.fname+"&n";
buf:=buf+"Creator: "+z.creators.[0]+"&n";
buf:=buf+"Notes: &n"+z.notes+"&n&n";
z:=z.next;
}
pagestring (buf,self);
quit;
}
dilend