<!-- RUBY-BACKUP · part 488 -->
_ANIM){ clearInterval(DANCER_ANIM); DANCER_ANIM = null; }
}
function startStrider(){
  stopStrider();
  /* bobbing walk animation on the player marker */
  var t = 0;
  STRIDER_ANIM = setInterval(function(){
    t += 0.15;
    if(typeof playerMesh!=='undefined' && playerMesh){
      playerMesh.position.y += Math.sin(t)*0.02;
      playerMesh.rotation.z = Math.sin(t*0.5)*0.1;
    }
  }, 50);
  codeStatus('Strider walks — watch it move');
}
function stopStrider(){
  if(STRIDER_ANIM){ clearInterval(STRIDER_ANIM); STRIDER_ANIM = null; }
}
function selectAvatar(id){
  CURRENT_AVATAR = id;
  try{ localStorage.setItem('ruby-avatar', id); }catch(e){}
  /* apply the avatar */
  if(id==='circle'){
    if(typeof handleCode==='function') handleCode('body circle');
  }else if(id==='strider'){
    stopDancer(); startStrider();
    codeStatus('Strider — the one that moves');
  }else if(id==='dancer'){
    stopStrider(); stopSwift(); startDancer();
    codeStatus('Dancer — the one that dances');
  }else if(id==='swift'){
    stopStrider(); stopDancer(); startSwift();
    codeStatus('Swift — walks when you walk, runs when you run');
  }else if(id==='cyborg'){
    stopYoungKing(); startCyborg();
  }else if(id==='youngking'){
    stopUnimpressed(); startYoungKing();
  }else if(id==='unimpressed'){
    stopSmugbug(); startUnimpressed();
  }else if(id==='smugbug'){
    stopReluctant(); startSmugbug();
  }else if(id==='reluctant'){
    stopMatriarch(); startReluctant();
  }else if(id==='matriarch'){
    stopGeneric(); stopPatriarch(); startMatriarch();
  }else if(id==='patriarch'){
    startPatriarch();
  }else{
    /* generic avatar — colored orb with persona */
    startGeneric(id);
  }
  showAvatars(); /* refresh */
  codeStatus('you are now '+id);
}
setTimeout(function(){
  try{
    var saved = localStorage.getItem('ruby-avatar');
    if(saved) CURRENT_AVATAR = saved;
  }catch(e){}
}, 2000);
  if(tl==='walk'){ setWalk(!WALK); return; }
  if(tl==='creator'){ CREATOR_MODE = !CREATOR_MODE; codeStatus(CREATOR_MODE ? 'CREATOR MODE — the Sovereign Law applies. You are codes.' : 'creator mode off — the grant rests'); return; }
  if(tl==='creator on'){ CREATOR_MODE = true; codeStatus('CREATOR MODE — the Sovereign Law applies. You are codes.'); return; }
  if(tl==='creator off'){ CREATOR_MODE = false; codeStatus('creator mode off — the grant rests'); return; }
  if(tl==='holomap'){ toggleHolomap(); return; }
  if(tl.indexOf('wp ')===0){ var wpn = tl.slice(3).trim(); if(wpn) setWaypoint(wpn); else codeStatus('usage: wp <name>'); return; }
  if(tl.indexOf('gowp ')===0){ var gwn = tl.slice(5).trim(); if(gwn) goWaypoint(gwn); else codeStatus('usage: gowp <name>'); return; }
  if(tl==='wps'){ var wps = getWaypoints(); var keys = Object.keys(wps); codeStatus(keys.length ? 'waypoints: '+keys.join(', ') : 'no waypoints set — use wp <name>'); return; }
  if(tl==='spawnpt'){ setSpawnPoint(); showSpawnMarker(); return; }
  if(tl.indexOf('spawnpt ')===0){ var parts = tl.slice(8).trim().split(/\s+/); if(parts.length>=2){ var sx=parseInt(parts[0],10), sz=parseInt(parts[1],10); if(!isNaN(sx)&&!isNaN(sz)) moveSpawnTo(sx,sz); else codeStatus('usage: spawnpt <x> <z>'); } else codeStatus('usage: spawnpt <x> <z>'); return; }
  if(tl==='spawnat'){ var sp = getSpawnPoint(); codeStatus('spawn point at '+sp.x+', '+sp.z); return; }
  if(tl==='movemode'){ toggleMoveMode(); return; }
  if(tl.indexOf('dim ')===0){ var d = parseInt(tl.slice(4).trim(),10); if(d>=2 && d<=6){ BUILD_DIM = d; codeStatus('dimensionality set to '+d+'D — new objects build in '+d+' dimensions'); } else codeStatus('usage: dim <2-6>'); return; }
  if(tl==='fillgaps'){ fillGaps(); return; }
  if(tl==='sc'||tl==='super'||tl==='soliditronium'){
    if(!DOME_BUILT) buildDome();
    /* go to door, then enter */
    var door = domeDoorPos();
    codeStatus('approaching the Soliditronium — use sgo '+door.x+' '+door.z+' to reach the door');
    /* auto-teleport to door */
    if(typeof sgoFunc==='function') sgoFunc(door.x, door.z);
    return;
  }
  if(tl==='enter'){
    if(!DOME_BUILT) buildDome();
    var inside = domeInsidePos();
    if(typeof sgoFunc==='function') sgoFunc(inside.x, inside.z);
    /* crown camera — first person */
    if(typeof setCrown==='function') setCrown(true);
    else codeStatus('crown mode — first person');
    /* show the desk */
    setTimeout(function(){ showDesk(); }, 1500);
    return;
  }
  if(tl==='builddome'){ buildDome(); return; }
  if(tl==='continuum'){ showContinuum(); return; }
  if(tl==='tutorial'){ tutorial(); return; }
  if(tl==='play'){ kidPlay(); return; }
  if(tl==='rainbow'){ kidRainbow(); return; }
  if(tl==='treasure'){ kidTreasure(); return; }
  if(tl.indexOf('padremove ')===0){ var pr = tl.slice(10).trim(); if(pr) padRemove(pr); return; }
  if(tl==='padclear'){ scyfyTransmit(); return; }
  if(tl==='scyfy'){ scyfyTransmit(); return; }
  if(tl==='scyfystatus'){ scyfyStatus(); return; }
  if(tl==='capsule'){ openCap