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

Problem with "parameters" Help Please!

johny5608

johny
Joined
Oct 5, 2008
Messages
120
Reaction score
0
Location
Wien
Hello guys,
I got a problem with every item that move.
[28/03/2010 16:22:35] data/movements/scripts/boat.lua:73: attempt to index local 'parameters' (a number value)
[28/03/2010 16:22:35] stack traceback:
[28/03/2010 16:22:35] data/movements/scripts/boat.lua:73: in function 'doSetItemActionId'
[28/03/2010 16:22:35] data/movements/scripts/car.lua:20: in function <data/movements/scripts/car.lua:10>

This is the script for car:
local CAR_ID = {1675, 1676, 1674, 1677}
function onStepIn(cid, item, pos, frompos)
if isPlayer(cid) == TRUE then
local carpos = getThingPos(item.uid)
addEvent(carMove, 200, {cid = cid, oldpos = carpos})
end
end

function carMove(param)
local car = getThingfromPos(param.oldpos)
local newpos = getPlayerLookPos(param.cid)
if getDistanceBetween(getThingPos(param.cid), param.oldpos) == 0 then
if isInArray(CAR_ID, car.itemid) == TRUE then
local tmp = newpos
tmp.stackpos = 253
if doTileQueryAdd(car.uid, newpos) == 1 and getTilePzInfo(newpos) == FALSE and isCreature(getThingFromPos(tmp).uid) == FALSE then
local carid = CAR_ID[getPlayerLookDir(param.cid)+1]
local newcar = doCreateItem(carid, 1, newpos)
doSetItemActionId(newcar, car.actionid)
doSetItemSpecialDescription(newcar, car.description)
doRemoveItem(car.uid, 1)
doTeleportThing(param.cid, newpos, FALSE)
doSendMagicEffect(param.oldpos, CONST_ME_GROUNDSHAKER)
end
end
end
return true
end

Please help!
 
Code:
local CAR_ID = {1675, 1676, 1674, 1677}
function onStepIn(cid, item, pos, frompos)
	if isPlayer(cid) then
		local carpos = getThingPos(item.uid)
		addEvent(carMove, 200, {cid = cid, oldpos = carpos})
	end
end

function carMove(param)
	local car = getThingfromPos(param.oldpos)
	local newpos = getPlayerLookPos(param.cid)
	if getDistanceBetween(getThingPos(param.cid), param.oldpos) == 0 then
		if isInArray(CAR_ID, car.itemid) then
			local tmp = newpos
			tmp.stackpos = 253
			if doTileQueryAdd(car.uid, newpos) == 1 and not getTileInfo(newpos).protection and not isCreature(getTopCreature(tmp).uid) then
				local carid = CAR_ID[getCreatureLookDirection(param.cid)+1]
				local newcar = doCreateItem(carid, 1, newpos)
				doItemSetAttribute(newcar, "aid", car.actionid)
				doItemSetAttribute(newcar, "description", getItemAttribute(car.uid, "description") or getItemInfo(car.itemid).description)
				doRemoveItem(car.uid)
				doTeleportThing(param.cid, newpos, false)
				doSendMagicEffect(param.oldpos, CONST_ME_GROUNDSHAKER)
			end
		end
	end
end
 
Code:
-- BY GOD CARBON (RTOIP)
lodzid = {
[NORTH] = {3587,3589,3591},
[SOUTH] = {3591,3589,3587},
[WEST] = {3592,3594,3596},
[EAST] = {3596,3594,3592}
}
POZIOMO = 1
PIONOWO = 2
cid = {}
pozycja = {}
-- USTAWIENIA \
powrot = true -- czy lodz ma powracac ta sama trasa?
licznik = true -- czy licznik ma byc wlaczony?
trasa = {
-- TU ZMIENIAMY TRASE \/
{ -- kierunek NWSE ile ma przeplynac co ile odnawia licznik co ile ms lodz plynie kratke
{kierunek = WEST, odleglosc = 235, licznikco = 7, delay = 170}, -- 41 kratek na pólnoc, licznik co 5 kratek, 33 kratki na sekunde
{kierunek = WEST, odleglosc = 12, licznikco = 2, delay = 600} -- 2 kratki na pólnoc, licznik co kratke, 1 kratka na sekunde
},
{ -- TRASA DLA DRUGIEJ LODZI (ACTIONID 20002 NA MAPIE)
{kierunek = EAST, odleglosc = 235, licznikco = 5, delay = 120}, -- jak wyzej tylko na poludnie
{kierunek = EAST, odleglosc = 12, licznikco = 1, delay = 500}
}
}

