[TFS 1.0 / 1.2] LUA Functions

Discussion in 'Programming & Scripting' started by cbrm, Aug 11, 2013.

  1. cbrm

    cbrm Just another mod Staff Member Global Moderator

    Joined:
    Jan 6, 2009
    Messages:
    6,509
    Likes Received:
    773
    Best Answers:
    0
    all tfs 1.0 lua functions sorted alphabetically, excluding metamethods
    Code (Text):
    1.  
    2. addDamageCondition(condition, rounds, time, value)
    3. addEvent(callback, delay, ...)
    4. addOutfitCondition(condition, lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet)
    5. broadcastMessage(message, type)
    6. canPlayerLearnInstantSpell(cid, name)
    7. canPlayerWearOutfit(cid, lookType, addons)
    8. cleanMap()
    9. createCombatArea( {area}, <optional> {extArea} )
    10. createCombatObject()
    11. createConditionObject(type)
    12. Creature.getClosestFreePosition(self, position, extended)
    13. debugPrint(text)
    14. doAddCondition(cid, condition)
    15. doAddContainerItem(uid, itemid, <optional> count/subtype)
    16. doAddContainerItemEx(uid, virtualId)
    17. doAddMapMark(cid, pos, type, description)
    18. doAreaCombatCondition(cid, pos, area, condition, effect)
    19. doAreaCombatDispel(cid, pos, area, type, effect)
    20. doAreaCombatHealth(cid, type, pos, area, min, max, effect)
    21. doAreaCombatMana(cid, pos, area, min, max, effect)
    22. doChallengeCreature(cid, target)
    23. doChangeSpeed(cid, delta)
    24. doChangeTypeItem(uid, newtype)
    25. doCombat(cid, combat, param)
    26. doConvinceCreature(cid, target)
    27. doCreateItem(itemid, type/count, pos)
    28. doCreateItemEx(itemid, <optional> count/subtype)
    29. doCreateNpc(name, pos)
    30. doCreateTeleport(itemid, topos, createpos)
    31. doCreatureAddHealth(cid, health)
    32. doCreatureChangeOutfit(cid, outfit)
    33. doCreatureSay(cid, text, type, ...)
    34. doCreatureSayWithRadius(cid, text, type, radiusx, radiusy, position)
    35. doCreatureSetLookDir(cid, direction)
    36. doDecayItem(uid)
    37. doForceSummonCreature(name, pos)
    38. doMonsterChangeTarget(cid)
    39. doMoveCreature(cid, direction)
    40. doPlayerAddBlessing(cid, blessing)
    41. doPlayerAddExp(cid, exp, useMult, ...)
    42. doPlayerAddItem(cid, itemid, <optional: default: 1> count, <optional: default: 1> canDropOnMap, <optional: default: 1>subtype)
    43. doPlayerAddItem(uid, itemid, <optional: default: 1> count/subtype)
    44. doPlayerAddItemEx(cid, uid, ...)
    45. doPlayerAddMana(cid, mana, ...)
    46. doPlayerAddManaSpent(cid, mana)
    47. doPlayerAddMoney(cid, money)
    48. doPlayerAddMount(cid, mountId)
    49. doPlayerAddOutfit(cid, lookType, addons)
    50. doPlayerAddPremiumDays(cid, days)
    51. doPlayerAddSkillTry(cid, skillid, n)
    52. doPlayerAddSoul(cid, soul)
    53. doPlayerFeed(cid, food)
    54. doPlayerJoinParty(cid, leaderId)
    55. doPlayerPopupFYI(cid, message)
    56. doPlayerRemOutfit(cid, lookType, addons)
    57. doPlayerRemoveItem(cid, itemid, count, <optional> subtype, <optional> ignoreEquipped)
    58. doPlayerRemoveMoney(cid, money)
    59. doPlayerRemoveMount(cid, mountId)
    60. doPlayerRemovePremiumDays(cid, days)
    61. doPlayerSendCancel(cid, text)
    62. doPlayerSendTextMessage(cid, type, text, ...)
    63. doPlayerSetBalance(cid, balance)
    64. doPlayerSetGuildLevel(cid, level)
    65. doPlayerSetGuildNick(cid, nick)
    66. doPlayerSetOfflineTrainingSkill(cid, skill)
    67. doPlayerSetSex(cid, sex)
    68. doPlayerSetTown(cid, town)
    69. doPlayerSetVocation(cid, vocation)
    70. doRelocate(pos, posTo)
    71. doRemoveCondition(cid, type[, subId])
    72. doRemoveCreature(cid)
    73. doRemoveItem(uid, ...)
    74. doSendDistanceShoot(fromPos, toPos, distanceEffect, ...)
    75. doSendMagicEffect(pos, magicEffect, ...)
    76. doSendTutorial(cid, tutorialId)
    77. doSetCreatureDropLoot(cid, doDrop)
    78. doSetCreatureLight(cid, lightLevel, lightColor, time)
    79. doSetCreatureOutfit(cid, outfit, time)
    80. doSetItemActionId(uid, actionId)
    81. doSetItemOutfit(cid, item, time)
    82. doSetItemSpecialDescription(uid, desc)
    83. doSetItemText(uid, text)
    84. doSetMonsterOutfit(cid, name, time)
    85. doSetMonsterTarget(cid, target)
    86. doShowTextDialog(cid, itemId, text)
    87. doSummonCreature(name, pos)
    88. doTargetCombatCondition(cid, target, condition, effect)
    89. doTargetCombatDispel(cid, target, type, effect)
    90. doTargetCombatHealth(cid, target, type, min, max, effect)
    91. doTargetCombatMana(cid, target, min, max, effect)
    92. doTeleportThing(uid, dest, pushMovement)
    93. doTileAddItemEx(pos, uid)
    94. doTransformItem(uid, newItemId, ...)
    95. Game.convertIpToString(ip)
    96. Game.getStorageValue(key)
    97. Game.setStorageValue(key, value)
    98. getAccountNumberByPlayerName(name)
    99. getBlessingsCost(level)
    100. getConfigInfo(info)
    101. getContainerCap(uid)
    102. getContainerCapById(itemId)
    103. getContainerItem(uid, slot)
    104. getContainerSize(uid)
    105. getCreatureBaseSpeed(cid)
    106. getCreatureCondition(cid, condition[, subId])
    107. getCreatureHealth(cid)
    108. getCreatureMaster(cid)
    109. getCreatureMaxHealth(cid)
    110. getCreatureName(cid)
    111. getCreatureOutfit(cid)
    112. getCreaturePosition(cid)
    113. getCreatureSpeed(cid)
    114. getCreatureSummons(cid)
    115. getCreatureTarget(cid)
    116. getDepotId(uid)
    117. getDistanceBetween(firstPosition, secondPosition)
    118. getFluidSourceType(itemId)
    119. getGlobalStorageValue(key)
    120. getGuildId(guildName)
    121. getHouseAccessList(id, listId)
    122. getHouseByPlayerGUID(playerGUID)
    123. getHouseEntry(houseId)
    124. getHouseName(houseId)
    125. getHouseOwner(houseId)
    126. getHouseRent(id)
    127. getHouseTilesSize(houseId)
    128. getHouseTown(houseId)
    129. getInstantSpellInfoByName(cid, name)
    130. getInstantSpellWords(name)
    131. getIPByPlayerName(name)
    132. getItemDescriptions(itemId)
    133. getItemIdByName(name)
    134. getItemName(itemId)
    135. getItemRWInfo(uid)
    136. getItemWeight(itemId, ...)
    137. getItemWeightByUID(uid, ...)
    138. getMonsterFriendList(cid)
    139. getMonsterTargetList(cid)
    140. getOnlinePlayers()
    141. getPartyMembers(cid)
    142. getPlayerAccess(cid)
    143. getPlayerAccountType(cid)
    144. getPlayerBalance(cid)
    145. getPlayerBlessing(cid, blessing)
    146. getPlayerByName(name)
    147. getPlayerDepotItems(cid, depotId)
    148. getPlayerFlagValue(cid, flag)
    149. getPlayerFood(cid)
    150. getPlayerFreeCap(cid)
    151. getPlayerGroupId(cid)
    152. getPlayerGUID(cid)
    153. getPlayerGUIDByName(name)
    154. getPlayerGuildId(cid)
    155. getPlayerGuildLevel(cid)
    156. getPlayerGuildName(cid)
    157. getPlayerGuildNick(cid)
    158. getPlayerGuildRank(cid)
    159. getPlayerInstantSpellCount(cid)
    160. getPlayerInstantSpellInfo(cid, index)
    161. getPlayerIp(cid)
    162. getPlayerItemById(cid, deepSearch, itemId, ...)
    163. getPlayerItemCount(cid, itemId, ...)
    164. getPlayerLastLoginSaved(cid)
    165. getPlayerLearnedInstantSpell(cid, name)
    166. getPlayerLevel(cid)
    167. getPlayerLight(cid)
    168. getPlayerLookDir(cid)
    169. getPlayerLossPercent(cid)
    170. getPlayerMagLevel(cid)
    171. getPlayerMana(cid)
    172. getPlayerMasterPos(cid)
    173. getPlayerMaxMana(cid)
    174. getPlayerMoney(cid)
    175. getPlayerMount(cid, mountId)
    176. getPlayerName(cid)
    177. getPlayerParty(cid)
    178. getPlayerPosition(cid)
    179. getPlayerPremiumDays(cid)
    180. getPlayersByAccountNumber(accountNumber)
    181. getPlayersByIPAddress(ip, mask)
    182. getPlayerSex(cid)
    183. getPlayerSkill(cid, skillId)
    184. getPlayerSkullType(cid)
    185. getPlayerSlotItem(cid, slot)
    186. getPlayerSoul(cid)
    187. getPlayerStorageValue(cid, key)
    188. getPlayerTown(cid)
    189. getPlayerVocation(cid)
    190. getPromotedVocation(vocationId)
    191. getPvpBlessingCost(level)
    192. getSpectators(centerPos, rangex, rangey, multifloor, onlyPlayers)
    193. getThing(uid)
    194. getThingfromPos(pos)
    195. getThingPos(uid)
    196. getTibianTime()
    197. getTileHouseInfo(pos)
    198. getTileInfo(position)
    199. getTileItemById(position, itemId, ...)
    200. getTileItemByType(position, itemType)
    201. getTilePzInfo(position)
    202. getTileThingByPos(position)
    203. getTileThingByTopOrder(position, topOrder)
    204. getTopCreature(position)
    205. getTownId(townName)
    206. getTownName(townId)
    207. getTownTemplePosition(townId)
    208. getWaypointPosition(name)
    209. getWorldCreatures(type)
    210. getWorldLight()
    211. getWorldTime()
    212. getWorldUpTime()
    213. hasProperty(uid, prop)
    214. isContainer(uid)
    215. isCorpse(uid)
    216. isCreature(cid)
    217. isDepot(uid)
    218. isDruid(cid)
    219. isInArray(array, value)
    220. isInRange(pos, fromPos, toPos)
    221. isInWar(cid, target)
    222. isItem(uid)
    223. isItemContainer(itemId)
    224. isItemDoor(itemId)
    225. isItemFluidContainer(itemId)
    226. isItemMovable(itemId)
    227. isItemRune(itemId)
    228. isItemStackable(itemId)
    229. isKnight(cid)
    230. isMonster(cid)
    231. isMovable(uid)
    232. isNpc(cid)
    233. isNumber(str)
    234. isPaladin(cid)
    235. isPlayer(cid)
    236. isPlayerGhost(cid)
    237. isPlayerPzLocked(cid)
    238. isPremium(cid)
    239. isSightClear(fromPos, toPos, floorCheck)
    240. isSorcerer(cid)
    241. isSummon(cid)
    242. isValidUID(uid)
    243. mayNotMove(cid, value)
    244. numberToVariant(number)
    245. Player.feed(self, food)
    246. Player.isUsingOtClient(self)
    247. Player.sendCancelMessage(self, message)
    248. Player.sendExtendedOpcode(self, opcode, buffer)
    249. playerLearnInstantSpell(cid, name)
    250. Position.getNextPosition(self, direction, steps)
    251. positionToVariant(pos)
    252. pushThing(thing)
    253. queryTileAddThing(thing, position, ...)
    254. registerClass(className, baseClass, newFunction)
    255. registerCreatureEvent(cid, name)
    256. registerEnum(value)
    257. registerEnumIn(tableName, value)
    258. registerGlobalMethod(functionName, function)
    259. registerGlobalVariable(name, value)
    260. registerMetaMethod(className, functionName, function)
    261. registerMethod(className, functionName, function)
    262. registerTable(tableName)
    263. registerVariable(tableName, name, value)
    264. saveServer()
    265. sendChannelMessage(channelId, type, message)
    266. sendGuildChannelMessage(guildId, type, message)
    267. setCombatArea(combat, area)
    268. setCombatCallBack(combat, key, function_name)
    269. setCombatCondition(combat, condition)
    270. setCombatFormula(combat, type, mina, minb, maxa, maxb)
    271. setCombatParam(combat, key, value)
    272. setConditionFormula(combat, mina, minb, maxa, maxb)
    273. setConditionParam(condition, key, value)
    274. setGlobalStorageValue(key, value)
    275. setHouseAccessList(id, listId, listText)
    276. setHouseOwner(id, guid)
    277. setPlayerGroupId(cid, groupId)
    278. setPlayerStorageValue(cid, key, value)
    279. stopEvent(eventid)
    280. string.split(str, sep)
    281. stringToVariant(string)
    282. targetPositionToVariant(pos)
    283. unregisterCreatureEvent(cid, name)
    284. variantToNumber(var)
    285. variantToPosition(var)
    286. variantToString(var)
    287.  
    tfs 1.0 metamethod lua functions (updated 13th July)
    http://pastebin.com/nws8xHmK

    tfs 1.0 source-made lua functions

    http://pastebin.com/s5b4yVa7

    tfs 1.0 lua-made lua functions
    http://pastebin.com/bgpNHax2

    tfs 1.2 metamethod lua functions
    http://pastebin.com/wrnD8jHH

    .::::. Functions last updated on January 17th .::::.
     
    Last edited by a moderator: Jul 13, 2014
    Beto06, duduprec, Shackal and 16 others like this.
  2. Nightss

    Nightss Normal People

    Joined:
    May 18, 2013
    Messages:
    56
    Likes Received:
    12
    Best Answers:
    0
    :O nice men,
    who really wants to work should read this
     
    azzkaban likes this.
  3. Amiroslo

    Amiroslo Well-Known Member

    Joined:
    Jul 28, 2009
    Messages:
    6,400
    Likes Received:
    407
    Best Answers:
    0
    Can I have the lua functions list of tfs 1.0
     
    azzkaban likes this.
  4. Cornex

    Cornex Web Developer Staff Member Global Moderator Premium User

    Joined:
    Jun 15, 2008
    Messages:
    3,422
    Likes Received:
    1,102
    Best Answers:
    4
    Yeey
     
    azzkaban likes this.
  5. zbizu

    zbizu ‌‌Luakami

    Joined:
    Nov 22, 2010
    Messages:
    2,437
    Likes Received:
    1,328
    Best Answers:
    0
  6. trollebror

    trollebror Developer

    Joined:
    Aug 8, 2009
    Messages:
    359
    Likes Received:
    55
    Best Answers:
    0
    Awesome.
     
    azzkaban likes this.
  7. WibbenZ

    WibbenZ Support Team Support Team

    Joined:
    Oct 16, 2008
    Messages:
    4,354
    Likes Received:
    625
    Best Answers:
    18
    Nice to have it, only one thing! Please dont make the text smaller! Some of us are used to the "normal" text size haha
    Tho I think, since shadowcores is online there wont be alot of 10+ rl maps. They insted prefer 8.60 due to players rather play that. Its not easy to try and take out shadowcores and the other server. But I guess someone will use this. Im gonna stick with 0.4 3777 & 3884! :)
    WibbenZ
     
  8. putamerda

    putamerda Member

    Joined:
    Jan 2, 2012
    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    I need server save globalevent, i really need i have a full server
     
  9. Ninja

    Ninja 「Speedwagon Foundation」 Staff Member Global Moderator

    Joined:
    Apr 6, 2010
    Messages:
    5,874
    Likes Received:
    1,475
    Best Answers:
    12
    putamerda likes this.
  10. putamerda

    putamerda Member

    Joined:
    Jan 2, 2012
    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
  11. putamerda

    putamerda Member

    Joined:
    Jan 2, 2012
    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    You know, i need an clean map for TFS 1.0.0
     
  12. Szaki

    Szaki New Member

    Joined:
    Aug 24, 2010
    Messages:
    7
    Likes Received:
    1
    Best Answers:
    0
    Anyone know how getOnlinePlayers() works? It gives only number of players online or some tables? I can't find it in source. ;s
     
  13. zbizu

    zbizu ‌‌Luakami

    Joined:
    Nov 22, 2010
    Messages:
    2,437
    Likes Received:
    1,328
    Best Answers:
    0
    @Szaki
    compat.lua:
    Code (Text):
    1.  
    2. function getOnlinePlayers()
    3.  local result = {}
    4.  for _, player in ipairs(Game.getPlayers()) do
    5.  result[#result + 1] = player:getName()
    6.  end
    7.  return result
    8. end
    luascript.cpp:
    Code (Text):
    1. int32_t LuaScriptInterface::luaGameGetPlayers(lua_State* L)
    2. {
    3.  // Game.getPlayers()
    4.  lua_Number index = 0;
    5.  lua_createtable(L, g_game.getPlayersOnline(), 0);
    6.  for (const auto& playerEntry : g_game.getPlayers()) {
    7.  pushNumber(L, ++index);
    8.  pushUserdata<Player>(L, playerEntry.second);
    9.  setMetatable(L, -1, "Player");
    10.  lua_rawset(L, -3);
    11.  }
    12.  return 1;
    13. }
    try printing function results to figure out what it does
     
    Codinablack and Szaki like this.
  14. medanny77

    medanny77 Member

    Joined:
    Dec 25, 2013
    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    I need to get getAccountByName(name);??? is it the same as?
    getAccountNumberByPlayerName(name)?
     
  15. Tazer

    Tazer Member

    Joined:
    Oct 25, 2009
    Messages:
    182
    Likes Received:
    1
    Best Answers:
    0
    TFS 1.0 flags should be awsome to get aswell. Thanks.

    Need flag to do CTRL + Z ingame for players.
     
  16. putamerda

    putamerda Member

    Joined:
    Jan 2, 2012
    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    War System for TFS 1.0.0 Tibia 10.30-31? It can be only the talk
    action
     
  17. putamerda

    putamerda Member

    Joined:
    Jan 2, 2012
    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    It exists similar functions like
    doGuildAddEnemy(guild, enemy, war, type)
    doGuildRemoveEnemy(guild, enemy)

    in TFS 1.0?
     
  18. Ninja

    Ninja 「Speedwagon Foundation」 Staff Member Global Moderator

    Joined:
    Apr 6, 2010
    Messages:
    5,874
    Likes Received:
    1,475
    Best Answers:
    12
    nope, why do you need those?
     
  19. putamerda

    putamerda Member

    Joined:
    Jan 2, 2012
    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Im trying to build an War System :(
     
  20. Ninja

    Ninja 「Speedwagon Foundation」 Staff Member Global Moderator

    Joined:
    Apr 6, 2010
    Messages:
    5,874
    Likes Received:
    1,475
    Best Answers:
    12
    You don't need those for war system :p
     

Share This Page

Loading...