• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Attempt to Index a Nil Value

MikeOT

Well-Known Member
Joined
Jan 22, 2017
Messages
232
Solutions
2
Reaction score
86
Ok guys, I've been going over this for 2 days trying to figure out why I'm getting this error. I've read through I don't know how many threads trying to find an answer to this, to no avail. I have no idea what I'm doing wrong. Maybe its something difficult to achieve, or maybe I'm retarded. I'm still learning lua, and at this point I feel that I'm in over my head, haha. I've read so much, and messed with so much that I may be way out there. If anyone would be so kind as to point me in the right direction, I'd be forever grateful :)

I'll try to explain it as best I can.

Using Tfs 1.2

Anyway, I've been trying to get a rudimentary system to work for alternate skills such as picking herbs or cutting wood. I've managed to create a script that works to perform the action(i.e. i can use an item on the node and receive something), but the problem I'm running into is with trying to access the experience table to try and manage levels.

I created this file named "experience" and placed it in data/lib

Code:
rateskill = 1



configs = {
experience ={{skilllevel = 1, quant = 83},
            {skilllevel = 2, quant = 174},
            {skilllevel = 3, quant = 276},
            {skilllevel = 4, quant = 388},
            {skilllevel = 5, quant = 512},
            {skilllevel = 6, quant = 650},
            {skilllevel = 7, quant = 801},
            {skilllevel = 8, quant = 969},
            {skilllevel = 9, quant = 1154},
            {skilllevel = 10, quant = 1358}},

}

The idea is to have a generic experience table that I could access from other scripts to create a series of gathering skills with levels.


I then put this at the top of my data/global.lua. I am under the impression that that will make it available for me to use from anywhere?

Code:
dofile('data/lib/experience.lua')

Then I registered my soon to be script under actions.xml

So now that that is in place, I created my script.

It all works well until I try and access that "experience.lua" file and retrieve the info from it.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local player = Player(cid)
local targetItem = Item(itemEx.uid)
local STORAGE_SKILL_LEVEL = 20020
local STORAGE_SKILL_TRY = 20021
local skillLevel = getPlayerStorageValue(cid,STORAGE_SKILL_LEVEL)
local skillTry = getPlayerStorageValue(cid,STORAGE_SKILL_TRY)
local exhaust = Condition(CONDITION_EXHAUST_WEAPON)
exhaust:setParameter(CONDITION_PARAM_TICKS, (2000))

    for Q = skillLevel, #configs.experience do
    quant = configs.experience[Q].quant        < --- This line throws the error
    break
    end

Everything that follows works great. If I comment out the for loop and corresponding code, i get no errors in the script, so it seems I'm doing something wrong in trying to get the information from the experience table. I'm getting this in the console

Nto9n

Edit: Image won't load? The error in the console is: attempt to index a nil value stack traceback : [C] in function '__index'

So if I'm right (and I may be way off), this means that either I am trying to access that info the wrong way, or I've created the experience table the wrong way.

What is the proper procedure for this?

Is this a dumb way to go about setting up an experience table for a new skill?

I'm so confused :p


Thank you for your time.
 
Last edited:
Solution
Alright bud, I had some time so here. I noticed you are mixing TFS 1.x and 0.3.6/0.4 codes together. Try to get out of that habbit, not that there is anything wrong with it, I just think its looks bad.

Lua:
configs = {
    experience ={
        {83},
        {174},
        {276},
        {388},
        {512},
        {650},
        {801},
        {969},
        {1154},
        {1358}
        }
}


Action script
Lua:
--Locals that can be set before the action is done should be outside the function itself. This way the code doesnt have to redefine them everytime it runs--
local exhaust = Condition(CONDITION_EXHAUST_WEAPON)
exhaust:setParameter(CONDITION_PARAM_TICKS, (2000))
local logsIds = {26386}
local STORAGE_SKILL_LEVEL = 20020...
configs.experience[Q] is likely returning nil because skillLevel might be -1, since that's the default storage value
how did you set up the table?
 
