exitmode = game.CurrentObject:getValue("exit")
function strMatch(str)
if string.find(game.CurrentObject:getName(), str) then
return true
end
end
if strMatch("exit") then
-- do something if exit is returned
break
elseif strMatch("obj") then
-- do something if obj is returned
break
elseif ...
-- etc...
end
function autoCursor()
exitcode = getObject("Game.GameCurrentCharacter.CharacterValues[exitcode]")
if game.CurrentObject:getId().tableId == eObjects then
objectname = game.CurrentObject:getName()
if not string.find(objectname, "exit") and exitcode.Int ~= 0 then
startAction("Game.GameCurrentCharacter.CharacterActions[cursor_normal]")
exitcode.Int = 0
elseif string.find(objectname, "exit_l") and exitcode.Int ~= 1 then
startAction("Game.GameCurrentCharacter.CharacterActions[cursor_exit_left]")
exitcode.Int = 1
elseif string.find(objectname, "exit_r") and exitcode.Int ~= 2 then
startAction("Game.GameCurrentCharacter.CharacterActions[cursor_exit_right]")
exitcode.Int = 2
elseif string.find(objectname, "exit_u") and exitcode.Int ~= 3 then
startAction("Game.GameCurrentCharacter.CharacterActions[cursor_exit_up]")
exitcode.Int = 3
elseif string.find(objectname, "exit_d") and exitcode.Int ~= 4 then
startAction("Game.GameCurrentCharacter.CharacterActions[cursor_exit_down]")
exitcode.Int = 4
end
elseif exitcode.Int ~= 0 then
startAction("Game.GameCurrentCharacter.CharacterActions[cursor_normal]")
exitcode.Int = 0
end
end
registerEventHandler("mouseEvent", "autoCursor")