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

Storage Problem

Joepod

Active Member
Joined
Oct 12, 2008
Messages
389
Reaction score
25
I've downloaded a map that included a custom teleporter script, I get no errors until i step onto the teleporter and it says

Code:
[04/08/2013 11:44:17] [Error - MoveEvents Interface] 
[04/08/2013 11:44:17] data/movements/scripts/tp_sys.lua:onStepIn
[04/08/2013 11:44:17] Description: 
[04/08/2013 11:44:17] data/movements/scripts/tp_sys.lua:2: attempt to perform arithmetic on global '_storage' (a nil value)
[04/08/2013 11:44:17] stack traceback:
[04/08/2013 11:44:17] 	data/movements/scripts/tp_sys.lua:2: in function <data/movements/scripts/tp_sys.lua:1>

These are the scripts I am using:

Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    local aid = item.actionid-_storage
    local xpos = {x=996,y=998,z=8}
    if aid == _events_tp[1] and (getGlobalStorageValue(event_config.active) == -1 or getGlobalStorageValue(event_config.active) == 0) then
        doSendMagicEffect(getPlayerPosition(cid),2)
        doTeleportThing(cid,fromPosition)
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,_events_tp[2])
        return true
    end
    if _tp[aid] == nil then
        if isInArray({50001,50002,50003,50004,50005},item.uid) == true then
            doTeleportThing(cid,xpos)
            doSendMagicEffect(xpos,2)
        end
        return true
    end
 
    local callback = _tp[aid].callback and _tp[aid].callback(cid) or true
    if type(callback) == "string" then
        doSendMagicEffect(getThingPos(cid), 2)
        doTeleportThing(cid, fromPosition, true)
        doSendMagicEffect(getThingPos(cid), 38)
        return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, callback)
    end
    if _tp[aid].msg then
        doPlayerSendTextMessage(cid,_tp[aid].msg[2],_tp[aid].msg[1])
    end
    if _tp[aid].pos then
        doTeleportThing(cid,_tp[aid].pos)
        doSendMagicEffect(_tp[aid].pos,10)
    end
    if _tp[aid].func ~= nil then
        for i = 1,#_tp[aid].func do
            _tp[aid].func[i](cid)
        end        
    end
    if _tp[aid].count == nil and isInArray({50001,50002,50003,50004,50005},item.uid) == false then
        setGlobalStorageValue(_storage+aid,(getGlobalStorageValue(_storage+aid) < 0 and 1 or getGlobalStorageValue(_storage+aid)+1))
    end
    return true
end