Hmm... I'm not sure exactly what to do with that. :D

What I've done so far: Created "experience.lua" (as shown in above post), and put it in the data/lib folder > put "dofile('data/lib/experience.lua')" at the top of my global.lua > registered my script in actions.xml > created script



Here is the full script(for whom it may concern, it works well for everything except the pesky exp part :p):

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local logsIds = {26386}
local player = Player(cid)
local targetItem = Item(itemEx.uid)
local STORAGE_SKILL_LEVEL = 20020
local STORAGE_SKILL_TRY = 20021
local skillLevel = getPlayerStorageValue(cid,STORAGE_SKILL_LEVEL)
local skillTry = getPlayerStorageValue(cid,STORAGE_SKILL_TRY)
local exhaust = Condition(CONDITION_EXHAUST_WEAPON)
exhaust:setParameter(CONDITION_PARAM_TICKS, (2000))

    for Q = skillLevel, #configs.experience do    
    quant = configs.experience[Q].quant          < ---- This is the line that is throwing the nil 
    break   
    end

    if player:getCondition(CONDITION_EXHAUST_WEAPON) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end   
   
   
    if isInArray(logsIds, itemEx.itemid) then
        player:addCondition(exhaust)
        doPlayerAddItem(cid,26385,1)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,"You cut some logs.")
        toPosition:sendMagicEffect(CONST_ME_BLOCKHIT)
        Item(itemEx.uid):remove(1)
        if itemEx.itemid == 26386 then
        Game.createItem(26384, 1, toPosition):decay()
        end
        player:say("+25 Woodcutting Exp", TALKTYPE_MONSTER_SAY)
        player:sendTextMessage(MESSAGE_EXPERIENCE,"You received 25 Woodcutting exp by cutting Logs.")
   
    if skillLevel >= 1 and skillLevel <= 10 and skillTry >= (quant-25) then   
        setPlayerStorageValue(cid,STORAGE_SKILL_TRY,skillTry + 25)   
        setPlayerStorageValue(cid,STORAGE_SKILL_LEVEL,skillLevel + 1)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have advanced from Woodcutting Level ".. skillLevel .." to Woodcutting Level ".. skillLevel + 1 .."")
        player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    else
       setPlayerStorageValue(cid,STORAGE_SKILL_TRY,skillTry + 25)   
    return true   
    end
   
   
end   
end
 
Lua:
configs = {
experience ={
            {skilllevel = 1, quant = 83},
            {skilllevel = 2, quant = 174},
            {skilllevel = 3, quant = 276},
            {skilllevel = 4, quant = 388},
            {skilllevel = 5, quant = 512},
            {skilllevel = 6, quant = 650},
            {skilllevel = 7, quant = 801},
            {skilllevel = 8, quant = 969},
            {skilllevel = 9, quant = 1154},
            {skilllevel = 10, quant = 1358}},

}

You don't need to loop through the table because you are already defining the table position with the players storage value.

So you could do:

Lua:
quant = config.experience[skillLevel].quant

No need for a loop.

What static was saying is: if you haven't set the storage value 20020 for all players to 1 with an onLogin code or something similar then the code is going to read that storage as -1 or nil value.

Meaning you are trying to do this:

quant = config.experience[nil].quant

or

quant = config.experience[-1].quant

which is giving you an error because there is no value for that in the table as it starts at 1.
 
Ok I understand what you're saying, thank you all for your help.

I'm having some trouble trying to set that up.

When i replace
Code:
for Q = skillLevel, #configs.experience do   
    quant = configs.experience[Q].quant          < ---- This is the line that is throwing the nil
    break 
    end

with

Code:
quant = config.experience[skillLevel].quant


It is still giving me a nil ?
 
Ok I understand what you're saying, thank you all for your help.

I'm having some trouble trying to set that up.

