Thread: key combo!
View Single Post
  #3  
Old 05-25-2012, 07:11 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
Something like this should work:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.cheatcode = {"A","A","D","S","A","D","D"};
  
this.keycache = new[0];
}

function 
onKeyPressed(code,key) {
  
this.keycache.add(key);
  if (@
this.keycache == @this.cheatcode) {
    
player.chat = "Cheat Activated!";
    
onTimeout();
  } else 
setTimer(1);
}

function 
onTimeout() {
  
this.keycache = new[0];
} 
I think the timer in an NPC is a single variable, so in theory this would work. Whenever you hit a key it resets the timer, and you have one second to push the next key before it clears the cache.
Reply With Quote