if (hasMemo("gaveDemonKey") && !hasMemo("demonPortalsOpen"))
{
  setMemo("demonPortalsOpen");
  getPortal("p0").enable();
  getPortal("p1").enable();
  getPortal("p2").enable();
  var device = getItem("warp_device");
  device.grid.gridY = 7;
  device.parent.visible = true;
  unlockDiary("demon");
}
if (!hasMemo("talkedToDemon"))
{
  getPortal("p3").enable();
  setMemo("talkedToDemon");
  unlockDiary("demon_key");
}