When i replace
Code:
for Q = skillLevel, #configs.experience do
    quant = configs.experience[Q].quant          < ---- This is the line that is throwing the nil
    break
    end

with

Code:
quant = config.experience[skillLevel].quant


It is still giving me a nil ?
Instead of this
Lua:
rateskill = 1
configs = {
   experience = {
       {skilllevel = 1, quant = 83},
       {skilllevel = 2, quant = 174},
       {skilllevel = 3, quant = 276},
       {skilllevel = 4, quant = 388},
       {skilllevel = 5, quant = 512},
       {skilllevel = 6, quant = 650},
       {skilllevel = 7, quant = 801},
       {skilllevel = 8, quant = 969},
       {skilllevel = 9, quant = 1154},
       {skilllevel = 10, quant = 1358}
   } 
}
Since you know that skill level goes 1,2,3,4,5,6 anyways.. just reduce the table to this
Lua:
rateskill = 1
configs = {
   experience = {
       {quant = 83},
       {quant = 174},
       {quant = 276},
       {quant = 388},
       {quant = 512},
       {quant = 650},
       {quant = 801},
       {quant = 969},
       {quant = 1154},
       {quant = 1358}
   }
}
and use this for that line
Lua:
configs.experience[skillLevel].quant

Also, again, make sure that the players storage value is at least 1, before executing this script.. otherwise their storage value will be -1 to start

Lua:
configs.experience[1].quant -- is in the table
configs.experience[-1].quant -- is NOT in the table


---
you can actually reduce the table even further, and use this
Lua:
rateskill = 1
configs = {
   experience = {
       {83},
       {174},
       {276},
       {388},
       {512},
       {650},
       {801},
       {969},
       {1154},
       {1358}
   }  
}
Lua:
configs.experience[skillLevel][1]
 
Alright bud, I had some time so here. I noticed you are mixing TFS 1.x and 0.3.6/0.4 codes together. Try to get out of that habbit, not that there is anything wrong with it, I just think its looks bad.

Lua:
configs = {
    experience ={
        {83},
        {174},
        {276},
        {388},
        {512},
        {650},
        {801},
        {969},
        {1154},
        {1358}
        }
}


Action script
Lua:
--Locals that can be set before the action is done should be outside the function itself. This way the code doesnt have to redefine them everytime it runs--
local exhaust = Condition(CONDITION_EXHAUST_WEAPON)
exhaust:setParameter(CONDITION_PARAM_TICKS, (2000))
local logsIds = {26386}
local STORAGE_SKILL_LEVEL = 20020
local STORAGE_SKILL_TRY = 20021
function onUse(cid, item, fromPosition, itemEx, toPosition)
    --These locals require the script to be ran so they are here.--
    local player = Player(cid)
    local target = Item(itemEx.uid)
 
    --Its always good to make sure locals we set are read--
    if not target then return false end

    --Check if the itemid is in the logIds table first so the script wont read much before stopping here (optimization)--
    if not isInArray(logsIds, itemEx.itemid) then return false end
 
    --Check exhaust right away so the code doesn't read much if the player is exhausted (optimization)--
    if player:getCondition(CONDITION_EXHAUST_WEAPON) then
       return player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
    end
    --This will make sure the players storage value is correct so we can read it in the experience table--
    if player:getStorageValue(STORAGE_SKILL_LEVEL) == nil then
        player:setStorageValue(STORAGE_SKILL_LEVEL, 1)
        player:setStorageValue(STORAGE_SKILL_TRY, 0)
    end
 
    local skillLevel = player:getStorageValue(STORAGE_SKILL_LEVEL)
    local skillTry = player:getStorageValue(STORAGE_SKILL_TRY)
    local quant = configs.experience[skillLevel][1]
 
    if not quant then return false end
 
    player:addCondition(exhaust)
    player:addItem(26385,1)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,"You cut some logs.")
    toPosition:sendMagicEffect(CONST_ME_BLOCKHIT)
    target:remove(1)
    player:say("+25 Woodcutting Exp", TALKTYPE_MONSTER_SAY)
    player:sendTextMessage(MESSAGE_EXPERIENCE,"You received 25 Woodcutting exp by cutting Logs.")
    if itemEx.itemid == 26386 then
        Game.createItem(26384, 1, toPosition):decay()
    end
 
    if skillLevel >= 1 and skillLevel <= 10 and skillTry >= (quant-25) then
        setPlayerStorageValue(cid,STORAGE_SKILL_TRY,skillTry + 25)
        setPlayerStorageValue(cid,STORAGE_SKILL_LEVEL,skillLevel + 1)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have advanced from Woodcutting Level ".. skillLevel .." to Woodcutting Level ".. skillLevel + 1 .."")
        player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    else
       setPlayerStorageValue(cid,STORAGE_SKILL_TRY,skillTry + 25)
    end
    return true
