
Hi I'm new to javascript and I'm trying to write a script that extracts the character ID for a given input name. Here's what i have so far. //-----------------------------------------------------------Start Script------------------------------------------------------------------------------------- on("chat:message", function(msg) { if(msg.type == "api" && msg.content.indexOf("!getid ") !== -1) { var selected = msg.selected _.each(selected, function(obj) { //create variable for Input Name var slice = msg.content.split(" ") var inputNam = slice[1] //create function that will search characters using given name var findChar = function(charNam) { var characters = findObjs({_type: "character", name: charNam}) } //use function and save to variable test var test = findChar(inputNam); //extract ID from test var id = test.get("_id"); // Output in log says test is undefined therefore has no get function //output ID log(id) }) } }); //--------------------------------------------------------------------End Script---------------------------------------------------------------------------- End game i would like to link this ID to a newly created token.