Creation/Dev/Script Functions: NPC Server

From Graal Bible

Script functions (the mud functions, kingdom functions and TMudObject are only available on Graal Kingdoms):

Global:
  allplayerscount - integer (read only)
  canspin - boolean (read only)
  carriesblackstone - boolean (read only)
  carriesbush - boolean (read only)
  carriesnpc - boolean (read only)
  carriessign - boolean (read only)
  carriesstone - boolean (read only)
  carriesvase - boolean (read only)
  graalversion - float (read only)
  gravity - float
  nwday - integer (read only)
  nwhour - integer (read only)
  nwmin - integer (read only)
  nwmonth - integer (read only)
  nwtime - integer (read only)
  nwweek - integer (read only)
  nwweekday - integer (read only)
  nwyear - integer (read only)
  timevar - integer (read only)
  timevar2 - float (read only)
  addguildmember(str, str, str)
  addweapon(str)
  aindexof(float, obj) - returns integer
  attachplayertoobj(int, int)
  bodyexists(str) - returns boolean
  callnpc(int, params...)
  callweapon(int, params...)
  checksum(str) - returns float
  contains(str, str) - returns boolean
  copylevel(str, str)
  copystrings(str, str)
  deletefile(str) - returns boolean
  deletelevel(str) - returns boolean
  detachplayer()
  disableweapons()
  echo(str)
  enableweapons()
  extractfilebase(str) - returns string
  extractfileext(str) - returns string
  extractfilename(str) - returns string
  extractfilepath(str) - returns string
  fileexists(str) - returns boolean
  filesize(str) - returns integer
  findarchetype(str) - returns object
  findareanpcs(float, float, float, float) - returns object
  findlevel(str) - returns object
  findnearestplayer(float, float) - returns object
  findnearestplayers(float, float) - returns object
  findnpc(str) - returns object
  findplayer(str) - returns object
  findplayerbyid(int) - returns object
  findweapon(str) - returns object
  findweaponnpc(str) - returns object
  freezeplayer2()
  getareanpcs(float, float, float, float) - returns object
  getascii(str)
  getextension(str) - returns string
  getguildnick(str, str) - returns string
  gethttprequest(str, int, str) - returns object
  getimgheight(str) - returns integer
  getimgwidth(str) - returns integer
  getkingdomhasright(str, str) - returns boolean
  getkingdomisally(str, str) - returns boolean
  getkingdomisenemy(str, str) - returns boolean
  getkingdomisinkingdom(str) - returns boolean
  getkingdomismember(str, str) - returns boolean
  getkingdomrankname(str) - returns string
  getkingdomrankrights(str) - returns string
  getkingdomranktitle(str) - returns string
  getmapx(str) - returns integer
  getmapy(str) - returns integer
  getnearestmonster(float, float) - returns integer
  getnearestplayer(float, float) - returns integer
  getnearestplayers(float, float) - returns object
  getnpcindex(str) - returns integer
  getplayerindex(str) - returns integer
  getstringkeys(str) - returns object
  hasright(str, str) - returns boolean
  headexists(str) - returns boolean
  hitobjects(float, float, float)
  isobject(str) - returns boolean
  kingdomadd(str)
  kingdomaddally(str)
  kingdomaddenemy(str)
  kingdomaddmember(str)
  kingdomaddrank(str)
  kingdomgetkingdom(str)
  kingdomjoin(str)
  kingdomlistallies(str)
  kingdomlistenemies(str)
  kingdomlistkingdoms()
  kingdomlistmembers(str)
  kingdomlistrankmembers(str)
  kingdomlistranks(str)
  kingdommessage(str)
  kingdommessage2(str, str)
  kingdomprofilekingdom(str)
  kingdomprofilemember(str)
  kingdomprofilerank(str)
  kingdomremove(str)
  kingdomremoveally(str)
  kingdomremoveenemy(str)
  kingdomremovemember(str)
  kingdomremoverank(str)
  kingdomrenamemember(str, str)
  kingdomrenamerank(str, str)
  kingdomsetrank(str, str)
  kingdomsetrankparent(str, str)
  kingdomsetrankrights(str, str)
  kingdomsetranktitle(str, str)
  kingdomsettitle(str)
  levelexists(str) - returns boolean
  lowercase(str) - returns string
  makescreenshot(str)
  md5(str) - returns string
  mudaddinvobject(int, str) - returns boolean
  mudaddmoney(int)
  mudapplyinvobject(int)
  mudapplyobject()
  mudattack(int, int) - returns integer
  mudcastspell(int, int) - returns integer
  mudcommand(str, str)
  mudcountinvobject(str) - returns integer
  muddooropen(int) - returns boolean
  muddropinvobject(int, float, float, int)
  mudequipweapon(str)
  mudexamineinvobject(int)
  mudexamineinvobject2(int, int)
  mudexamineobject()
  mudfindinvobject(str) - returns integer
  mudfirespell(int)
  mudfirespell2(int, int, int)
  mudhaskey(str) - returns boolean
  mudhaskey2(str, str) - returns boolean
  mudhaveskill(str) - returns boolean
  mudidentify()
  mudisbattleground(float, float) - returns boolean
  mudlistequipment()
  mudlistskills()
  mudlistspells()
  mudlistweapons()
  mudmissileactions()
  mudmissileattack(int, int) - returns integer
  mudmoveinvobject(int, int, int)
  mudnpccountinvobject(str) - returns integer
  mudnpcpickupobject(int, int) - returns boolean
  mudnpcremoveinvobject(int, str) - returns boolean
  mudobjectattr(str, str) - returns string
  mudorderinventory(obj)
  mudpay(int)
  mudpickupobject(int) - returns boolean
  mudpickupobject2(int) - returns boolean
  mudremoveinvobject(int, str) - returns boolean
  mudresetinvobject(int) - returns boolean
  mudresetplayer()
  mudrollstats()
  mudselectspell(str)
  mudsetplayerclass(str)
  mudskilllevel(str) - returns integer
  mudspellnumber(str) - returns integer
  mudstartspell(int)
  mudstopspell()
  mudtransferobject(int, int, int, int) - returns boolean
  muduseskill(str)
  muduseskill2(str)
  mudvalue(int) - returns integer
  passwordmatches(str, str) - returns boolean
  randomstring(str) - returns string
  removeguild(str)
  removeguildmember(str, str)
  removeweapon(str)
  requesthttp(str, int, str) - returns object
  requestmysql(str, str, str, str, str) - returns object
  requestsql(str, bool) - returns object
  requestsql2(str, str, bool) - returns object
  requesturl(str) - returns object
  rungarbagecollector()
  saveinfo(str, str)
  savelog(str)
  savelog2(str, str)
  say(int)
  say2(str)
  sendpm(str)
  sendrpgmessage(str)
  sendtonc(str)
  sendtorc(str)
  setani(str, str)
  setbeltcolor(str)
  setcoatcolor(str)
  setgender(str)
  sethead(str)
  setlevel2(str, float, float)
  setpm(str)
  setshield(str, int)
  setshoecolor(str)
  setshootparams(str)
  setskincolor(str)
  setsleevecolor(str)
  setsword(str, int)
  shieldexists(str) - returns boolean
  strcmp(str, str) - returns integer
  swordexists(str) - returns boolean
  testnpc(float, float) - returns integer
  testplayer(float, float) - returns integer
  triggeraction(float, float, str, str)
  triggerclient(str)
  unfreezeplayer()
  updateratingdeviation(float, float) - returns float - old deviation, time of last spar, returns new deviation
  updateratings(obj) - returns object - updates an array of {rating1,ratingdeviation1, rating2,ratingdeviation2, ...}, init them at 1500 and 350
  uppercase(str) - returns string