end
 
Last edited:
Solution
Wow! Thank you all for the help.

@Xikini I didn't know that I could reduce it down so much and still achieve what I was going for. That way looks so much nicer than what I had going on, thank you!

@Itutorial It works flawlessly. Thank you for taking your time to write that out for me. I've worked a little with different distros, and I've just recently decided to abandon anything older than 1.2, so while I'm making the scripts i tend to go with what I remember and it ends up mixed up, haha! I need to just write myself out a list of functions for 1.x and stick to those until I'm used to it.



For whoever reading this thread right now: The above script works well for a gathering skill. If you want me to explain it to you, just PM me and I'll help ya out :)
 
Code:
Game
    Game.createContainer(itemId, size[, position])
    Game.createItem(itemId[, count[, position]])
    Game.createMonster(monsterName, position[, extended = false[, force = false]])
    Game.createNpc(npcName, position[, extended = false[, force = false]])
    Game.createTile(position[, isDynamic = false])
    Game.createTile(x, y, z[, isDynamic = false])
    Game.getExperienceStage(level)
    Game.getGameState()
    Game.getHouses()
    Game.getMonsterCount()
    Game.getNpcCount()
    Game.getPlayerCount()
    Game.getPlayers()
    Game.getReturnMessage(value)
    Game.getSpectators(position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX = 0[, minRangeY = 0[, maxRangeY = 0]]]]]])
    Game.getTowns()
    Game.getWorldType()
    Game.loadMap(path)
    Game.setGameState(state)
    Game.setWorldType(type)   
    Game.startRaid(raidName)
Combat
    Combat()   
    combat:execute(creature, variant)
    combat:setArea(area)
    combat:setCallback(key, function)
    combat:setCondition(condition)
    combat:setFormula(type, mina, minb, maxa, maxb)
    combat:setOrigin(origin)
    combat:setParameter(key, value)
   
Condition
    Condition(conditionType[, conditionId = CONDITIONID_COMBAT])   
    condition:addDamage(rounds, time, value)
    condition:clone()
    condition:delete()
    condition:getEndTime()
    condition:getIcons()
    condition:getId()
    condition:getSubId()
    condition:getTicks()
    condition:getType()
    condition:setFormula(mina, minb, maxa, maxb)
    condition:setOutfit(lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet[, lookAddons[, lookMount]])
    condition:setOutfit(outfit)
    condition:setParameter(key, value)
    condition:setTicks(ticks)
   
Container
    Container(uid)   
    container:addItem(itemId[, count/subType = 1[, index = INDEX_WHEREEVER[, flags = 0]]])
    container:addItemEx(item[, index = INDEX_WHEREEVER[, flags = 0]])
    container:getCapacity()
    container:getEmptySlots([recursive = false])
    container:getItem(index)
    container:getItemCountById(itemId[, subType = -1])
    container:getItemHoldingCount()
    container:getSize()
    container:hasItem(item)
   
