Let's make it clear on posting support thread
Before reading on, Googling is the key to finding anything:
1. You should google for references to a programming language (there are a lot of results)
2. Use the support thread only for OpenTibia related issues.
3. If you are looking for a function to do something, yes, you can you post a support thread
Example:
How to add magic levels to a player?
How to make a weapon to attack two monsters at a time?
Can I change player's name [duplicate]?
Strikes:
If you saw a duplicate support thread, simply refer the main thread and just do nothing. Don't bite newcomers.
Useful Glossary
1. back-trace/stack-trace: This refers the flow of functions
for example, you have a function 'getPlayerStats'
your stacktrace would be:
``getStorageValue
` getPlayerStats
----------------------------------------------
1.a Common errors
1.a.1 Syntax
Usually lua errors tells you a lot of information on the backtrace[1] such as line number, functions, ....
Then you have a background of where the error is, you gotta figure what is wrong.. Usually you wrote a wrong symbol, forgot the keyword, ....
1.a.2 Logical errors
Are you trying to access a table index that doesn't exist?
There are more complicated cases, but I think you have just understood what's going on?!
1.b Interface errors
1.b.1 Action error
If you made a code that when using an item, the player should be teleported. But it doesn't work.
Firstly, check if the item id or the action id you wrote in the actions.xml is the same as the actual item you are using.
Secondly, check if the put a correct position in the teleport function
You can see that this code is correct, BUT? why doesn't it work.
1. You are not using the correct item.
2. Position {x = 1025, y = 1255, z = 9} doesn't exist on the map.
Before reading on, Googling is the key to finding anything:
1. You should google for references to a programming language (there are a lot of results)
2. Use the support thread only for OpenTibia related issues.
3. If you are looking for a function to do something, yes, you can you post a support thread
Example:
How to add magic levels to a player?
How to make a weapon to attack two monsters at a time?
Can I change player's name [duplicate]?
Strikes:
If you saw a duplicate support thread, simply refer the main thread and just do nothing. Don't bite newcomers.
Useful Glossary
1. back-trace/stack-trace: This refers the flow of functions
for example, you have a function 'getPlayerStats'
Code:
function getPlayerStats(player)
local stat1 = getStorageValue(player, 1200)
....
end
your stacktrace would be:
``getStorageValue
` getPlayerStats
----------------------------------------------
§ LUA §
1.a Common errors
1.a.1 Syntax
Usually lua errors tells you a lot of information on the backtrace[1] such as line number, functions, ....
Then you have a background of where the error is, you gotta figure what is wrong.. Usually you wrote a wrong symbol, forgot the keyword, ....
1.a.2 Logical errors
Are you trying to access a table index that doesn't exist?
Code:
local config = {
[1] = 'Level',
[2] = 'Magic Level',
}
local name = config[3] -- 3 doesn't exist
local str = "Config at 3 is " .. name -- causes error, name is nil
There are more complicated cases, but I think you have just understood what's going on?!
1.b Interface errors
1.b.1 Action error
If you made a code that when using an item, the player should be teleported. But it doesn't work.
Firstly, check if the item id or the action id you wrote in the actions.xml is the same as the actual item you are using.
Secondly, check if the put a correct position in the teleport function
Code:
function onUse(player, item)
player:teleportTo({x = 1025, y = 1255, z = 9})
end
You can see that this code is correct, BUT? why doesn't it work.
1. You are not using the correct item.
2. Position {x = 1025, y = 1255, z = 9} doesn't exist on the map.
------------------------------------
This is enough for now. I wish some people just add to this with more errors and way to solve them before posting to the support thread.