JadeTheurgist

Villager
Member
Joined
Apr 19, 2020
Messages
26
Reaction score
3
First Language
English
Primarily Uses
RMMZ
Fairly simple question: for the Visustella Boost Action plugin, is there a way to reference a user's boost points in Javascript?

To go into a bit more detail, I want to see if I can create an 'Upcasting' system, where an actor can use Upcasts (in this case, Boost Points) to access more powerful versions of a spell (ie. using one Upcast would turn Fire I into Fire II, two Upcasts would turn it into Fire III). I figured if I could access the actor's BP using Javascript, I could use the Skills and States javascript notetags for visability to enable or disable the different skills to only show the one that they player could choose. Of course, that would mainly depend on if you could even access the actor's BP in javascript in the first place. Is there a javascript function designed for that?

Also, does what I'm trying to do even sound possible? I'm not very familiar with how RPG Maker populates menus and such, so i could very well be trying to do something that isn't even possible from normal engine limitations.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,920
Reaction score
6,732
First Language
English
Primarily Uses
RMMV
You can do anything - the problem is that VisuStella's plugins are obfuscated, which means we can't just look it up in the code.

If they don't provide a script call for you in the plugin instructions, you're pretty sunk - you could guess randomly at what it might be named, but that's probably pointless.

You could try following their instructions for customer service, see if they'll tell you.
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,038
Reaction score
16,850
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Support. Thank you.

 

JadeTheurgist

Villager
Member
Joined
Apr 19, 2020
Messages
26
Reaction score
3
First Language
English
Primarily Uses
RMMZ
So, I'm necroing this post after a month because I think I found the solution on the VisuStella discord and tried coding it out, but I got a syntax error.

For the first skill in a set, I've got this:
Code:
<JS Skill Visible>
\\Get the current skill id
var currID = this.id;
console.log(currID);

\\Check if user is boosting
if(user.toUseBoostPoints >= 1) {
    \\Check if user knows the next skill in line
    temp var nextID = currID++;
    if(user.isLearnedSkill(nextID)) {
        \\User knows next skill, hide current.
        visible = false;
    } else {
        \\User doesn't know next skill, continue showing current.
        visible = true;
    }
} else {
    \\If not boosting, skill will be shown.
    visible = true;
}
</JS Skill Visible>

Any in the middle look like this:
Code:
<JS Skill Visible>
\\Get the current skill's id
var currID = this.id;
console.log(currID);

\\Check if user is boosting over amount
if(user.toUseBoostPoints > 1) {
    \\Check if user knows the next skill in line
    temp var nextID = currID++;
    if(user.isLearnedSkill(nextID)) {
        \\User knows next skill, hide current.
        visible = false;
    } else {
        \\User doesn't know next skill, continue showing current.
        visible = true;
    }
} else if(user.toUseBoostPoints = 1) {
    \\If boosting the exact amount, skill will be shown
    visible = true;
} else {
     \\Otherwise, skill will not be shown.
    visible = false;
}
</JS Skill Visible>

And the skill at the end has this:
Code:
<JS Skill Visible>
\\Get the current skill's id
var currID = this.id;
console.log(currID);

\\Check if user is boosting to max
if(user.toUseBoostPoints = 3) {
    visible = true;
} else {
    \\User is not boosting to max
    visible = false;
}
</JS Skill Visible>

I'm almost positive I'm doing the bit for getting the skill ID wrong, but the rest i'm not sure due to lack of Javascript experience.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,920
Reaction score
6,732
First Language
English
Primarily Uses
RMMV
Are you intentionally putting those console.log() lines in there to try to debug? If you got that copied from someone, that's bad practice - you don't want your console littered with stuff that aren't errors.

In your first two notetags, the temp var is going to crash, that's not valid JavaScript syntax. Make it just var.
 

JadeTheurgist

Villager
Member
Joined
Apr 19, 2020
Messages
26
Reaction score
3
First Language
English
Primarily Uses
RMMZ
Yeah, the console.log() was intended to be temporary while figuring out if the code was working. Hold-over from coding in C# in Unity where being able to get debug logs were critical to me getting anywhere.

