def get_eid_from_special(agent_memory, S="AGENT", speaker=None):
    """get the entity id corresponding to a special ReferenceObject"""
    eid = None
    if S == "SPEAKER_LOOK" or S == "SPEAKER":
        if not speaker:
            raise Exception("Asked for speakers memid but did not give speaker name")
        eid = agent_memory.get_player_by_name(speaker).eid
    elif S == "AGENT":
        eid = agent_memory.get_mem_by_id(agent_memory.self_memid).eid
    return eid