Creature
    Creature(id or name or userdata)
    creature:addCondition(condition[, force = false])
    creature:addHealth(healthChange)
    creature:addMana(manaChange[, animationOnLoss = false])
    creature:canSee(position)
    creature:canSeeCreature(creature)
    creature:changeSpeed(delta)
    creature:getBaseSpeed()
    creature:getCondition(conditionType[, conditionId = CONDITIONID_COMBAT[, subId = 0]])
    creature:getDamageMap()
    creature:getDescription(distance)
    creature:getDirection()
    creature:getFollowCreature()
    creature:getHealth()
    creature:getId()
    creature:getLight()
    creature:getMana()
    creature:getMaster()
    creature:getMaxHealth()
    creature:getMaxMana()
    creature:getName()
    creature:getOutfit()
    creature:getParent()
    creature:getPathTo(pos[, minTargetDist = 0[, maxTargetDist = 1[, fullPathSearch = true[, clearSight = true[, maxSearchDist = 0]]]]])
    creature:getPosition()
    creature:getSkull()
    creature:getSpeed()
    creature:getSummons()
    creature:getTarget()
    creature:getTile()
    creature:isCreature()
    creature:isHealthHidden()
    creature:isInGhostMode()
    creature:isRemoved()
    creature:registerEvent(name)
    creature:remove()
    creature:removeCondition(conditionType[, conditionId = CONDITIONID_COMBAT[, subId = 0[, force = false]]])
    creature:say(text, type[, ghost = false[, target = nullptr[, position]]])
    creature:setDirection(direction)
    creature:setDropLoot(doDrop)
    creature:setFollowCreature(followedCreature)
    creature:setHiddenHealth(hide)
    creature:setLight(color, level)
    creature:setMaster(master)
    creature:setMaxHealth(maxHealth)
    creature:setOutfit(outfit)
    creature:setSkull(skull)
    creature:setTarget(target)
    creature:teleportTo(position[, pushMovement = false])
    creature:unregisterEvent(name)
   
Group
    Group(id)   
    group:getAccess()
    group:getFlags()
    group:getId()
    group:getMaxDepotItems()
    group:getMaxVipEntries()
    group:getName()
   
Guild
    Guild(id)   
    guild:addRank(id, name, level)
    guild:getId()
    guild:getMembersOnline()
    guild:getMotd()
    guild:getName()
    guild:getRankById(id)
    guild:getRankByLevel(level)
    guild:setMotd(motd)
   
House
    House(id)   
    house:getAccessList(listId)
    house:getBedCount()
    house:getBeds()
    house:getDoorCount()
    house:getDoors()
    house:getExitPosition()
    house:getId()
    house:getName()
    house:getOwnerGuid()
    house:getRent()
    house:getTileCount()
    house:getTiles()
    house:getTown()
    house:setAccessList(listId, list)
    house:setOwnerGuid(guid[, updateDatabase = true])
   
Item
    Item(uid)   
    item:clone()
    item:decay()
    item:getActionId()
    item:getArticle()
    item:getAttribute(key)
    item:getCharges()
    item:getCount()
    item:getDescription(distance)
    item:getFluidType()
    item:getId()
    item:getName()
    item:getParent()
    item:getPluralName()
    item:getPosition()
    item:getSubType()
    item:getTile()
    item:getTopParent()
    item:getUniqueId()
    item:getWeight()
    item:hasAttribute(key)
    item:hasProperty(property)
    item:moveTo(position or cylinder)
    item:remove([count = -1])
    item:removeAttribute(key)
    item:setActionId(actionId)
    item:setAttribute(key, value)
    item:split([count = 1])
    item:transform(itemId[, count/subType = -1])
   
