Question 2:
Ok, I'm working on my Loremaster script (who basically returns the name2 value of an item for quick, and cheap item identification), and I'm having a problem sending objects. Here is my code. (NOTE: portions are copied and appended from Xuri's speech_001.js so that the loremaster can have base conversation, that's why I'm starting at the end of the else if statements)
Code: Select all
// The Loremaster conversation is appended here
else if( Speech_Array[currObj].match( /\bjob\b/i ))
{
myNPC.TurnToward( myPlayer);
myNPC.TextMessage( "I can indentify weapons and artifacts for thee.");
return;
}
else if( Speech_Array[currObj].match( /\bID\b/i ) || Speech_Array[currObj].match( /\bIdentify\b/i ))
{myNPC.TurnToward( myPlayer);
myNPC.TextMessage ( "Let me see what thou hast.");
ourObj = myPlayer.CustomTarget( 1, "Select an item to Identify" );
var IdFee = 75; //Amount of gold required to ID an object.
// var mChar = socket.currentChar; //Sets up an object that contains all of the PC's data.
var mChar = myPlayer
var gold = mChar.ResourceCount( 0xEED, 0 ); //Counts the gold carried by the PC.
if( gold >= IdFee )
{
myNPC.TextMessage ( "Debug: Does this work?");
if( ourObj.isItem )
{
myNPC ( "The true name of this " +ourObj.name+ " is " + itemObj.name2 + " ."); //ourObj.name is where the item type name is stored. ourObj.name2 is where Uox3 stores unidentified or magic names.
ourObj.name = ourObj.name2; //This sets the original name of the item to the magic name, so it is permenatnly Identified. Theoretically it should work, but a bug in the latest Uox3 release prevents me from testing.
mChar.UseResource( IdFee, 0xEED ); //takes the fee from the player.
}
}
else
myNPC.TextMessage( "Thou hast not enough funds. My talents require "+IdFee+" gold ." );
return;}
currObj++;
}
}
function onCallback1(myPlayer, ourObj ) //This is the Loremaster identify function.
{
return ourObj;
Originally I placed all of the loremaster function in the OnCallback; however, this wouldn't give me access to myNPC (so I couldn't print any messages to the loremaster).
Basically if the script is run, it give me an "ourObj" is not defined error, inside the identification loop.
Somehow, as I understand it, I need to return the object's identification properties in OnCallBack1 back to the script so that I can identify the item.
Thanks again.