Code: Select all
function onSpeech( myString, myPlayer, myNPC, pSock )
{
if( !myNPC.InRange( myPlayer, 2 ) )
return;
var Speech_Array = myString.split(" ");
var i = 0, currObj = 0;
for( i = 1; i <= Speech_Array.length; i++ )
{
if( Speech_Array[currObj].match( /\bHail\b/i ) || Speech_Array[currObj].match( /\bHi\b/i ) || Speech_Array[currObj].match( /\bGreet\b/i ) || Speech_Array[currObj].match( /\bHello\b/i ))
{
myNPC.TextMessage( "Greetings, I am " + myNPC.name + "." );
return; }
if( Speech_Array[currObj].match( /\bjob\b/i ))
{
myNPC.TextMessage( "I show you a card when you say 'show'." );
return; }
if( Speech_Array[currObj].match( /\bshow\b/i ))
{
var myGump = new Gump; // create a new gump
myGump.AddGump( 0, 0, 0x89C ); // add tile art
myGump.AddGump( 210, 200, 0x6B ); // add tile art
myGump.AddText( 195, 155, 0, "2" );
myGump.AddText( 280, 290, 0, "2" );
myGump.AddButton( 250, 310, 0xF7, 1, 0, 1 ); // add the "okay" button
myGump.Send( myPlayer ); // send this gump to client now
myGump.Free(); // clear this gump from uox-memory
return false;
}
currObj++;
}
}
What I am attempting to do is have the PC guess a number and then the NPC will show the card and give the PC a gold piece or something if they are right.
If anyone knows of card art hidden in the muls somewhere that I didnt see, let me know.