Thread: Array help
View Single Post
  #14  
Old 08-31-2011, 01:00 AM
furry_mougle furry_mougle is offline
big heart
furry_mougle's Avatar
Join Date: Aug 2011
Posts: 42
furry_mougle is an unknown quantity at this point
Quote:
Originally Posted by 0PiX0 View Post
It's unnecessary to initialize a var to be set to 0. When incrementing, checking the condition 'this.i >= 0' is unnecessary. Also, you have the keys swapped.

Astram, I would use the method Crow described. In the end it should look somewhat like this:
PHP Code:
function GraalControl.onKeyDown(temp.keycodetemp.keystringtemp.scancode) {
  switch (
keycode) {
    case 
219:  this.selectedid = (this.selectedid 1) % this.rights.size();  break;
    case 
220:  this.selectedid = (this.selectedid 1) % this.rights.size();  break;
    default:   return;
  }
  
player.chat this.rights[this.selectedid];

That returns as a NULL value, you know?
Reply With Quote