Lua:
_tp = {
        [1] ={tpos={x=995,y=999,z=7},pos={x=943,y=876,z=9},count=0,text=1,name="Teleports", callback=function(cid) return tpCallback(cid) end, msg={"Welcome to the teleport room.",MESSAGE_STATUS_SMALL}},
        [2] ={tpos={x=995,y=998,z=7},pos={x=1025,y=983,z=7},count=0,text=0,name="", callback=function(cid) return isVip(cid) == false and "You are not VIP player." end}, 
        [3] ={tpos={x=996,y=995,z=7},pos={x=1025,y=983,z=7},count=0,text=1,name="Shops",func={function(cid) doSendAnimatedText(getPlayerPosition(cid),"Shops", COLOR_RED) end}},
        [4] ={tpos={x=996,y=1002,z=7},pos={x=1036,y=998,z=7},count=0,text=1,name="Depot"},
        [5] ={tpos={x=943,y=878,z=9},pos={x=1000,y=999,z=7},count=0,text=1,name="Back",func={function(cid) unregisterCreatureEvent(cid,"Bomber") end},noeff=1},
        [6] ={tpos={x=1024,y=980,z=8},pos={x=1024,y=975,z=9},name="",count=0,msg={"You have joined the waiting period of the current event.",MESSAGE_INFO_DESCR}},
        [7] ={tpos={x=943,y=874,z=9},count=0,text=1,name="Easy",noeff=1},
        [8] ={tpos={x=941,y=876,z=9},pcount=0,text=1,name="Medium",noeff=1},
        [9] ={tpos={x=945,y=876,z=9},count=0,text=1,name="Hard",noeff=1},
        [10] ={tpos={x=941,y=871,z=8},pos={x=1001,y=1005,z=8},name="Rotworms"}, --Rotworms
        [11] ={tpos={x=941,y=867,z=8},pos={x=970,y=1109,z=7},name="Cyclops"}, --Cyclops
        [12] ={tpos={x=941,y=863,z=8},pos={x=970,y=1109,z=7},name="Dragons"}, --Dragons
        [13] ={tpos={x=941,y=861,z=8},pos={x=1104,y=1058,z=7},name="Spiders"}, --GS
        [14] ={tpos={x=941,y=865,z=8},pos={x=1204,y=1139,z=7},name="Necromancers"}, 
        [15] ={tpos={x=1001,y=998,z=15},name="Events",text=1},
        [16] ={tpos={x=934,y=874,z=8},pos={x=1094,y=1234,z=11},name="Hydras"},
        [17] ={tpos={x=1059,y=999,z=7},pos={x=1213,y=1050,z=8},count=0,text=1,name="Bomberman",func={function(cid) setPlayerStorageValue(cid,200,1) doSendAnimatedText(getPlayerPosition(cid),"Bomberman", COLOR_RED) registerCreatureEvent(cid,"Bomber") end},msg={"This is the bomberman room.\n You can play classic or deluxe mode.",MESSAGE_INFO_DESCR}},
        [18] ={tpos={x=945,y=869,z=8},pos={x=1274,y=1183,z=7},name="Minotaurs"},
        [19] ={tpos={x=945,y=863,z=8},pos={x=1320,y=1117,z=7},name="Scarabs"},
        [20] ={tpos={x=15,y=13,z=8},name="Back",count=0,func={function(cid) doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid))) end}},
        [21] ={tpos={x=936,y=874,z=8},pos={x=1154,y=1149,z=5},name="Wyrms"},
        [22] ={tpos={x=1004,y=995,z=7},pos={x=1008,y=964,z=9},text=1,count=0,name="VIP Villae",func={function(cid) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"VIP Villas\nYou can get one Villa by donating.\n\nEvery Villa is 1000SQM big and has 4 Training Spots.\nIf you have donated put the deed of ownership on one stone altar.\nYou can only own 1 villa per character.") end}},
        [23] ={tpos={x=936,y=878,z=8},pos={x=1504,y=1022,z=7},name="Sea Serpents"},
        [24] ={tpos={x=938,y=878,z=8},pos={x=1111,y=1119,z=8},name="Warlocks"},
        [25] ={tpos={x=945,y=861,z=8},pos={x=1104,y=1058,z=7},name="Bog Raiders"},
        [26] ={tpos={x=945,y=871,z=8},pos={x=1068,y=1036,z=7},name="Trolls"},
        [27] ={tpos={x=934,y=878,z=8},pos={x=959,y=1179,z=7},name="Heroes"},
        [28] ={tpos={x=932,y=878,z=8},pos={x=1364,y=1149,z=11},name="Grim Reapers"},
        [29] ={tpos={x=945,y=865,z=8},pos={x=1364,y=1149,z=11},name="Vampires"},
        [30] ={tpos={x=932,y=874,z=8},pos={x=1716,y=1122,z=6},name="Frost Dragons"},
        [31] ={tpos={x=928,y=874,z=8},pos={x=1120,y=1366,z=11},name="Demons"},
        [32] ={tpos={x=1000,y=998,z=7},text=1,name="Heal"},
        [33] ={tpos={x=928,y=878,z=8},pos={x=902,y=1122,z=11},name="Behemoths"},
        [34] ={tpos={x=943,y=881,z=8},pos={x=1000,y=999,z=7},name="Nevia", count=0, text=1},
        [35] ={tpos={x=944,y=881,z=15},pos={x=794,y=1605,z=7},name="Port Nola", count=0, text=1},
        [36] ={tpos={x=938,y=874,z=8},pos={x=1111,y=1119,z=8},name="Vampire Brides"},
        [37] ={tpos={x=945,y=867,z=8},pos={x=1065,y=1083,z=7},name="Amazons"},
        [38] ={tpos={x=941,y=869,z=8},pos={x=939,y=908,z=7},name="Goblins"},
        [39] ={tpos={x=930,y=874,z=8},pos={x=862,y=985,z=7},name="Earth Elementals"},
        [40] ={tpos={x=948,y=874,z=8},pos={x=854,y=861,z=9},name="Juggernauts"},
        [41] ={tpos={x=930,y=874,z=8},pos={x=999,y=834,z=7},name="Hellspawns"},
        [42] ={tpos={x=948,y=878,z=8},pos={x=1498,y=1209,z=8},name="Elder Dragon Lords"},
        [43] ={tpos={x=793,y=1601,z=7},pos={x=943,y=876,z=9},count=0,text=1,name="Teleports", callback=function(cid) return tpCallback(cid) end, msg={"Welcome to the teleport room.",MESSAGE_STATUS_SMALL}},
        [44] ={tpos={x=933,y=1236,z=6},pos={x=943,y=876,z=9},count=0,text=1,name="Teleports", callback=function(cid) return tpCallback(cid) end, msg={"Welcome to the teleport room.",MESSAGE_STATUS_SMALL}},
        [45] ={tpos={x=942,y=881,z=15},pos={x=936,y=1238,z=6},name="Niaa", count=0, text=1},
        [46] ={tpos={x=950,y=878,z=8},pos={x=1224,y=1259,z=7},name="Noxious Crawlers"},
        [47] ={tpos={x=952,y=874,z=8},pos={x=1108,y=1124,z=4},name="Ferumbras"},
        [48] ={tpos={x=952,y=878,z=8},pos={x=994,y=1255,z=7},name="Mud Golems"},
        [49] ={tpos={x=950,y=874,z=8},pos={x=887,y=1086,z=7},name="Morphlings"}
    }
 
