Manual:DIL Manual/weapon info()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 13:08, 27 May 2020 by Nove (talk | contribs) (XML import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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


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