ItemType
    ItemType(id or name)   
    itemType:getArmor()
    itemType:getArticle()
    itemType:getAttack()
    itemType:getCapacity()
    itemType:getCharges()
    itemType:getClientId()
    itemType:getDecayId()
    itemType:getDefense()
    itemType:getDescription()
    itemType:getDestroyId()
    itemType:getElementDamage()
    itemType:getElementType()
    itemType:getExtraDefense()
    itemType:getFluidSource()
    itemType:getHitChance()
    itemType:getId()
    itemType:getName()
    itemType:getPluralName()
    itemType:getRequiredLevel()
    itemType:getShootRange()
    itemType:getSlotPosition()
    itemType:getTransformDeEquipId()
    itemType:getTransformEquipId()
    itemType:getType()
    itemType:getWeaponType()
    itemType:getWeight([count = 1])
    itemType:hasSubType()
    itemType:isContainer()
    itemType:isFluidContainer()
    itemType:isMovable()
    itemType:isReadable()
    itemType:isRune()
    itemType:isStackable()
    itemType:isWritable()
   
ModalWindow
    ModalWindow(id, title, message)   
    modalWindow:addButton(id, text)
    modalWindow:addChoice(id, text)
    modalWindow:getButtonCount()
    modalWindow:getChoiceCount()
    modalWindow:getDefaultEnterButton()
    modalWindow:getDefaultEscapeButton()
    modalWindow:getId()
    modalWindow:getMessage()
    modalWindow:getTitle()
    modalWindow:hasPriority()
    modalWindow:sendToPlayer(player)    item:isItem()
    modalWindow:setDefaultEnterButton(buttonId)
    modalWindow:setDefaultEscapeButton(buttonId)
    modalWindow:setMessage(text)
    modalWindow:setPriority(priority)
    modalWindow:setTitle(text)
   
Monster
    Monster(id or userdata)   
    monster:addFriend(creature)
    monster:addTarget(creature[, pushFront = false])
    monster:getFriendCount()
    monster:getFriendList()
    monster:getSpawnPosition()
    monster:getTargetCount()
    monster:getTargetList()
    monster:getType()
    monster:isFriend(creature)
    monster:isIdle()
    monster:isInSpawnRange([position])
    monster:isMonster()
    monster:isOpponent(creature)
    monster:isTarget(creature)
    monster:removeFriend(creature)
    monster:removeTarget(creature)
    monster:searchTarget([searchType = TARGETSEARCH_DEFAULT])
    monster:selectTarget(creature)
    monster:setIdle(idle)
    monsterType:canPushCreatures()
    monsterType:canPushItems()
    monsterType:getArmor()
    monsterType:getAttackList()
    monsterType:getBaseSpeed()
    monsterType:getChangeTargetChance()
    monsterType:getChangeTargetSpeed()
    monsterType:getCombatImmunities()
    monsterType:getConditionImmunities()
    monsterType:getCorpseId()
    monsterType:getCreatureEvents()
    monsterType:getDefense()
    monsterType:getDefenseList()
    monsterType:getElementList()
    monsterType:getExperience()
    monsterType:getHealth()
    monsterType:getLight()
    monsterType:getLoot()
    monsterType:getManaCost()
    monsterType:getMaxHealth()
    monsterType:getMaxSummons()
    monsterType:getName()
    monsterType:getNameDescription()
    monsterType:getOutfit()
    monsterType:getRace()
    monsterType:getRunHealth()
    monsterType:getStaticAttackChance()
    monsterType:getSummonList()
    monsterType:getTargetDistance()
    monsterType:getVoices()
    monsterType:getYellChance()
    monsterType:getYellSpeedTicks()
    monsterType:isAttackable()
    monsterType:isConvinceable()
    monsterType:isHealthShown()
    monsterType:isHostile()
    monsterType:isIllusionable()
    monsterType:isPushable()
    monsterType:isSummonable()
   
NetworkMessage
    NetworkMessage()   
    networkMessage:addByte(number)
    networkMessage:addDouble(number)
    networkMessage:addItem(item)
    networkMessage:addItemId(itemId)
    networkMessage:addPosition(position)
    networkMessage:addString(string)
    networkMessage:addU16(number)
    networkMessage:addU32(number)
    networkMessage:addU64(number)
    networkMessage:getByte()
    networkMessage:getPosition()
    networkMessage:getString()
    networkMessage:getU16()
    networkMessage:getU32()
    networkMessage:getU64()
    networkMessage:reset()
    networkMessage:sendToPlayer(player)
    networkMessage:skipBytes(number)
   
