Manual:DIL Manual/weapon info()

From DikuMUD Wiki
Jump to navigation Jump to search


Function:  intlist weapon_info( i : integer ) ;
  i
         Weapon to get the info of ass defined in 'values.h' and 'weapons.def'
  returns
         Intlist containing 4 values:
  0
         Number of hands
  1
         weapon speed
  2
         weapon type
  3
         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


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