I removed console.log() as well as made the var change you mentioned, but I'm still getting a syntax error. The only note from it is 'Invalid or unexpected token'.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,920
Reaction score
6,732
First Language
English
Primarily Uses
RMMV
Personally, I would go through and get rid of extraneous braces. If you're not using an IDE or specialized text editor, it can make it harder to keep track of. There are also chunks of code you can get rid of entirely because you're dealing with booleans.

I think this makes code much easier to read, and the less you have typed, the less stuff you have to look at for potential errors.

One error is in the middle notetag, you have (user.toUseBoostPoints = 1) setting a value instead of (user.toUseBoostPoints == 1) checking a value.

Same thing in the bottom tag, you have = 3 instead of == 3.

If this still produces an invalid token, the only thing I can think of is that maybe toUseBoostPoints is supposed to be a function, so it should have parentheses after it...but I would expect that to report as a reference to an undeclared variable rather than an invalid token.

Code:
<JS Skill Visible>
visible = user.toUseBoostPoints>=1 ? user.isLearnedSkill(this.id+1) : true;
</JS Skill Visible>

The next one is almost the same:
Code:
<JS Skill Visible>

\\Check if user is boosting over amount
if (user.toUseBoostPoints > 1)  
    \\ Show if the user doesn't know the next skill in line
    visible = !user.isLearnedSkill(this.id+1);

else
    \\ If boosting the exact amount, skill will be shown, here's where an error was
    visible = user.toUseBoostPoints==1;

</JS Skill Visible>

Code:
<JS Skill Visible>
// There was also an error here
visible = user.toUseBoostPoints==3;
</JS Skill Visible>
 
Last edited:

Silenity

Veteran
Veteran
Joined
Dec 17, 2013
Messages
902
Reaction score
436
First Language
English
Primarily Uses
RMMZ
I've been looking on how to reference boost points as well.
Been trying to make it so if a user lands a crit, they gain a boost point.
But have been unsuccessful in my attempts so far.
 

JadeTheurgist

Villager
Member
Joined
Apr 19, 2020
Messages
26
Reaction score
3
First Language
English
Primarily Uses
RMMZ
If this still produces an invalid token, the only thing I can think of is that maybe toUseBoostPoints is supposed to be a function, so it should have parentheses after it...but I would expect that to report as a reference to an undeclared variable rather than an invalid token.
Tried the changes you made both with and without the added parentheses. Still getting same syntax error of Invalid token.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,920
Reaction score
6,732
First Language
English
Primarily Uses
RMMV
Please post the actual screenshot of the error (press F12, go to the Console tab).

It should give an indication of what the incorrect character actually is, as well as where.
 

JadeTheurgist

Villager
Member
Joined
Apr 19, 2020
Messages
26
Reaction score
3
First Language
English
Primarily Uses
RMMZ
SyntaxError.png
this is what the console generates when I try to run a battle test from the database with the notetags in skills actors have access to.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,920
Reaction score
6,732
First Language
English
Primarily Uses
RMMV
I think it's your use of this.id

I can't say for sure because VisuStella obfuscated their code, but in the Yanfly skill plugin the notetags for visibility are attached to the Game_BattlerBase, so "this" actually refers to the actor.

I see the documentation for the Skills and States says to use "skill" to refer to the current skill.

So replace the instances of this.id with skill.id
 

JadeTheurgist

Villager
Member
Joined
Apr 19, 2020
Messages
26
Reaction score
3
First Language
English
Primarily Uses
RMMZ
I tried replacing the instances and it's giving me the exact same error.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,920
Reaction score
6,732
First Language
English
Primarily Uses
RMMV
Then I think you should take it back to VisuStella support...with the code simplified down like I showed you, it's pretty easy to double check and I don't see anything wrong syntactically.

It seems like the only room for error is that toUseBoostPoints reference.
 

Latest Threads

Latest Profile Posts

Heading to Orlando in six days! It'll be my first time going to Disney's Typhoon Lagoon. And then my dad will pick what we do for Father's Day!
With this, I'm gonna have a good night sleep
Damn. We’ve gotten so close to 0 reports, 0 approvals a few times over the past couple weeks. Does it matter? No. Is it realistic. No? Do I rely on your reports and want everyone to keep posting. Yes. Do I 100% games? …sigh… Yes.

Ah yes, all three of my moods all at once.

Forum statistics

Threads
131,757
Messages
1,223,029
Members
173,521
Latest member
MaverickZero
Top