function SearchLabel(str)
    return getFlag(str)
end

function Do_Teleport(target_anchor,arguments)
    local current_anchor=arguments.teleport_anchor
    if current_anchor==target_anchor then
        say("Teleport_Fail")
    else
        if target_anchor==1 then 
            teleportTo(597,126,"A_SIDE0","WakeUp")
        elseif target_anchor==2 then 
            teleportTo(-3067,-1966,"A_MOUNTAIN_10","WakeUp")
        elseif target_anchor==3 then
            teleportTo(-4763,136,"A_ICECAVE7","WakeUp")
        elseif target_anchor==4 then
            teleportTo(3288,-1173,"A_SIDE_WIND_TRANSITION","WakeUp")
        elseif target_anchor==5 then
            teleportTo(4980,-1621,"A_ISLAND_4","WakeUp")
        elseif target_anchor==6 then
            teleportTo(9854,155,"A_SWAMP_1","WakeUp")
        elseif target_anchor==7 then
            teleportTo(-9503,-1956,"A_CITY6","WakeUp")
        end
    end
end

function onTalk()
    disableMovement()
    choiceDialog({
        {
            "Teleport_1",
            repeatable = true,
            requires=function ()
                return SearchLabel("Teleport1_Activated")
            end,
            onChosen=function ()
                Do_Teleport(1,arguments)
            end
        },
        {
            "Teleport_2",
            repeatable = true,
            requires=function ()
                return SearchLabel("Teleport2_Activated")
            end,
            onChosen=function ()
                Do_Teleport(2,arguments)
            end
        },
        {
            "Teleport_3",
            repeatable = true,
            requires=function ()
                return SearchLabel("Teleport3_Activated")
            end,
            onChosen=function ()
                Do_Teleport(3,arguments)
            end
        },
        {
            "Teleport_4",
            repeatable = true,
            requires=function ()
                return SearchLabel("Teleport4_Activated")
            end,
            onChosen=function ()
                Do_Teleport(4,arguments)
            end
        },
        {
            "Teleport_5",
            repeatable = true,
            requires=function ()
                return SearchLabel("Teleport5_Activated")
            end,
            onChosen=function ()
                Do_Teleport(5,arguments)
            end
        },
        {
            "Teleport_6",
            repeatable = true,
            requires=function ()
                return SearchLabel("Teleport6_Activated")
            end,
            onChosen=function ()
                Do_Teleport(6,arguments)
            end
        },
        {
            "Teleport_7",
            repeatable = true,
            requires=function ()
                return SearchLabel("Teleport7_Activated")
            end,
            onChosen=function ()
                Do_Teleport(7,arguments)
            end
        },

        {
            "Teleport_8",
            repeatable = true,
            onChosen=function ()
                closeChoiceDialog()
            end
        },
    }
    )
    enableMovement()
end
function onEnd()
    enableMovement()
end
