local result

function onTalk()
    makeUnskippable()
    disableRetry()
    disableMovement()
    player.ForceCameraUpdate = true
    walkTo(8200, false, 1.0, false)
    local luanet = _G.luanet    
    player.Facing = luanet.enum(luanet.import_type("Celeste.Facings"), "Left")

if not getFlag("solex_experimentA") then
    say("SJ2021_SOLOIINI_UNEXPECTED00")

else repeat
    if not getFlag("solex_experiment_alt") then
	result = choice("SJ2021_SOLOIINI_UNEXPECTED01", "SJ2021_SOLOIINI_UNEXPECTED02", "SJ2021_SOLOIINI_UNEXPECTED03")
    else repeat
	result = choice("SJ2021_SOLOIINI_UNEXPECTED04", "SJ2021_SOLOIINI_UNEXPECTED05", "SJ2021_SOLOIINI_UNEXPECTED06")
	if result == 1 then
	    say("SJ2021_SOLOIINI_UNEXPECTED04_SAY")
	elseif result == 2 then
	    say("SJ2021_SOLOIINI_UNEXPECTED05_SAY")
	else
	    setFlag("solex_experiment_alt", false)
	    result = 6
	end
	until result == 6
    end

	if result == 2 then
	    setFlag("solex_experimentB")
	elseif result == 3 then
	    setFlag("solex_experiment_alt")
	end
    until result < 3
    end
end

function onEnd()
if not getFlag("solex_experimentB") then
    player.ForceCameraUpdate = false
    enableRetry()
    enableMovement()
    setFlag("solex_experimentA")

else
    player.ForceCameraUpdate = false
    enableRetry()
    enableMovement()
    teleportTo(389, 1952, "Crumbling Bastions")
    end
end