[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,496
    all tfs 1.0 lua functions sorted alphabetically, excluding metamethods
    Code:
    addDamageCondition(condition, rounds, time, value)
    addEvent(callback, delay, ...)
    addOutfitCondition(condition, lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet)
    broadcastMessage(message, type)
    canPlayerLearnInstantSpell(cid, name)
    canPlayerWearOutfit(cid, lookType, addons)
    cleanMap()
    createCombatArea( {area}, <optional> {extArea} )
    createCombatObject()
    createConditionObject(type)
    Creature.getClosestFreePosition(self, position, extended)
    debugPrint(text)
    doAddCondition(cid, condition)
    doAddContainerItem(uid, itemid, <optional> count/subtype)
    doAddContainerItemEx(uid, virtualId)
    doAddMapMark(cid, pos, type, description)
    doAreaCombatCondition(cid, pos, area, condition, effect)
    doAreaCombatDispel(cid, pos, area, type, effect)
    doAreaCombatHealth(cid, type, pos, area, min, max, effect)
    doAreaCombatMana(cid, pos, area, min, max, effect)
    doChallengeCreature(cid, target)
    doChangeSpeed(cid, delta)
    doChangeTypeItem(uid, newtype)
    doCombat(cid, combat, param)
    doConvinceCreature(cid, target)
    doCreateItem(itemid, type/count, pos)
    doCreateItemEx(itemid, <optional> count/subtype)
    doCreateNpc(name, pos)
    doCreateTeleport(itemid, topos, createpos)
    doCreatureAddHealth(cid, health)
    doCreatureChangeOutfit(cid, outfit)
    doCreatureSay(cid, text, type, ...)
    doCreatureSayWithRadius(cid, text, type, radiusx, radiusy, position)
    doCreatureSetLookDir(cid, direction)
    doDecayItem(uid)
    doForceSummonCreature(name, pos)
    doMonsterChangeTarget(cid)
    doMoveCreature(cid, direction)
    doPlayerAddBlessing(cid, blessing)
    doPlayerAddExp(cid, exp, useMult, ...)
    doPlayerAddItem(cid, itemid, <optional: default: 1> count, <optional: default: 1> canDropOnMap, <optional: default: 1>subtype)
    doPlayerAddItem(uid, itemid, <optional: default: 1> count/subtype)
    doPlayerAddItemEx(cid, uid, ...)
    doPlayerAddMana(cid, mana, ...)
    doPlayerAddManaSpent(cid, mana)
    doPlayerAddMoney(cid, money)
    doPlayerAddMount(cid, mountId)
    doPlayerAddOutfit(cid, lookType, addons)
    doPlayerAddPremiumDays(cid, days)
    doPlayerAddSkillTry(cid, skillid, n)
    doPlayerAddSoul(cid, soul)
    doPlayerFeed(cid, food)
    doPlayerJoinParty(cid, leaderId)
    doPlayerPopupFYI(cid, message)
    doPlayerRemOutfit(cid, lookType, addons)
    doPlayerRemoveItem(cid, itemid, count, <optional> subtype, <optional> ignoreEquipped)
    doPlayerRemoveMoney(cid, money)
    doPlayerRemoveMount(cid, mountId)
    doPlayerRemovePremiumDays(cid, days)
    doPlayerSendCancel(cid, text)
    doPlayerSendTextMessage(cid, type, text, ...)
    doPlayerSetBalance(cid, balance)
    doPlayerSetGuildLevel(cid, level)
    doPlayerSetGuildNick(cid, nick)
    doPlayerSetOfflineTrainingSkill(cid, skill)
    doPlayerSetSex(cid, sex)
    doPlayerSetTown(cid, town)
    doPlayerSetVocation(cid, vocation)
    doRelocate(pos, posTo)
    doRemoveCondition(cid, type[, subId])
    doRemoveCreature(cid)
    doRemoveItem(uid, ...)
    doSendDistanceShoot(fromPos, toPos, distanceEffect, ...)
    doSendMagicEffect(pos, magicEffect, ...)
    doSendTutorial(cid, tutorialId)
    doSetCreatureDropLoot(cid, doDrop)
    doSetCreatureLight(cid, lightLevel, lightColor, time)
    doSetCreatureOutfit(cid, outfit, time)
    doSetItemActionId(uid, actionId)
    doSetItemOutfit(cid, item, time)
    doSetItemSpecialDescription(uid, desc)
    doSetItemText(uid, text)
    doSetMonsterOutfit(cid, name, time)
    doSetMonsterTarget(cid, target)
    doShowTextDialog(cid, itemId, text)
    doSummonCreature(name, pos)
    doTargetCombatCondition(cid, target, condition, effect)
    doTargetCombatDispel(cid, target, type, effect)
    doTargetCombatHealth(cid, target, type, min, max, effect)
    doTargetCombatMana(cid, target, min, max, effect)
    doTeleportThing(uid, dest, pushMovement)
    doTileAddItemEx(pos, uid)
    doTransformItem(uid, newItemId, ...)
    Game.convertIpToString(ip)
    Game.getStorageValue(key)
    Game.setStorageValue(key, value)
    getAccountNumberByPlayerName(name)
    getBlessingsCost(level)
    getConfigInfo(info)
    getContainerCap(uid)
    getContainerCapById(itemId)
    getContainerItem(uid, slot)
    getContainerSize(uid)
    getCreatureBaseSpeed(cid)
    getCreatureCondition(cid, condition[, subId])
    getCreatureHealth(cid)
    getCreatureMaster(cid)
    getCreatureMaxHealth(cid)
    getCreatureName(cid)
    getCreatureOutfit(cid)
    getCreaturePosition(cid)
    getCreatureSpeed(cid)
    getCreatureSummons(cid)
    getCreatureTarget(cid)
    getDepotId(uid)
    getDistanceBetween(firstPosition, secondPosition)
    getFluidSourceType(itemId)
    getGlobalStorageValue(key)
    getGuildId(guildName)
    getHouseAccessList(id, listId)
    getHouseByPlayerGUID(playerGUID)
    getHouseEntry(houseId)
    getHouseName(houseId)
    getHouseOwner(houseId)
    getHouseRent(id)
    getHouseTilesSize(houseId)
    getHouseTown(houseId)
    getInstantSpellInfoByName(cid, name)
    getInstantSpellWords(name)
    getIPByPlayerName(name)
    getItemDescriptions(itemId)
    getItemIdByName(name)
    getItemName(itemId)
    getItemRWInfo(uid)
    getItemWeight(itemId, ...)
    getItemWeightByUID(uid, ...)
    getMonsterFriendList(cid)
    getMonsterTargetList(cid)
    getOnlinePlayers()
    getPartyMembers(cid)
    getPlayerAccess(cid)
    getPlayerAccountType(cid)
    getPlayerBalance(cid)
    getPlayerBlessing(cid, blessing)
    getPlayerByName(name)
    getPlayerDepotItems(cid, depotId)
    getPlayerFlagValue(cid, flag)
    getPlayerFood(cid)
    getPlayerFreeCap(cid)
    getPlayerGroupId(cid)
    getPlayerGUID(cid)
    getPlayerGUIDByName(name)
    getPlayerGuildId(cid)
    getPlayerGuildLevel(cid)
    getPlayerGuildName(cid)
    getPlayerGuildNick(cid)
    getPlayerGuildRank(cid)
    getPlayerInstantSpellCount(cid)
    getPlayerInstantSpellInfo(cid, index)
    getPlayerIp(cid)
    getPlayerItemById(cid, deepSearch, itemId, ...)
    getPlayerItemCount(cid, itemId, ...)
    getPlayerLastLoginSaved(cid)
    getPlayerLearnedInstantSpell(cid, name)
    getPlayerLevel(cid)
    getPlayerLight(cid)
    getPlayerLookDir(cid)
    getPlayerLossPercent(cid)
    getPlayerMagLevel(cid)
    getPlayerMana(cid)
    getPlayerMasterPos(cid)
    getPlayerMaxMana(cid)
    getPlayerMoney(cid)
    getPlayerMount(cid, mountId)
    getPlayerName(cid)
    getPlayerParty(cid)
    getPlayerPosition(cid)
    getPlayerPremiumDays(cid)
    getPlayersByAccountNumber(accountNumber)
    getPlayersByIPAddress(ip, mask)
    getPlayerSex(cid)
    getPlayerSkill(cid, skillId)
    getPlayerSkullType(cid)
    getPlayerSlotItem(cid, slot)
    getPlayerSoul(cid)
    getPlayerStorageValue(cid, key)
    getPlayerTown(cid)
    getPlayerVocation(cid)
    getPromotedVocation(vocationId)
    getPvpBlessingCost(level)
    getSpectators(centerPos, rangex, rangey, multifloor, onlyPlayers)
    getThing(uid)
    getThingfromPos(pos)
    getThingPos(uid)
    getTibianTime()
    getTileHouseInfo(pos)
    getTileInfo(position)
    getTileItemById(position, itemId, ...)
    getTileItemByType(position, itemType)
    getTilePzInfo(position)
    getTileThingByPos(position)
    getTileThingByTopOrder(position, topOrder)
    getTopCreature(position)
    getTownId(townName)
    getTownName(townId)
    getTownTemplePosition(townId)
    getWaypointPosition(name)
    getWorldCreatures(type)
    getWorldLight()
    getWorldTime()
    getWorldUpTime()
    hasProperty(uid, prop)
    isContainer(uid)
    isCorpse(uid)
    isCreature(cid)
    isDepot(uid)
    isDruid(cid)
    isInArray(array, value)
    isInRange(pos, fromPos, toPos)
    isInWar(cid, target)
    isItem(uid)
    isItemContainer(itemId)
    isItemDoor(itemId)
    isItemFluidContainer(itemId)
    isItemMovable(itemId)
    isItemRune(itemId)
    isItemStackable(itemId)
    isKnight(cid)
    isMonster(cid)
    isMovable(uid)
    isNpc(cid)
    isNumber(str)
    isPaladin(cid)
    isPlayer(cid)
    isPlayerGhost(cid)
    isPlayerPzLocked(cid)
    isPremium(cid)
    isSightClear(fromPos, toPos, floorCheck)
    isSorcerer(cid)
    isSummon(cid)
    isValidUID(uid)
    mayNotMove(cid, value)
    numberToVariant(number)
    Player.feed(self, food)
    Player.isUsingOtClient(self)
    Player.sendCancelMessage(self, message)
    Player.sendExtendedOpcode(self, opcode, buffer)
    playerLearnInstantSpell(cid, name)
    Position.getNextPosition(self, direction, steps)
    positionToVariant(pos)
    pushThing(thing)
    queryTileAddThing(thing, position, ...)
    registerClass(className, baseClass, newFunction)
    registerCreatureEvent(cid, name)
    registerEnum(value)
    registerEnumIn(tableName, value)
    registerGlobalMethod(functionName, function)
    registerGlobalVariable(name, value)
    registerMetaMethod(className, functionName, function)
    registerMethod(className, functionName, function)
    registerTable(tableName)
    registerVariable(tableName, name, value)
    saveServer()
    sendChannelMessage(channelId, type, message)
    sendGuildChannelMessage(guildId, type, message)
    setCombatArea(combat, area)
    setCombatCallBack(combat, key, function_name)
    setCombatCondition(combat, condition)
    setCombatFormula(combat, type, mina, minb, maxa, maxb)
    setCombatParam(combat, key, value)
    setConditionFormula(combat, mina, minb, maxa, maxb)
    setConditionParam(condition, key, value)
    setGlobalStorageValue(key, value)
    setHouseAccessList(id, listId, listText)
    setHouseOwner(id, guid)
    setPlayerGroupId(cid, groupId)
    setPlayerStorageValue(cid, key, value)
    stopEvent(eventid)
    string.split(str, sep)
    stringToVariant(string)
    targetPositionToVariant(pos)
    unregisterCreatureEvent(cid, name)
    variantToNumber(var)
    variantToPosition(var)
    variantToString(var)
    
    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
    :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,376
    Can I have the lua functions list of tfs 1.0
     
    azzkaban likes this.
  4. Cornex

    Cornex Web Developer Staff Member Global Moderator

    Joined:
    Jun 15, 2008
    Messages:
    3,407
    Yeey
     
    azzkaban likes this.
  5. zbizu

    zbizu ‌‌Luakami

    Joined:
    Nov 22, 2010
    Messages:
    2,425
    I like challenges and I'm currently working on 1.0 scripts for my datapack so I can contribute.
    I'm working on partial compability with 0.3.7 also, here is what I've added to global.lua: [Lua] global.lua diff - Pastebin.com
    Just tell me what you need and I can probably write/rewrite it (contact me via pm/visitor message on otland).

    @Amiroslo
    basically this: Subversion
    because it's based on 0.2, you may compare it with 1.0 sources to find certain functions
     
    Last edited: Aug 11, 2013
  6. trollebror

    trollebror Developer

    Joined:
    Aug 8, 2009
    Messages:
    358
    Awesome.
     
    azzkaban likes this.
  7. WibbenZ

    WibbenZ Well-Known Member

    Joined:
    Oct 16, 2008
    Messages:
    4,208
    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
    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,853
    putamerda likes this.
  10. putamerda

    putamerda Member

    Joined:
    Jan 2, 2012
    Messages:
    73
  11. putamerda

    putamerda Member

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

    Szaki New Member

    Joined:
    Aug 24, 2010
    Messages:
    7
    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,425
    @Szaki
    compat.lua:
    Code:
    function getOnlinePlayers()
     local result = {}
     for _, player in ipairs(Game.getPlayers()) do
     result[#result + 1] = player:getName()
     end
     return result
    end
    luascript.cpp:
    Code:
    int32_t LuaScriptInterface::luaGameGetPlayers(lua_State* L)
    {
     // Game.getPlayers()
     lua_Number index = 0;
     lua_createtable(L, g_game.getPlayersOnline(), 0);
     for (const auto& playerEntry : g_game.getPlayers()) {
     pushNumber(L, ++index);
     pushUserdata<Player>(L, playerEntry.second);
     setMetatable(L, -1, "Player");
     lua_rawset(L, -3);
     }
     return 1;
    }
    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
    I need to get getAccountByName(name);??? is it the same as?
    getAccountNumberByPlayerName(name)?
     
  15. Tazer

    Tazer Member

    Joined:
    Oct 25, 2009
    Messages:
    182
    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
    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
    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,853
    nope, why do you need those?
     
  19. putamerda

    putamerda Member

    Joined:
    Jan 2, 2012
    Messages:
    73
    Im trying to build an War System :(
     
  20. Ninja

    Ninja 「Speedwagon Foundation」 Staff Member Global Moderator

    Joined:
    Apr 6, 2010
    Messages:
    5,853
    You don't need those for war system :p
     

Share This Page