_storage is not defined and therefore you cannot perform any operation on it (in this case the operation is arthi aka mathmetical)
 
Code:
_tp = {
        [1] ={tpos={x=995,y=999,z=7},pos={x=943,y=876,z=9},count=0,text=1,name="Teleports", callback=function(cid) return tpCallback(cid) end, msg={"Welcome to the teleport room.",MESSAGE_STATUS_SMALL}},
        [2] ={tpos={x=995,y=998,z=7},pos={x=1025,y=983,z=7},count=0,text=0,name="", callback=function(cid) return isVip(cid) == false and "You are not VIP player." end}, 
        [3] ={tpos={x=996,y=995,z=7},pos={x=1025,y=983,z=7},count=0,text=1,name="Shops",func={function(cid) doSendAnimatedText(getPlayerPosition(cid),"Shops", COLOR_RED) end}},
        [4] ={tpos={x=996,y=1002,z=7},pos={x=1036,y=998,z=7},count=0,text=1,name="Depot"},
        [5] ={tpos={x=943,y=878,z=9},pos={x=1000,y=999,z=7},count=0,text=1,name="Back",func={function(cid) unregisterCreatureEvent(cid,"Bomber") end},noeff=1},
        [6] ={tpos={x=1024,y=980,z=8},pos={x=1024,y=975,z=9},name="",count=0,msg={"You have joined the waiting period of the current event.",MESSAGE_INFO_DESCR}},
        [7] ={tpos={x=943,y=874,z=9},count=0,text=1,name="Easy",noeff=1},
        [8] ={tpos={x=941,y=876,z=9},pcount=0,text=1,name="Medium",noeff=1},
        [9] ={tpos={x=945,y=876,z=9},count=0,text=1,name="Hard",noeff=1},
        [10] ={tpos={x=941,y=871,z=8},pos={x=1001,y=1005,z=8},name="Rotworms"}, --Rotworms
        [11] ={tpos={x=941,y=867,z=8},pos={x=970,y=1109,z=7},name="Cyclops"}, --Cyclops
        [12] ={tpos={x=941,y=863,z=8},pos={x=970,y=1109,z=7},name="Dragons"}, --Dragons
        [13] ={tpos={x=941,y=861,z=8},pos={x=1104,y=1058,z=7},name="Spiders"}, --GS
        [14] ={tpos={x=941,y=865,z=8},pos={x=1204,y=1139,z=7},name="Necromancers"}, 
        [15] ={tpos={x=1001,y=998,z=15},name="Events",text=1},
        [16] ={tpos={x=934,y=874,z=8},pos={x=1094,y=1234,z=11},name="Hydras"},
        [17] ={tpos={x=1059,y=999,z=7},pos={x=1213,y=1050,z=8},count=0,text=1,name="Bomberman",func={function(cid) setPlayerStorageValue(cid,200,1) doSendAnimatedText(getPlayerPosition(cid),"Bomberman", COLOR_RED) registerCreatureEvent(cid,"Bomber") end},msg={"This is the bomberman room.\n You can play classic or deluxe mode.",MESSAGE_INFO_DESCR}},
        [18] ={tpos={x=945,y=869,z=8},pos={x=1274,y=1183,z=7},name="Minotaurs"},
        [19] ={tpos={x=945,y=863,z=8},pos={x=1320,y=1117,z=7},name="Scarabs"},
        [20] ={tpos={x=15,y=13,z=8},name="Back",count=0,func={function(cid) doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid))) end}},
        [21] ={tpos={x=936,y=874,z=8},pos={x=1154,y=1149,z=5},name="Wyrms"},
        [22] ={tpos={x=1004,y=995,z=7},pos={x=1008,y=964,z=9},text=1,count=0,name="VIP Villae",func={function(cid) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"VIP Villas\nYou can get one Villa by donating.\n\nEvery Villa is 1000SQM big and has 4 Training Spots.\nIf you have donated put the deed of ownership on one stone altar.\nYou can only own 1 villa per character.") end}},
        [23] ={tpos={x=936,y=878,z=8},pos={x=1504,y=1022,z=7},name="Sea Serpents"},
        [24] ={tpos={x=938,y=878,z=8},pos={x=1111,y=1119,z=8},name="Warlocks"},
        [25] ={tpos={x=945,y=861,z=8},pos={x=1104,y=1058,z=7},name="Bog Raiders"},
        [26] ={tpos={x=945,y=871,z=8},pos={x=1068,y=1036,z=7},name="Trolls"},
        [27] ={tpos={x=934,y=878,z=8},pos={x=959,y=1179,z=7},name="Heroes"},
        [28] ={tpos={x=932,y=878,z=8},pos={x=1364,y=1149,z=11},name="Grim Reapers"},
        [29] ={tpos={x=945,y=865,z=8},pos={x=1364,y=1149,z=11},name="Vampires"},
        [30] ={tpos={x=932,y=874,z=8},pos={x=1716,y=1122,z=6},name="Frost Dragons"},
        [31] ={tpos={x=928,y=874,z=8},pos={x=1120,y=1366,z=11},name="Demons"},
        [32] ={tpos={x=1000,y=998,z=7},text=1,name="Heal"},
        [33] ={tpos={x=928,y=878,z=8},pos={x=902,y=1122,z=11},name="Behemoths"},
        [34] ={tpos={x=943,y=881,z=8},pos={x=1000,y=999,z=7},name="Nevia", count=0, text=1},
        [35] ={tpos={x=944,y=881,z=15},pos={x=794,y=1605,z=7},name="Port Nola", count=0, text=1},
        [36] ={tpos={x=938,y=874,z=8},pos={x=1111,y=1119,z=8},name="Vampire Brides"},
        [37] ={tpos={x=945,y=867,z=8},pos={x=1065,y=1083,z=7},name="Amazons"},
        [38] ={tpos={x=941,y=869,z=8},pos={x=939,y=908,z=7},name="Goblins"},
        [39] ={tpos={x=930,y=874,z=8},pos={x=862,y=985,z=7},name="Earth Elementals"},
        [40] ={tpos={x=948,y=874,z=8},pos={x=854,y=861,z=9},name="Juggernauts"},
        [41] ={tpos={x=930,y=874,z=8},pos={x=999,y=834,z=7},name="Hellspawns"},
        [42] ={tpos={x=948,y=878,z=8},pos={x=1498,y=1209,z=8},name="Elder Dragon Lords"},
        [43] ={tpos={x=793,y=1601,z=7},pos={x=943,y=876,z=9},count=0,text=1,name="Teleports", callback=function(cid) return tpCallback(cid) end, msg={"Welcome to the teleport room.",MESSAGE_STATUS_SMALL}},
        [44] ={tpos={x=933,y=1236,z=6},pos={x=943,y=876,z=9},count=0,text=1,name="Teleports", callback=function(cid) return tpCallback(cid) end, msg={"Welcome to the teleport room.",MESSAGE_STATUS_SMALL}},
        [45] ={tpos={x=942,y=881,z=15},pos={x=936,y=1238,z=6},name="Niaa", count=0, text=1},
        [46] ={tpos={x=950,y=878,z=8},pos={x=1224,y=1259,z=7},name="Noxious Crawlers"},
        [47] ={tpos={x=952,y=874,z=8},pos={x=1108,y=1124,z=4},name="Ferumbras"},
        [48] ={tpos={x=952,y=878,z=8},pos={x=994,y=1255,z=7},name="Mud Golems"},
        [49] ={tpos={x=950,y=874,z=8},pos={x=887,y=1086,z=7},name="Morphlings"}
    }
