Welcome to the Achaea Forums! Please be sure to read the Forum Rules.
Access your Class Specific Stats directly with this script in Nexus

Shreg
Member Posts: 25 ✭
in Client Help
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
}
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
1
Comments
-
I saw Shreg asking for help with this one so I took my own stab at it and completed a few minutes after him. The class specific values are stored in charstats array in Char.Vitals, and each entry is a string of the form: <name>: <value>. For example, the entry for kai may be in position 2 in the array with value "Kai: 5%".if (args.gmcp_method == "Char.Vitals")
{
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);
}Keneanung's GMCP documentation (https://github.com/keneanung/GMCPAdditions) proved instructive as always.2 -
-
As in by parsing the prompt? That's a neat idea. The problem I have with it is people may want different prompt settings and it could end up difficult developing general/shareable scripts. This is probably more of an issue for people who multiclass or switch between tekura and shikudo.Besides, my code is only about 8 lines. Everything else was me figuring out Javascript and Nexus, which I left in because they could be useful for debugging in the future.0
-
The way I would personally do it is have a trigger that is in a "Monk" group that is only on then.
Not sure if Nexus can do that or not.0 -
I realized that this:let object;
let array1=[];is not actually part of the code I meant to share. It's part of the more lengthy code where I did the parsing (two loops) and display_notice() the kai %
0
Sign In to Comment.
Hail, Stranger!
Categories
- 6K All Categories
- 3K Everything Achaea
- 1.5K North of Thera
- 21 Archives of the Terraformer
- 246 The Matsuhama Arena
- 873 The Golden Dais of Creation
- 283 The Scarlattan Theatre
- 145 The Blank Canvas
- 1.9K Getting Help
- 392 General Questions
- 251 Quick Class Questions
- 1.3K Tech Support
- 299 Client Help
- 458 Curing Systems and Scripts
- 829 Off-Topic
- 250 The Wander Inn
- 579 The Universal Membrane
- 285 Class Discussions
- 285 Individual Class Sections
- 20 Alchemist
- 8 Apostate
- 29 Blademaster
- 9 Depthswalker
- 12 Druid
- 4 Infernal
- 20 Jester
- 19 Magi
- 31 Monk
- 10 Occultist
- 7 Paladin
- 7 Priest
- 28 Runewarden
- 18 Sentinel
- 26 Serpent
- 19 Shaman
- 9 Sylvan