TGraalVar:
  initialized - boolean (read only)
  joinedclasses - object (read only)
  name - string (read only)
  scriptlogmissingfunctions - boolean
  timeout - float
  addarray(obj)
  cancelevents(str)
  catchevent(str, str, str)
  copyfrom(obj)
  getdynamicvarnames() - returns object
  geteditvarnames() - returns object
  getfunctions() - returns object
  getstaticvarnames() - returns object
  getvarnames() - returns object
  ignoreevent(str, str)
  ignoreevents(str)
  insertarray(int, obj)
  isinclass(str) - returns float
  join(str)
  leave(str)
  loadfolder(str, int)
  loadlines(str)
  loadstring(str)
  loadvars(str)
  loadvarsfromarray(obj)
  objecttype() - returns string
  savelines(str, int)
  savestring(str, int)
  savevars(str, int)
  savevarstoarray(bool) - returns object
  scheduleevent(float, str, params...) - returns object
  settimer(float)
  sortascending()
  sortbyvalue(str, str, bool)
  sortdescending()
  timershow()
  trigger(str, params...)

  TGaniObject (TGraalVar):
    ani - string (read only)
    aniparams - string (read only)
    attr - object (read only)
    colors - object (read only)

    TServerNPC (TGaniObject):
      ani - string
      aniparams - string
      ap - integer
      arrows - integer
      body - string
      bodyimg - string
      bombs - integer
      chat - string
      darts - integer
      dir - integer
      dontsave - boolean
      glovepower - integer
      gralats - integer
      head - string
      headimg - string
      hearts - float
      height - float (read only)
      hidetoclients - boolean
      horseimg - string
      hurtdx - float
      hurtdy - float
      hurtpower - float (read only)
      id - integer (read only)
      image - string
      level - object (read only)
      name - string (read only)
      nick - string
      npcsindex - integer (read only)
      rupees - integer
      save - object (read only)
      shield - string
      shieldimg - string
      shieldpower - integer
      sprite - integer
      sword - string
      swordimg - string
      swordpower - integer
      visible - boolean
      width - float (read only)
      x - float
      y - float
      z - float
      blockagain()
      canbecarried()
      canbepulled()
      canbepushed()
      cannotbecarried()
      cannotbepulled()
      cannotbepushed()
      cannotwarp()
      canwarp()
      canwarp2()
      changeimgcolors(int, float, float, float, float)
      changeimgmode(int, int)
      changeimgpart(int, int, int, int, int)
      changeimgvis(int, int)
      changeimgzoom(int, float)
      destroy()
      destroymudobject()
      dontblock()
      drawaslight()
      drawoverplayer()
      drawunderplayer()
      findimg(int) - returns object
      hide()
      hideimg(int)
      hideimgs(int, int)
      makemudobject(str)
      message(str)
      move(float, float, float, int)
      noplayeronwall()
      onwall(float, float) - returns boolean
      onwall2(float, float, float, float) - returns boolean
      onwallpath(float, float, float, float, float, float) - returns boolean
      playeronwall()
      requesttext(str, str)
      scriptdone()
      sendtext(str, str, params...)
      setcharani(str, str)
      setchargender(str)
      setimg(str)
      setimgpart(str, int, int, int, int)
      setshape(int, int, int)
      setshape2(int, int, obj)
      show()
      showani(int, float, float, int, str) - returns object
      showani2(int, float, float, float, int, str) - returns object
      showcharacter()
      showimg(int, str, float, float) - returns object
      showimg2(int, str, float, float, float) - returns object
      showtext(int, float, float, str, str, str) - returns object
      showtext2(int, float, float, float, str, str, str) - returns object
      toweapons(str)
      warpto(str, float, float)

    TServerPlayer (TGaniObject):
      account - string (read only)
      ani - string
      aniparams - string
      ap - integer
      arrows - integer
      attached - boolean (read only)
      attachid - integer (read only)
      attachtype - integer (read only)
      body - string
      bodyimg - string
      bombs - integer
      canspin - boolean (read only)
      carriesblackstone - boolean (read only)
      carriesbush - boolean (read only)
      carriesnpc - boolean (read only)
      carriessign - boolean (read only)
      carriesstone - boolean (read only)
      carriesvase - boolean (read only)
      chat - string
      darts - integer
      deaths - integer
      dir - integer
      fullhearts - integer
      glovepower - integer
      graalversion - float (read only)
      gralats - integer
      guild - string
      head - string
      headimg - string
      headset - integer
      hearts - float
      horseimg - string
      hp - float
      id - integer (read only)
      isfemale - boolean
      ismale - boolean
      kills - integer
      language - string (read only)
      languagedomain - string (read only)
      lastdead - integer (read only)
      level - object (read only)
      logintime - integer (read only)
      maxhp - integer
      movementlimit - float
      mp - integer
      nick - string
      onlinetime - integer (read only)
      pause - boolean (read only)
      paused - boolean (read only)
      platform - string (read only)
      rating - float
      ratingd - float
      rupees - integer
      shield - string
      shieldimg - string
      shieldpower - integer
      sprite - integer
      sword - string
      swordimg - string
      swordpower - integer
      trial - boolean (read only)
      upgradestatus - string (read only)
      version - float (read only)
      weapons - object (read only)
      x - float
      y - float
      z - float
      addweapon(str)
      attachplayertoobj(int, int)
      callweapon(int, params...)
      detachplayer()
      disableweapons()
      enableweapons()
      findweapon(str) - returns object
      freezeplayer2()
      hasright(str, str) - returns boolean
      makescreenshot(str)
      removeweapon(str)
      say(int)
      say2(str)
      sendpm(str)
      sendrpgmessage(str)
      setani(str, str)
      setbeltcolor(str)
      setcoatcolor(str)
      setgender(str)
      sethead(str)
      setlevel2(str, float, float)
      setshield(str, int)
      setshoecolor(str)
      setskincolor(str)
      setsleevecolor(str)
      setsword(str, int)
      triggerclient(str)
      unfreezeplayer()

  THTTPRequest (TGraalVar):
    address - string (read only)
    contentlanguage - string (read only)
    contenttype - string (read only)
    downloadcomplete - boolean (read only)
    file - string (read only)
    fulldata - string (read only)
    lastmodified - string (read only)
    port - integer (read only)
    returncode - integer (read only)
    returnmessage - string (read only)
    server - string (read only)

  TKingdom (TGraalVar):
    title - string

  TKingdomMember (TGraalVar):
    kingdom - object (read only)
    kingdomjointime - integer (read only)
    rank - object (read only)
    rankjointime - integer (read only)

  TKingdomRank (TGraalVar):
    kingdom - object (read only)
    parent - object (read only)
    rights - string
    title - string

  TMudArch (TGraalVar):
    fullname - string (read only)

  TMudObject (TGraalVar):
    alive - boolean
    applied - boolean
    arch - object (read only)
    archname - string (read only)
    cursed - boolean
    damned - boolean
    datablock - string (read only)
    icon - string (read only)
    identified - boolean
    iscontrolledbynpc - boolean (read only)
    isdungeonmaster - boolean (read only)
    ismudobject - boolean (read only)
    mudcarrying - integer (read only)
    mudexp - integer
    mudfood - integer
    mudfullname - string (read only)
    mudgraalparam - string
    mudgraaltype - integer
    mudhp - integer
    mudid - integer (read only)
    mudlevel - integer
    mudmarketprize - integer
    mudmaxhp - integer
    mudmaxsp - integer
    mudmoney - integer (read only)
    mudname - string (read only)
    mudowner - object
    mudquantity - integer (read only)
    mudrandomvar - integer
    mudrealname - string
    mudslaying - string
    mudsp - integer
    mudspeed - float (read only)
    mudtype - integer (read only)
    mudweight - integer (read only)
    nodamage - boolean
    nopick - boolean
    npcparam - string
    npctype - integer
    petmove - boolean
    restrictaccess - string
    scared - boolean
    unpaid - boolean
    value - string (read only)
    apply()
    attackblind(obj, int) - blinds the object, specify the hitter and the hit damage
    attackconfuse()
    attackparalyze(int) - paralyzes the object, specifiy the hit damage
    attackpoison(obj, int) - poisones the object, specify the hitter and hit damage
    attackslow()
    checkphysicallyinfect(obj) - infect this object by transfering diseases from the hitter
    countinvobject(str) - returns integer
    drainstat(int)
    examine()
    findinvobject(str) - returns object
    findinvobjectbyid(int) - returns object
    getattackmessageattacker(int, int, obj) - returns string - specify attacktype, damage and hitter
    getattackmessagevictim(int, int, obj) - returns string - specify attacktype, damage and hitter
    getkey(str) - returns object - finds keys matching the key string and returns the key object
    getkey2(str, str) - returns object - finds keys matching the key string and arch name and returns the key object
    getwieldedobject() - returns object
    haskey(str) - returns boolean - checks if the object has a key matching the specified key string
    haskey2(str, str) - returns boolean - checks if the object has a key matching a key string and arch name
    hasskill(str) - returns boolean
    haveskill(str) - returns boolean
    isonbattleground() - returns boolean
    iswieldobject() - returns boolean
    killobject(obj) - kills this object, specify the killer as parameter
    learnrecipe(str, str) - returns boolean - specify arch name and title (eventually 'NONE')
    mudpay(int)
    mudvalue(int) - returns integer
    skillattack(obj) - returns integer - lets another object attack this object and returns how much damage done

    TMudDoor (TMudObject):
      activatetraps(obj) - returns boolean - returns if an ongoing attack should be aborted

    TMudHouseDoor (TMudObject):
      keepopen() - returns boolean

    TMudPlayer (TMudObject):
      lastdeath - integer
      peaceful - boolean
      addinvobject(int, str) - returns object
      applyinvobject(int)
      examineinvobject(int)
      removeinvobject(int, str) - returns boolean
      removeinvobjectbyid(int, int) - returns boolean
      removeinvobjects(str)

  TProjectile (TGraalVar):
    angle - float (read only)
    fromplayer - object
    horiz - boolean (read only)
    params - string
    speed - float (read only)
    x - float (read only)
    y - float (read only)
    z - float (read only)
    zspeed - float (read only)
    destroy()

  TServerLevel (TGraalVar):
    board - object (read only)
    height - integer (read only)
    isnopkzone - boolean (read only)
    issparringzone - boolean (read only)
    width - integer (read only)
    dontswapoutlevel()
    getz(float, float) - returns float
    mudaddobject(float, float, str) - returns object
    mudaddspecialobject(float, float, int, str, str) - returns object
    mudaddspellbook(float, float, int, str, str) - returns object
    noplayerkilling()
    onwall(float, float) - returns boolean
    onwall2(float, float, float, float) - returns boolean
    onwallpath(float, float, float, float, float, float) - returns boolean
    onwater(float, float) - returns boolean
    onwater2(float, float, float, float) - returns boolean
    onwaterpath(float, float, float, float, float, float) - returns boolean
    putbomb(int, float, float)
    putexplosion(int, float, float)
    putexplosion2(int, int, float, float)
    putnpc2(float, float, str) - returns object
    shoot(float, float, float, float, float, float, str, str)
    tiletype(float, float) - returns integer
    updateboard(int, int, int, int)
    updateboard2(int, int, int, int)

  TServerSign (TGraalVar):
    text - string
    x - integer
    y - integer

  TStaticVar (TGraalVar):
    destroy()