I had a problem recently trying to access my Kai points (monk) from scripting in Nexus reflexes. My plan is to reflexively use Kai abilities only when I have the required amount of kai. Many hours later, I figured out how to access my Kai. The Kai points of a monk, because they are class specific are only included to the gmcp of a monk. To see your class specific stats, use the following code. It will output a notice to your GUI. You can make a small alteration to output to the console instead. The output will be all of your character's vitals, including hp, mana, endurance, etc. Class specific skills are found in the final index of the resulting array, and are in a string that contains them all, seperated by commas.
let object;
let array1=[];
if (args.gmcp_method == 'Char.Vitals') // is an object containing all your vitals
{
myVitalsArray = Object.entries(args.gmcp_args); // convert myVitals to an array
display_notice('myVitalsArray: '+myVitalsArray, 'blue'); // shows all keys and values of args.gmcp_args
}
This Char.vitals object is returned by the system periodically. To force it, use a command that will require the system to check your vitals. I use 'med' or 'meditate.' The resulting 'myVitalsArray' can be parsed to grab the string at the last index, and then you can parse that to get the specific stat you need.
I am assuming the class specific stats is always the final index, [12] in the case of Shreg the monk. In my code however, I parse myVitalsArray[ ] and further parse any index returned that is '.length > 0' for '.contains( 'Kai'). That way, if a future update changes which index contains my Kai, I won't have to change the code.
Sir Shreggleton The Amazing
Shreg
Comments
{
charstats=args.gmcp_args.charstats; //first give a short name to charstats
len_charstats=charstats.length; //record its length for looping
//pos0=charstats[0];
//print(charstats[2].search("Kai")==0)
for (i=0;i<len_charstats;i++){
if (charstats[i].search("Kai")!=-1){ //replace "Kai" with name of relevant entry
//print(charstats[i]);
kaistring=charstats[i]; //this step isn't really necessary, but was useful for my understanding
kainum=kaistring.match(/\d+/); //captures the numeric part of the string
//print(kainum)
}
}
//print(kaistring)
client.set_variable('mykai',Number(kainum));
//client.set_variable('charstats', charstats);
//client.set_variable('len_charstats',len_charstats);
//client.set_variable('kaistring',kaistring);
//client.set_variable('pos0',pos0);
//client.set_variable('kainum',charstats[2].kai);
}
Not sure if Nexus can do that or not.
let array1=[];