_storage = 50000
 
Thanks Amino, why am I getting this now? Ffs haha

Code:
[04/08/2013 13:19:23] [Error - MoveEvents Interface] 
[04/08/2013 13:19:23] data/movements/scripts/tp_sys.lua:onStepIn
[04/08/2013 13:19:23] Description: 
[04/08/2013 13:19:23] data/movements/scripts/tp_sys.lua:4: attempt to index global '_events_tp' (a nil value)
[04/08/2013 13:19:23] stack traceback:
[04/08/2013 13:19:23] 	data/movements/scripts/tp_sys.lua:4: in function <data/movements/scripts/tp_sys.lua:1>
 
Ehh, just remove that lines :D Probably u don't need them

Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    local aid = item.actionid-_storage
    local xpos = {x=996,y=998,z=8}
    if _tp[aid] == nil then
        if isInArray({50001,50002,50003,50004,50005},item.uid) == true then
            doTeleportThing(cid,xpos)
            doSendMagicEffect(xpos,2)
        end
        return true
    end
 
    local callback = _tp[aid].callback and _tp[aid].callback(cid) or true
    if type(callback) == "string" then
        doSendMagicEffect(getThingPos(cid), 2)
        doTeleportThing(cid, fromPosition, true)
        doSendMagicEffect(getThingPos(cid), 38)
        return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, callback)
    end
    if _tp[aid].msg then
        doPlayerSendTextMessage(cid,_tp[aid].msg[2],_tp[aid].msg[1])
    end
    if _tp[aid].pos then
        doTeleportThing(cid,_tp[aid].pos)
        doSendMagicEffect(_tp[aid].pos,10)
    end
    if _tp[aid].func ~= nil then
        for i = 1,#_tp[aid].func do
            _tp[aid].func[i](cid)
        end        
    end
    if _tp[aid].count == nil and isInArray({50001,50002,50003,50004,50005},item.uid) == false then
        setGlobalStorageValue(_storage+aid,(getGlobalStorageValue(_storage+aid) < 0 and 1 or getGlobalStorageValue(_storage+aid)+1))
    end
    return true
end
 
Back
Top