function kierunekLodzi(ktora)
if getThingFromPos({x = pozycja[ktora].x, y = pozycja[ktora].y-1, z = pozycja[ktora].z, stackpos = STACKPOS_FIRST_ITEM_ABOVE_GROUNDTILE}).itemid == lodzid[NORTH][1] then
return PIONOWO
else
return POZIOMO
end
end
function obrocLodzPoziomo(ktora)
if kierunekLodzi(ktora) == PIONOWO then
for n = 1,3 do
local i = n - 2
local kawalek = {x = pozycja[ktora].x, y = pozycja[ktora].y+i, z = pozycja[ktora].z, stackpos = STACKPOS_FIRST_ITEM_ABOVE_GROUNDTILE}
local ppos = {x = pozycja[ktora].x, y = pozycja[ktora].y+i, z = pozycja[ktora].z, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
local newpos = {x = pozycja[ktora].x+i, y = pozycja[ktora].y, z = pozycja[ktora].z}
local lodz = getThingFromPos(kawalek)
doRemoveItem(lodz.uid,1)
doCreateItem(lodzid[WEST][n],1,newpos)
while (getThingFromPos(ppos).itemid > 0) and i ~= 0 do
doTeleportThing(getThingFromPos(ppos).uid,newpos)
end
end
end
return true
end
function obrocLodzPionowo(ktora)
if kierunekLodzi(ktora) == POZIOMO then
for n = 1,3 do
local i = n - 2
local kawalek = {x = pozycja[ktora].x+i, y = pozycja[ktora].y, z = pozycja[ktora].z, stackpos = STACKPOS_FIRST_ITEM_ABOVE_GROUNDTILE}
local ppos = {x = pozycja[ktora].x+i, y = pozycja[ktora].y, z = pozycja[ktora].z, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
local newpos = {x = pozycja[ktora].x, y = pozycja[ktora].y+i, z = pozycja[ktora].z}
local lodz = getThingFromPos(kawalek)
doRemoveItem(lodz.uid,1)
doCreateItem(lodzid[NORTH][n],1,newpos)
while (getThingFromPos(ppos).itemid > 0) and i ~= 0 do
doTeleportThing(getThingFromPos(ppos).uid,newpos)
end
end
end
return true
end
function _move(parameters)
pozycja[parameters.ktora] = move(parameters.trasa,parameters.invert,parameters .ktora)
return true
end
function doSetItemActionId(parameters)
doSetItemActionId(getThingFromPos({x = pozycja[parameters.ktora].x, y = pozycja[parameters.ktora].y, z = pozycja[parameters.ktora].z, stackpos = STACKPOS_FIRST_ITEM_ABOVE_GROUNDTILE}).uid,paramet ers.actionid)
return true
end
function move(p,invert,ktoralodz)
local plus =
{-- NORTH EAST SOUTH WEST
x = {0, 1, 0, -1},
y = {-1, 0, 1, 0},
x1 = {0, 1, 0, -1},
x3 = {0, -1, 0, 1},
y1 = {-1, 0, 1, 0},
y2 = {0, 0, 0, 0},
y3 = {1, 0, -1, 0}
}
local kier = p.kierunek
if invert == true then
if kier == NORTH then
kier = SOUTH
elseif kier == SOUTH then
kier = NORTH
elseif kier == EAST then
kier = WEST
elseif kier == WEST then
kier = EAST
end
end
if (kier == NORTH or kier == SOUTH) and kierunekLodzi(ktoralodz) == POZIOMO then
obrocLodzPionowo(ktoralodz)
elseif (kier == EAST or kier == WEST) and kierunekLodzi(ktoralodz) == PIONOWO then
obrocLodzPoziomo(ktoralodz)
end
local czesci = {
{x = pozycja[ktoralodz].x+plus.x1[kier+1], y = pozycja[ktoralodz].y+plus.y1[kier+1], z = pozycja[ktoralodz].z, stackpos = STACKPOS_FIRST_ITEM_ABOVE_GROUNDTILE},
{x = pozycja[ktoralodz].x, y = pozycja[ktoralodz].y, z = pozycja[ktoralodz].z, stackpos = STACKPOS_FIRST_ITEM_ABOVE_GROUNDTILE},
{x = pozycja[ktoralodz].x+plus.x3[kier+1], y = pozycja[ktoralodz].y+plus.y3[kier+1], z = pozycja[ktoralodz].z, stackpos = STACKPOS_FIRST_ITEM_ABOVE_GROUNDTILE}
}
local npos = {
{x = pozycja[ktoralodz].x+plus.x[kier+1]+plus.x1[kier+1], y = pozycja[ktoralodz].y+plus.y[kier+1]+plus.y1[kier+1], z = pozycja[ktoralodz].z},
{x = pozycja[ktoralodz].x+plus.x[kier+1], y = pozycja[ktoralodz].y+plus.y[kier+1], z = pozycja[ktoralodz].z},
{x = pozycja[ktoralodz].x+plus.x[kier+1]+plus.x3[kier+1], y = pozycja[ktoralodz].y+plus.y[kier+1]+plus.y3[kier+1], z = pozycja[ktoralodz].z}
}
for i = 1,3 do
lodz = getThingFromPos(czesci[i])
doRemoveItem(lodz.uid,1)
doCreateItem(lodzid[kier][i],1,npos[i])
while getThingFromPos({x = czesci[i].x, y = czesci[i].y, z = czesci[i].z, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}).itemid > 0 do
doTeleportThing(getThingFromPos({x = czesci[i].x, y = czesci[i].y, z = czesci[i].z, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}).uid,npos[i])
end
end
if licznik == true and ((kier == SOUTH or kier == NORTH) and pozycja[ktoralodz].y % p.licznikco == 0) or ((kier == EAST or kier == WEST) and pozycja[ktoralodz].x % p.licznikco == 0) then
local mpers = 1000 / p.delay
doPlayerSendCancel(cid[ktoralodz],"Speed: " .. mpers .. " m/s (" .. mpers * 3.6 .. " km/h)")
end
return {x = pozycja[ktoralodz].x+plus.x[kier+1], y = pozycja[ktoralodz].y+plus.y[kier+1], z = pozycja[ktoralodz].z}
end
function onStepIn(cidd, item, position, fromPosition)
if item.actionid < 20001 or item.actionid > 20100 then return true end
local ktoralodz = item.actionid - 20000
cid[ktoralodz] = cidd
pozycja[ktoralodz] = position
local j = 0
local k = 0
local m = 0
for l = 1,table.maxn(trasa[ktoralodz]) do
m = m + trasa[ktoralodz][l].odleglosc
while j < m do
addEvent(_move, k, {trasa = trasa[ktoralodz][l], invert = false, ktora = ktoralodz})
j = j + 1
k = k + trasa[ktoralodz][l].delay
end
end
if powrot == true then
l = table.maxn(trasa[ktoralodz])
while l > 0 do
m = m + trasa[ktoralodz][l].odleglosc
while j < m do
addEvent(_move, k, {trasa = trasa[ktoralodz][l], invert = true, ktora = ktoralodz})
j = j + 1
k = k + trasa[ktoralodz][l].delay
end
l = l - 1
end
end
addEvent(doSetItemActionId,k, {actionid = item.actionid, ktora = ktoralodz})
return true
end
 
--Remmacs
it don't function...
[28/03/2010 19:01:50] [Error - LuaScriptInterface::loadFile] data/movements/scripts/boat.lua:73: ')' expected near 'ers'
[28/03/2010 19:01:50] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/boat.lua)
[28/03/2010 19:01:50] data/movements/scripts/boat.lua:73: ')' expected near 'ers'
[28/03/2010 19:01:50] [Error - LuaScriptInterface::loadFile] data/movements/scripts/boat.lua:73: ')' expected near 'ers'
[28/03/2010 19:01:50] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/boat.lua)
[28/03/2010 19:01:50] data/movements/scripts/boat.lua:73: ')' expected near 'ers'
 
Back
Top