Npc
    Npc([id or name or userdata])   
    npc:getSpeechBubble()
    npc:isNpc()
    npc:setMasterPos(pos[, radius])
    npc:setSpeechBubble(speechBubble)
   
Party   
    party:addInvite(player)
    party:addMember(player)
    party:disband()
    party:getInviteeCount()
    party:getInvitees()
    party:getLeader()
    party:getMemberCount()
    party:getMembers()
    party:isSharedExperienceActive()
    party:isSharedExperienceEnabled()
    party:removeInvite(player)
    party:removeMember(player)
    party:setLeader(player)
    party:setSharedExperience(active)
    party:shareExperience(experience)
   
Player
    Player(id or name or userdata)   
    player:addBlessing(blessing)
    player:addExperience(experience[, sendText = false])
    player:addItem(itemId[, count = 1[, canDropOnMap = true[, subType = 1[, slot = CONST_SLOT_WHEREEVER]]]])
    player:addItemEx(item[, canDropOnMap = false[, index = INDEX_WHEREEVER[, flags = 0]]])
    player:addItemEx(item[, canDropOnMap = true[, slot = CONST_SLOT_WHEREEVER]])
    player:addManaSpent(amount)
    player:addMapMark(position, type, description)
    player:addMoney(money)
    player:addMount(mountId)
    player:addOfflineTrainingTime(time)
    player:addOfflineTrainingTries(skillType, tries)
    player:addOutfit(lookType)
    player:addOutfitAddon(lookType, addon)
    player:addPremiumDays(days)
    player:addSkillTries(skillType, tries)
    player:addSoul(soulChange)
    player:canLearnSpell(spellName)
    player:channelSay(speaker, type, text, channelId)
    player:forgetSpell(spellName)
    player:getAccountId()
    player:getAccountType()
    player:getBankBalance()
    player:getBaseMagicLevel()
    player:getCapacity()
    player:getClient()
    player:getContainerById(id)
    player:getContainerId(container)
    player:getContainerIndex(id)
    player:getDeathPenalty()
    player:getDepotChest(depotId[, autoCreate = false])
    player:getEffectiveSkillLevel(skillType)
    player:getExperience()
    player:getFreeCapacity()
    player:getGroup()
    player:getGuid()
    player:getGuild()
    player:getGuildLevel()
    player:getGuildNick()
    player:getHouse()
    player:getInbox()
    player:getIp()
    player:getItemById(itemId, deepSearch[, subType = -1])
    player:getItemCount(itemId[, subType = -1])
    player:getLastLoginSaved()
    player:getLastLogout()
    player:getLevel()
    player:getMagicLevel()
    player:getManaSpent()
    player:getMaxSoul()
    player:getMoney()
    player:getOfflineTrainingSkill()
    player:getOfflineTrainingTime()
    player:getParty()
    player:getPremiumDays()
    player:getSex()
    player:getSkillLevel(skillType)
    player:getSkillPercent(skillType)
    player:getSkillTries(skillType)
    player:getSkullTime()
    player:getSlotItem(slot)
    player:getSoul()
    player:getStamina()
    player:getStorageValue(key)
    player:getTown()
    player:getVocation()
    player:hasBlessing(blessing)
    player:hasLearnedSpell(spellName)
    player:hasMount(mountId)
    player:hasOutfit(lookType[, addon = 0])
    player:isPlayer()
    player:isPzLocked()
    player:learnSpell(spellName)
    player:openChannel(channelId)
    player:popupFYI(message)
    player:removeBlessing(blessing)
    player:removeExperience(experience[, sendText = false])
    player:removeItem(itemId, count[, subType = -1[, ignoreEquipped = false]])
    player:removeMoney(money)
    player:removeMount(mountId)
    player:removeOfflineTrainingTime(time)
    player:removeOutfit(lookType)
    player:removeOutfitAddon(lookType, addon)
    player:removePremiumDays(days)
    player:save()
    player:sendChannelMessage(author, text, type, channelId)
    player:sendOutfitWindow()
    player:sendPrivateMessage(speaker, text[, type])
    player:sendTextMessage(type, text[, position, primaryValue = 0, primaryColor = TEXTCOLOR_NONE[, secondaryValue = 0, secondaryColor = TEXTCOLOR_NONE]])
    player:sendTutorial(tutorialId)
    player:setAccountType(accountType)
    player:setBankBalance(bankBalance)
    player:setCapacity(capacity)
    player:setGhostMode(enabled)
    player:setGroup(group)
    player:setGuild(guild)
    player:setGuildLevel(level)
    player:setGuildNick(nick)
    player:setMaxMana(maxMana)
    player:setOfflineTrainingSkill(skillId)
    player:setSex(newSex)
    player:setSkullTime(skullTime)
    player:setStamina(stamina)
    player:setStorageValue(key, value)
    player:setTown(town)
    player:setVocation(id or name or userdata)
    player:showTextDialog(itemId[, text[, canWrite[, length]]])
   
