Function: addcolor (ch : unitptr, ks : string, cstr : string ) ;
character you are adding the color to
key string for the color
color string
This function allows your Dils to create and add their own personal colors to a players color list. That way you can actually make an act in a color that the player chooses or you yourself choose.
Function: addcolor(pc, "clan_who","&c+w&bn");
Function: addcolor (ch : unitptr, ks : string) ;
character you are deleting the color from
key string for the color
This function is used to delete any colors from a players personal color list.
Function: delcolor(pc, "clan_who");
Function: getcolor (ch : unitptr, ks : string) ;
character you are deleting the color from
key string for the color
This function returns what color a player has for a key in the players list.
Function: string := getcolor(pc, "clan_who");
Function: addcolor (ch : unitptr, ks : string, cstr : string ) ;
character you are adding the color to
key string for the color
color string
This will change a color in a players personal list.
Function: changecolor(pc, "clan_who","&c+w&bn");
Function: gamestate( u : unitptr, gs : integer );
Change the gamestate of a unitptr, uses the GS_ defines from the vme.h. This is used on the log on menu of the VME 2.0 release. which is shown here as an example but it can also be used in a command. When used it removes the char from playing so be aware that players could use this to hide if you run a player killing style mud.
Example:
dilbegin informer();
var
tgt : unitptr;
code
{
heartbeat := PULSE_SEC;
tgt := ghead();
while(tgt.type == UNIT_ST_PC)
{
if((isset(tgt.pcflags,PC_INFORM)) and (tgt != self))
{
if(visible(tgt,self))
{
if(self.outside == tgt.outside)
sendtext(self.name+" has arrived.&n", tgt);
else
sendtext(self.name+" has entered the world.&n", tgt);
}
}
tgt := tgt.gnext;
}
return;
}
dilend
dilbegin aware on_connect();
external
informer();
login_modify(tgt : unitptr);
var
wizlvl : integer;
i:integer;
err : integer;
motd : string;
welcome : string;
goodbye : string;
code
{
heartbeat := PULSE_SEC;
if(dilfind("do_quit@commands",self))
i := dildestroy("do_quit@commands", self);
err := loadstr("motd",motd);
if(err > 0)
{
motd := textformat(motd);
sendtext(motd+"&n&n", self);
}
err := loadstr("welcome",welcome);
if(welcome)
welcome := textformat(welcome);
if (self.level < 200)
{
login_modify(self);
dilcopy ("clan_delete@clans",self);
dilcopy ("clan_clear@clans",self);
if(err > 0)
sendtext("&n"+welcome+"&n&n", self);
informer();
exec("look", self);
quit;
}
gamestate(self, GS_MENU);
:wiz_menu:
sendtext("Welcome to Valhalla&n&n", self);
sendtext("1) Enter Valhalla&n", self);
sendtext("W) Change Wizinv level&n [&c+g"+itoa(self.minv)+"&[default]]&n",self);
sendtext("0) Exit Valhalla&n&n", self);
sendtext("Make your choice: ", self);
wait(SFB_CMD, TRUE);
if (command("1") )
{
gamestate(self, GS_PLAY);
if(err > 0)
sendtext("&n"+welcome+"&n&n", self);
informer();
exec("look", self);
quit;
} else if (command("0") ) {
err := loadstr("goodbye",goodbye);
if(err > 0)
{
goodbye := textformat(goodbye);
sendtext(goodbye, self);
}
destroy(self);
quit;
} else if (command("w") ) {
sendtext("Enter new WizInv Level: ", self);
wait(SFB_CMD, TRUE);
wizlvl := atoi(cmdstr);
if (wizlvl > self.level)
wizlvl := self.level;
self.minv := wizlvl;
} else {
sendtext("Invalid Selection&n&n", self);
goto wiz_menu;
}
}
dilend
Look in vme.h for the possible values you can send to the menu function.
Function: string fits ( ch : unitptr, obj : unitptr, n : integer);
character you are checking for a fit
object you are checking if fits
the wear position in 'VME.h'
'way to small', 'to small', 'way to large', 'to large', or null if fits
This will return if an item fits or a string describing why not if not.
Example:
act_str:=fits(ch,obj,WEAR_BODY);
if (act_str=="")
sendtext ("This object fits!",self);
else
sendtext ("This object is "+act_str+" to fit.&n",self);
quit;
}
Function: string weapon_name( i : integer ) ;
Weapon to get the name of ass defined in 'values.h' and 'weapons.def'
The name of the weapon that corresponds with the integer value
example:
myweap:=weapon_name(5);
Function: intlist weapon_info( i : integer ) ;
Weapon to get the info of as defined in 'values.h' and 'weapons.def'
Intlist containing 4 values:
Number of hands
weapon speed
weapon type
shield block value
This function gives you access to the values in the weapons.def file. With this things like 'wear' equipment' and 'look' are much easier to write in Dil.
Example
dilcopy id_weap (arg:string);
var
i:integer;
il:intlist;
code
{
il:=weapon_info(atoi(arg));
if (il!=null)
{
sendtext ("Number of hands: "+itoa(il.[0])+"&n";
sendtext ("Speed: " +itoa(il.[1])+"&n",self);
sendtext ("Type: "+itoa(il.[0])+"&n",self);
sendtext ("Shield value: "+itoa(il.[0])+"&n",self);
}
else
{
sendtext ("No such weapon.&n",self);
}
quit;
}
dilend
Function: string skill_name( i : integer ) ;
Skill to get the name of ass defined in 'values.h' and 'commands.def'
The name of the skill that corresponds with the integer value
example:
myski:=skill_name(5);
Function: integer islight ( u : unitptr )
Unit that you are checking
''TRUE' if item is a light, 'FALSE' if it is notway to small', 'to small', 'way to large', 'to large', or null if fits
Simply checks the item to see if it is a light.
Function: reboot ;
This function works like a quit command. Anything after the reboot function in a Dil will not be executed the mud will reboot instantly. The zone must have root privileges in the zonelist in order to use this function.
Simple reboot command
dilbegin cmd_reboot (arg:string);
code
{
sendtext ("Rebooting the mud.&n",self);
reboot;
}
dilend