View Single Post
  #9  
Old 02-28-2002, 05:42 PM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
NPC Code:

if (playerenters || created) {
timereverywhere;
tokenize "Number1""Number2""Number3""Number4""Number5";
this.maxposes = tokenscount;
this.active=0;
this.pos=0;
this.oldkey=(-1);
}
if (playertouchsme) {
setani idle,;
this.active=1;
timeout=.05;
}
if (timeout) {
if (this.active==1) {
freezeplayer .05;
draw();
cursor();
timeout=.05;
}
else hideimgs();
}

function draw() {
for (i=0;i<this.maxposes;i++) {
showimg i,@#t(i),screenwidth/2-100,screenheight/2-(this.maxposes*15)+(i*15);
changeimgvis i,4;
if (this.pos==i) changeimgcolors i,1,0,0,0;
else changeimgcolors i,1,1,1,0;
}
}

function cursor() {
if (!keydown(this.oldkey)) this.oldkey=(-1);
for (i=0;i<4;i++) {
if(keydown(i) && i in {0,2} && !this.oldkey==i) {
if (i==0 && this.pos > 0) this.pos--;
if (i==2 && this.pos < this.maxposes-1) this.pos++;
this.oldkey=i;
}
}
if (keydown(4)) select();
if (keydown(5)) this.active=0;
}

function select() {
//Doing what the pos says
if (this.pos==0) setplayerprop #c,Number 1;
if (this.pos==1) setplayerprop #c,Number 2;
if (this.pos==2) setplayerprop #c,Number 3;
if (this.pos==3) setplayerprop #c,Number 4;
if (this.pos==4) setplayerprop #c,Number 5;
}

function hideimgs() {
for (i=0;i<this.maxposes;i++) hideimg i;
}



^-- should be easy to edit it ^_^
for new poses in the menu just add them in the tokenize-part
to do something with them just add it in the
if (this.pos==<number>) code;
part
__________________
No Webhost at the moment
Reply With Quote