Script to set text YEP Message Macros

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
89
Reaction score
11
First Language
Swedish
Primarily Uses
N/A
Hello!

I have the below script that sets a variable to the description and then I have to manually type in the variable reference in the Macro 101 Text parameter.

JavaScript:
$gameVariables.setValue(437, "This will increase your magic defense by 45% for 3 turns.");
that will store the string in a plugin parameter? Specifically:
1596494626773.png
So is there some code I can use that will apply "This will increase your magic defense by 45% for 3 turns." that can be implemented the same way as I have done below?
JavaScript:
$gameVariables.setValue(437, "This will increase your magic defense by 45% for 3 turns.");
$gameVariables.setValue(438, "This will increase the target's fire resist by 35% for 3 turns.");
$gameVariables.setValue(439, "This will decrease the target's fire resist by 25% for 3 turns.");
...........................................
...........................................
$gameVariables.setValue(575, "This will decrease the target's physical defense by 60% for 3 turns.");
$gameVariables.setValue(576, "This will decrease the target's personal hit by 30% for 3 turns.");
$gameVariables.setValue(577, "This will decrease the target's physical damage by 25% for 3 turns.");
Any thoughts, even if it is something different is greatly appreciated.
 

ATT_Turan

Veteran
Veteran
Joined
Jul 2, 2014
Messages
89
Reaction score
39
First Language
English
Why are you doing two steps with making the game set the value of an in-game variable to that text string every time you include it in a message box to the user?

The intended use of this plugin is you would, for example:
Set Macro 1 Text to "This will increase your magic defense by 45% for 3 turns."
Set Macro 1 Name to "magdef"
In text that will be displayed to the user, type \magdef

I don't understand the purpose of the global variable. In fact, since the plugin is for displaying text strings, I don't think it can execute scripts at all like you're trying to do.
 

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
89
Reaction score
11
First Language
Swedish
Primarily Uses
N/A
Why are you doing two steps with making the game set the value of an in-game variable to that text string every time you include it in a message box to the user?

The intended use of this plugin is you would, for example:
Set Macro 1 Text to "This will increase your magic defense by 45% for 3 turns."
Set Macro 1 Name to "magdef"
In text that will be displayed to the user, type \magdef

I don't understand the purpose of the global variable. In fact, since the plugin is for displaying text strings, I don't think it can execute scripts at all like you're trying to do.
Hey!

Well I wouldn't put time and effort into the first part if I hadn't made sure the first part already worked. Ask the question since it does work. I was also unsure if it would work. I thought it would just read the string within the variable but it actually removed the string within the variable.

I see what you mean with the "why do this?", as I did not explain. What I do is I take all the lines in the description column and paste it directly into my plugin. So I can't do that in the actual plugin, there I would have to add each of these separately into each of the macro text boxes. And if I then made a change to my description generator I would again have to add each changed description into the macro text boxes separately. This way I just need to write in the macro text box once to refer to the variable. And then I can change every single variable with just one single copy / paste. there's about 300 skill description lines, so manually changing them each time would be a massive pain.
1596533898943.png
But if I could change it so I could with the plugin instantly add this to the macro, I don't have to add the ${gameVariables.value(xxx)} into each of the 300 macro boxes I need to fill. Since I have other stuff to work on as well, I can wait with doing that til I know if I can do the thing I am asking here! :)
 

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
89
Reaction score
11
First Language
Swedish
Primarily Uses
N/A
New message for separate clarity.

I will try using this from another post I made.
Short answer: Yes, this is possible (but the change won't be shown in the plugin manager).

In order for it to work, you will need to load your plugin before the plugin whose parameters you're writing to.

Something like this should work:
JavaScript:
for(var i = 0; i < $plugins.length; i++) {
    if($plugins[i].status && $plugins[i].name == "YEP_X_MessageMacros2") {
        let params = $plugins[i].parameters;
        params["Macro 23 Text"] = 42;
    }
}
This makes it ignore whatever you set in the plugin manager and instead use what you've coded in the mod plugin.
 

Attachments

ATT_Turan

Veteran
Veteran
Joined
Jul 2, 2014
Messages
89
Reaction score
39
First Language
English
I see the point, now, you're trying to have the text dynamically calculate as it is displayed to the user.

I still don't think the variables help you at all in this situation, I would think it's easier to just write a little plugin that has functions to produce these text strings that you can call and avoid the whole usage of the variables - but I'm glad you got it to do what you want! :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Oh man the controls in Mario Sunshine are pretty awful and I haven't even witnessed the controls without FLUDD
Lots of cool changes for Battle Castle in the works! Not just reworked dialogue, but gameplay, combat, and possibly lore changes to make things weightier.
Actor2_2 added!

I started really going in on my project April of last year... I'm just now making starting the actual game... making assets (and not even all of them), whoooo... TIME SINK.


Imagine being a pleb and using --------------------.js :LZSwink:

Forum statistics

Threads
102,947
Messages
996,209
Members
134,412
Latest member
Scop
Top