- Joined
- Nov 17, 2010
- Messages
- 6,813
- Solutions
- 585
- Reaction score
- 5,379
0.3.7 Crying Damson
Short Story.. Skip down 2 paragraphs if you want.
Creating a simple script. Pull lever, check if two separate levers are flopped, teleport 2 players. Nice and simple. 15 minute script at most, right? Nope.
3 weeks ago I started this script, and after 2 hours of frustration, I stopped trying to fix it, and never looked back.
Found the script earlier this morning, figured I'd take another crack at it, and still the same problem as before.
for whatever ******* reason the lever gives me the same error, over and over again. Cannot find the bloody item. << So mad! I've copy and pasted this lever script into at least 20 other scripts.. and even copy pasted it into this script replacing the original code, and resetting the co-ordinates.. and also relocating my test levers.. with no luck.
So.. Can someone tell me where this error is coming from? Please!
Error Received 2.5 seconds after hitting lever.
Actions.xml
firstDoubleLever.lua
In-Game text of lever.
Thanks in advance!
Xikini
(Note: The script is clearly not finished. I'm just trying to figure out why this lever won't automatically flop back.. and is giving me the error.
I have tried with and without stackpos.. and for some reason using getthingfrompos finds no item on that square.. but a magic effect will definitely send to the same location.
As I said, I spent 2 hours before and another 30 minutes today.. so frustrating for the simplest part of the script.)
Short Story.. Skip down 2 paragraphs if you want.
Creating a simple script. Pull lever, check if two separate levers are flopped, teleport 2 players. Nice and simple. 15 minute script at most, right? Nope.
3 weeks ago I started this script, and after 2 hours of frustration, I stopped trying to fix it, and never looked back.
Found the script earlier this morning, figured I'd take another crack at it, and still the same problem as before.
for whatever ******* reason the lever gives me the same error, over and over again. Cannot find the bloody item. << So mad! I've copy and pasted this lever script into at least 20 other scripts.. and even copy pasted it into this script replacing the original code, and resetting the co-ordinates.. and also relocating my test levers.. with no luck.
So.. Can someone tell me where this error is coming from? Please!
Error Received 2.5 seconds after hitting lever.
Code:
[8:3:23.702] [Error - Action Interface]
[8:3:23.702] In a timer event called from:
[8:3:23.702] data/actions/scripts/aaCarlExampleScripts/firstDoubleLever.lua:onUse
Actions.xml
Code:
<action actionid="46000" event="script" value="aaCarlExampleScripts/firstDoubleLever.lua"/>
firstDoubleLever.lua
Code:
local lever_pos = {
[1] = {x = 1390, y = 1424, z = 7, stackpos=1}, -- Other lever
[2] = {x = 1387, y = 1424, z = 7, stackpos=1} -- Lever that your using
}
--local old_player_pos = {
-- [1] = {x = 1390, y = 1425, z = 7, stackpos=1}, -- Other Player Position
-- [2] = {x = 1387, y = 1425, z = 7, stackpos=1} -- This lever Position
--}
--local new_player_pos = {
-- [1] = {x = 1389, y = 1423, z = 7, stackpos=1}, -- Other player
-- [2] = {x = 1388, y = 1423, z = 7, stackpos=1} -- Player using this lever
--}
function resetLever()
doTransformItem(getTileItemById(lever_pos[2], 1946).uid, 1945)
end
function onUse(cid, item, frompos, item2, topos)
-- transform lever
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
addEvent(resetLever, 2500)
else
return false -- so that I can flop the switch back over when it fails
end
-- Check other lever
--local leverCheck = getThingFromPos(lever_pos[1])
--if leverCheck.itemid == 1946 then
-- for i = 1, #old_player_pos do
-- local player = getThingfromPos(old_player_pos[i])
-- doTeleportThing(player[i].uid, new_player_pos[i], FALSE)
-- end
--end
-- return onUse function
return true
end
In-Game text of lever.
Code:
08:14 You see a switch.
ItemID: [1946], ActionID: [46000].
TransformTo: [1945] (onUse).
Position: [X: 1387] [Y: 1424] [Z: 7].
Thanks in advance!
Xikini
(Note: The script is clearly not finished. I'm just trying to figure out why this lever won't automatically flop back.. and is giving me the error.
I have tried with and without stackpos.. and for some reason using getthingfrompos finds no item on that square.. but a magic effect will definitely send to the same location.
As I said, I spent 2 hours before and another 30 minutes today.. so frustrating for the simplest part of the script.)
Last edited: