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

Lua array of sqm help

dunnish

New Member
Joined
Jun 18, 2009
Messages
268
Solutions
1
Reaction score
2
Hello!

im not sure why this it not working
can somone help me?
Lua:
local gatepos = 
       { {x = 1005, y = 1006, z = 7},
        {x = 1006, y = 1006, z = 7},
        {x = 1007, y = 1006, z = 7},
        {x = 1008, y = 1006, z = 7}}
        
function storm()
        local getTile = getThingfromPos(gatepos)
    if getTile.itemid == 724 then
        doTransformItem(getTile.uid, 407)
    
    end
    doBroadcastMessage("storm is comeing Be aware of the safe zone")
    return true
end


function onThink(interval, lastExecution, thinkInterval)

    addEvent(storm, 6000)
    return true
end
 
Solution
im not sure how to do this can you help me?
i test but didnt get it to work.
i think i need some kind of loop right? but not sure how to make them.
Code:
function storm()
    for index, pos in pairs(gatepos) do
        local getTile = getThingfromPos(pos)
        if getTile.itemid == 724 then
            doTransformItem(getTile.uid, 407)
        end
    end
    doBroadcastMessage("storm is comeing Be aware of the safe zone")
    return true
end
Hello!

im not sure why this it not working
can somone help me?
Lua:
local gatepos =
       { {x = 1005, y = 1006, z = 7},
        {x = 1006, y = 1006, z = 7},
        {x = 1007, y = 1006, z = 7},
        {x = 1008, y = 1006, z = 7}}
       
function storm()
        local getTile = getThingfromPos(gatepos)
    if getTile.itemid == 724 then
        doTransformItem(getTile.uid, 407)
   
    end
    doBroadcastMessage("storm is comeing Be aware of the safe zone")
    return true
end


function onThink(interval, lastExecution, thinkInterval)

    addEvent(storm, 6000)
    return true
end
local getTile = getThingfromPos(gatepos)
"gatepos" isn't grabbing a value from the table.

You'd need to use gatepos[1] , for example, in order to check the first position you've listed in the table.
 
local getTile = getThingfromPos(gatepos)
"gatepos" isn't grabbing a value from the table.

You'd need to use gatepos[1] , for example, in order to check the first position you've listed in the table.


im not sure how to do this can you help me?
i test but didnt get it to work.
i think i need some kind of loop right? but not sure how to make them.
 
im not sure how to do this can you help me?
i test but didnt get it to work.
i think i need some kind of loop right? but not sure how to make them.
Code:
function storm()
    for index, pos in pairs(gatepos) do
        local getTile = getThingfromPos(pos)
        if getTile.itemid == 724 then
            doTransformItem(getTile.uid, 407)
        end
    end
    doBroadcastMessage("storm is comeing Be aware of the safe zone")
    return true
end
 
Solution
Code:
function storm()
    for index, pos in pairs(gatepos) do
        local getTile = getThingfromPos(pos)
        if getTile.itemid == 724 then
            doTransformItem(getTile.uid, 407)
        end
    end
    doBroadcastMessage("storm is comeing Be aware of the safe zone")
    return true
end
i tested and here is my code but its not working.
Lua:
local gatepos = {
        [1] = {pos = {1004, 1006, 7}},
        [2] = {pos = {1005, 1006, 7}},
        [3] = {pos = {1006, 1006, 7}},
        [4] = {pos = {1007, 1006, 7}},
        [5] = {pos = {1008, 1006, 7}},
        [6] = {pos = {10010, 1006, 7}}
        }
        

function storm()
    for index, pos in pairs(gatepos) do
        local getTile = getThingfromPos(pos)
        if getTile.itemid == 724 then
            doTransformItem(getTile.uid, 407)
        end
    end
    doBroadcastMessage("storm is comeing Be aware of the safe zone")
    return true
end





function onThink(interval, lastExecution, thinkInterval)



    addEvent(storm, 6000)

    return true

end
heres my error message.
Code:
[20:24:12.518] [Error - GlobalEvent Interface]
[20:24:12.518] In a timer event called from:
[20:24:12.518] data/globalevents/scripts/storm.lua:onThink
[20:24:12.534] Description:
[20:24:12.534] (LuaInterface::luaGetThingFromPos) Tile not found
 
Back
Top