Thread: New Emotions
View Single Post
  #3  
Old 10-10-2008, 09:16 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
lol, I get credits for the enablefeatures line?

Anyways, got rid of the nesting and replaced it with an array:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.keymaps = {
    
577,"aeko-crtl_a.gif",
    
578,"aeko-crtl_b.gif",
    
579,"aeko-crtl_c.png",
    
580,"aeko-crtl_d.png",
    
581,"aeko-crtl_e.gif",
    
582,"aeko-crtl_f.png",
    
583,"aeko-crtl_g.png",
    
584,"aeko-crtl_h.png",
    
585,"aeko-crtl_i.gif",
    
586,"aeko-crtl_j.gif",
    
587,"aeko-crtl_k.png",
    
588,"aeko-crtl_l.gif",
    
589,"aeko-crtl_m.png",
    
590,"aeko-crtl_n.gif",
    
591,"aeko-crtl_o.png",
    
592,"aeko-crtl_p.png",
    
593,"aeko-crtl_q.png",
    
594,"aeko-crtl_r.gif",
    
595,"aeko-crtl_s.png",
    
596,"aeko-crtl_t.png",
    
597,"aeko-crtl_u.png",
    
598,"aeko-crtl_v.png",
    
599,"aeko-crtl_w.png",
    
600,"aeko-crtl_x.png",
    
601,"aeko-crtl_y.png",
    
602,"aeko-crtl_z.gif",
  };

  
enablefeatures(allfeatures-0x1000);
  
this.emote_timer = 0;
  
setTimer(0.05);
}

function 
GraalControl.onKeyDown(keymod, char, keynumber) {
  
Customize();
  if (
keymod in this.keymaps) this.emote = this.keymaps[this.keymaps.index(keymod)+1];
  else 
this.emote = "None";
  
  if (
this.emote != "None") {
    
this.emote_timer = 6;
    
showimg(1, this.emote, player.x + 1.5, player.y - 1.5);
    
changeimgMode(1, 1);
    
changeimgVis(1, 3);
    
changeimgColors(1, 1, 1, 1, .65); 
  }  
}
function 
onTimeout() {
  if (!
this.emote.ends("gif")) {
    if (
this.emote_timer >= 0.1) {
      
this.emote_timer -= 0.05;
    }else if (
this.emote_timer < 0.1) {
      
hideimg(1);
    }
  }
  
with(findimg(1)) {
    if (
x != player.x + 1.5 || y != player.y - 1.5) {
      
hideimg(1);
    }
  }
  
setTimer(0.05);
} 
I could have done it with subarrays, which would have looked a lot more organized and sensible, but that would have involved loop checks and all since you can't use .index for checking subarrays. This reminds me of GS1's make-shift subarrays :P

Last edited by DustyPorViva; 10-10-2008 at 09:49 PM..
Reply With Quote