Thread: writing
View Single Post
  #6  
Old 12-14-2001, 05:57 AM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
something like this:
NPC Code:

if(playertouchsme && save[0]==0){
save[0]=1;
this.pos=1;
timeout=.05;
}

if(timeout){
disabledefmovement;
drawmenue();
drawcursor();
movement();
if(save[0]==1){timeout=.1;}
}

function drawmenue() {
this.maxposes=3; //how many selections
//showing the text
showimg 1,@Text1,x,y-((this.maxposes-1)*3);
showimg 2,@Text2,x,y-((this.maxposes-2)*3);
showimg 3,@Text3,x,y-((this.maxposes-3)*3);
}

function drawcursor() {
//showing it
showimg this.maxposes+1,@-->,x-2,y-((this.maxposes-this.pos)*3);
}

function movement() {
if(keydown(0) && this.pos > 1){this.pos--;}
if(keydown(2) && this.pos < this.maxposes){this.pos++;}
//deactivate
if(keydown(6)){
save[0]=0;
delimg();
}
//Getting position
if(keydown(4)){
save[0]=0;
enabledefmovement;
doevent();
delimg();
}
}

//for hiding all the images
function delimg() {
//hide imges
for(this.i=0;this.i < this.maxposes+1;this.i++){
hideimg this.i;
}
}

function doevent() {
if(this.pos==1){code;}
if(this.pos==2){code;}
if(this.pos==3){code;}
}



haven't tested it and it's too long I think but ok for an example...
__________________
No Webhost at the moment
Reply With Quote