Position
    Position([x = 0[, y = 0[, z = 0[, stackpos = 0]]]])
    Position([position])
    positionValue = position + positionEx
    positionValue = position - positionEx
    position == positionEx   
    position:getDistance(positionEx)
    position:isSightClear(positionEx[, sameFloor = true])
    position:sendDistanceEffect(positionEx, distanceEffect[, player = nullptr])
    position:sendMagicEffect(magicEffect[, player = nullptr])
   
Teleport
    Teleport(uid)   
    teleport:getDestination()
    teleport:setDestination(position)
   
Tile
    Tile(x, y, z)
    Tile(position)   
    tile:getBottomCreature()
    tile:getBottomVisibleCreature(creature)
    tile:getCreatureCount()
    tile:getCreatures()
    tile:getDownItemCount()
    tile:getFieldItem()
    tile:getGround()
    tile:getHouse()   
    tile:getItemById(itemId[, subType = -1])
    tile:getItemByTopOrder(topOrder)
    tile:getItemByType(itemType)
    tile:getItemCount()
    tile:getItemCountById(itemId[, subType = -1])
    tile:getItems()
    tile:getPosition()
    tile:getThing(index)
    tile:getThingCount()
    tile:getThingIndex(thing)
    tile:getTopCreature()
    tile:getTopDownItem()
    tile:getTopItemCount()
    tile:getTopTopItem()
    tile:getTopVisibleCreature(creature)
    tile:getTopVisibleThing(creature)
    tile:hasFlag(flag)
    tile:hasProperty(property[, item])
    tile:queryAdd(thing[, flags])
   
Town
    Town(id or name)   
    town:getId()
    town:getName()
    town:getTemplePosition()
   
Variant
    Variant(number or string or position or thing)
    Variant:getNumber()
    Variant:getPosition()
    Variant:getString()
   
Vocation
    Vocation(id or name)   
    vocation:getAttackSpeed()
    vocation:getBaseSpeed()
    vocation:getCapacityGain()
    vocation:getClientId()
    vocation:getDemotion()
    vocation:getDescription()
    vocation:getHealthGain()
    vocation:getHealthGainAmount()
    vocation:getHealthGainTicks()
    vocation:getId()
    vocation:getManaGain()
    vocation:getManaGainAmount()
    vocation:getManaGainTicks()
    vocation:getMaxSoul()
    vocation:getName()
    vocation:getPromotion()
    vocation:getRequiredManaSpent(magicLevel)
    vocation:getRequiredSkillTries(skillType, skillLevel)
    vocation:getSoulGainTicks()

Please choose a best answer to close this. No problem man we like to help people who are deserving.
 
Back
Top