PDA

View Full Version : Clear text?



Hansol
February 13th, 2007, 11:28 PM
im trying to create a npc so when the charater goes over and presses shift the text shows up in the text box, it works and when i tell it to clear when it goes over it clears it also, but it keeps it clear so you cannot talk to another npc heres the code.. so basically i dont know how to clear the text without clearing it completely just making it equal nothing for the moment until i talk to another npc. this is how many code is right now its only playing the second player on enter frame dunno why and when i put it both on one... weird stuff happens.

player.onEnterFrame = function() {
if (this.hitTest(map.joe) & Key.isDown(Key.SHIFT)) {
gametext = "Hi, please continue down the road to town!";
} else if (!this.hitTest(map.joe)) {
gametext = "";
}

};
player.onEnterFrame = function() {
if (this.hitTest(map.jim) & Key.isDown(Key.SHIFT)) {
gametext = "Hi,I buy and sell potions!";
} else if (!this.hitTest(map.jim)) {
gametext = "";
}
};i just tried something like but then the shift butten must be held down ><

player.onEnterFrame = function() {
if (this.hitTest(map.joe) & Key.isDown(Key.SHIFT)) {
gametext = "Hi, please continue down the road to town!";
} else if (this.hitTest(map.jim) & Key.isDown(Key.SHIFT)) {
gametext = "Hi,I buy and sell potions!";
} else {
gametext = "";
}
};




Thanks :D

SacrificialLamb
February 14th, 2007, 03:33 AM
the first code only works for one NPC because the second onEnterFrame over wrights the first one. But the second code is right but you need to fix the holding down **** thing so make the last else a else if player move or some thing like that

else if ( Key.isDown(Key.UP) || Key.isDown(Key.DOWN) || Key.isDown(Key.LEFT || Key.isDown(Key.RIGHT)){
gametext = "";
}
Or some other value that will occurs only after the player moves

Hansol
February 14th, 2007, 09:33 AM
thx so much i got it :D i just put gametext = ""; under his movement keys.