• 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!

Radikaalz is learning LUA

radikaalz

New Member
Joined
Dec 16, 2009
Messages
32
Reaction score
0
Location
North-EU
hello OTlanders!

So im new to OpenTibia and know that, LUA scripting is more than important stuff in making own OT server. The problem is that, i have no programming skills and i have never programmed before, only HTML, CSS, and little bit PHP (from wordpress). Oh, few year ago played with Python. So i decided to make my own thread to learn LUA.

I have been reading LUA tutorials here in OTland for 2 days now, so this will be my first question. I saw there was a thread, were scripters talked much about differences in local and global use in functions. I searching that damn thread now in 2+ hours, but cant find it.. Haalp plx! ;]

EDIT:
finally found it myself.
 
Last edited:
This is very confusing for me.

im testing this script from tutorial which found in tutorial section:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 6119 then
doPlayerAddExp(cid, 300)
doCreatureSay(cid, "YAY! EXP!", 3)
end
return TRUE
end

in actions.xml have added line:

Code:
<action uniqueid="1002" event="script" value="pirmais.lua"/>

but i get this error when reloading actions with GOD char:
a3y76e3pbj1oocesxbn2.jpg

error talking about function, where END is expected, but i think END is right in both places...

edit: i have assigned UID to item 6119 with /attr command.
HAALP
 
Last edited:
try

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 6119 then
doPlayerAddExp(cid, 300)
doCreatureSay(cid, "YAY! EXP!", 3)
end
return TRUE
end
end
 
try

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 6119 then
doPlayerAddExp(cid, 300)
doCreatureSay(cid, "YAY! EXP!", 3)
end
return TRUE
end
end

not working, i tried with double end. Get the same error.

More confusing is that, i send script to friend, and he looked at it and sent me back the same scipt, but i opened that and saw that he had changed Item ID, so i changed back to 6119 and then run /reload actions and now script is working like a charm. But i did all the same actions before and scipt was not working.. :huh:
 
Ehh.. cant find what stackpos is for.

for example: wall1 = {x=505, y=598, z=8, stackpos=1}

I'll be glad if someone would explaint that for me. :)
 
Ty Richux, but i have seen more than 1 defined in stackpos
for example: local starting = {x = XXXXX, y = XXXXX, z = XXXXX, stackpos = 253}

can someone explain for my dumb head little bit more about stackpos?
ty
 
Back
Top