Need guide on note tags & scripting

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
Hi!  I have been trying to wrap my brain around how we can utilize the note tags to do interesting things, but I haven't found anything that really shows what the note tags are capable of or how to fully utilize them.  Google is failing me in my search for a relevant resource....


Is there a good resource to give me the run down on the power and limitations of scripting in note tags?


I should note that I am a novice when it comes to JavaScript(completed Code Academy for JS), but I am fairly familiar with the basics of loops, flow control, functions, etc from working in Unreal Engine.  


I have https://docs.google.com/spreadsheets/d/1-Oa0cRGpjC8L5JO8vdMwOaYMKO75dtfKDOetnvh7OHs/edit#gid=0 which is good, but I feel like I am missing a guide that tells me how to use that document to the fullest extent.  


For instance, in the doc you have:
$gameActors.actor(actorID).isStateAffected(stateID)



But in other tutorials/videos I see that we can do:


user.isStateAffected(stateID)


How do I know how I can reference a user, actor, weapon type, etc and where are the different reference types appropriate?  


If I see a "user.function" line, where can I expect to find the function that it is referring to?  


I probably have more questions than are reasonable to expect answers for here, so if someone could point me to the next step in the path I would greatly appreciate it!  
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
It is up to you to determine the subject of the commands.


user is normally a Game_Actor or a Game_Enemy.  The above (user.isStateAffected) assumes that user = $gameActors.actor(id) or user = $gameTroop.something-or-other has already been run.  It depends on the context, and requires you to look through the scripts to see what you have to work with.


As far as not finding any plugins that use note tags ... really?  Nothing?  Not sure what you're searching for, because there are tonnes of them.  Look for pretty much anything by Yanfly.


There is really no guide to using note-tags, because they were designed to just contain notes.  Any utilization comes from scripts/plugins, and how they're used and how they need to be created/formatted is determined by the creator of that script/plugin.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,354
Reaction score
8,533
First Language
English
Primarily Uses
RMMV
I've moved this thread to Learning JS. Please be sure to post your threads in the correct forum next time. Thank you.
 

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
It is up to you to determine the subject of the commands.


user is normally a Game_Actor or a Game_Enemy.  The above (user.isStateAffected) assumes that user = $gameActors.actor(id) or user = $gameTroop.something-or-other has already been run.  It depends on the context, and requires you to look through the scripts to see what you have to work with.


How do you determine the subject?  


How would I know if something has already been run?  

As far as not finding any plugins that use note tags ... really?  Nothing?  Not sure what you're searching for, because there are tonnes of them.  Look for pretty much anything by Yanfly.


I didn't say I couldn't find plugins that use note tags.  I said I can't find anything that tells me why plugins are using note tags in a certain way.  And usually the way plugins seem to use note tags doesn't seem to match up 100% with the script call doc, so that throws me off.

There is really no guide to using note-tags, because they were designed to just contain notes.  Any utilization comes from scripts/plugins, and how they're used and how they need to be created/formatted is determined by the creator of that script/plugin.


So the note tag can really only use scripting that is designed to be looked at by a plugin?  


I understand you can use if/else, switches, loops, etc, but how are note tags limited when it comes to what they can reach out to?  Can they only call functions found in the plugin, or can they reach functions found elsewhere in the code base?  Can they talk to or check any variable/actor/skill/etc in the game, or are there things that they can't see or reach?  
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
A notetag is just an additional way of conveying information between the user and the database, it's not a function and doesn't do anything by itself.


It is just a string, stored inside the meta object of whatever data you are typing it into.


Using them to actually execute code is done with the eval() function. If you want for "user" or "target" to make sense you'll have to define them yourself before trying to eval that notetag.


Let's take the damage formula for example; It's just like a notetag in function, only inside it's own block.


Game_Action.prototype.evalDamageFormula = function(target) {
try {
var item = this.item();
var a = this.subject(); //defining a
var b = target; //defining b
var v = $gameVariables._data; //defining v
var sign = ([3, 4].contains(item.damage.type) ? -1 : 1);
var value = Math.max(eval(item.damage.formula), 0) * sign; //actually evaling what's inside the dmg formula box
if (isNaN(value)) value = 0;
return value;
} catch (e) {
return 0;
}
};


You can see in this function that they define a (subject) b (target) and v(the variables array). That's why you are able to use a.atk * 4 -b.def * 2.


If you remove those definitions a and b don't mean anything and your damage formula doesn't do anything.


It's the same for notetags, it all depends of the context in which you call them.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Notetags do nothing without a script/plugin.  The people who write the plugins determine what they expect to see in the note tags and how it should be formatted.  If you can use if/then/else in a note tag, it's because the plugin author wrote the plugin so it looks for those things.  You would not be able to use if/then/else in all plugins.  All of my plugins, for example, expect all the data to be on a single line (no hard line breaks).  But Yanfly's plugins use opening and closing tags and multiple lines between them.


If you are going to start writing your own plugins and want to use note tags, then YOU determine exactly how those note tags will be formatted - you don't have to copy what anyone else has done.  There is no standard, you do it however it works best for you.


As for determining the context and knowing what's been run, that requires that you look into the scripts - see where the plugin call is going to be executed (is it on Game_Battler, Game_Actor, an item or a skill, or during damage calculation, etc) - then you have to find the relevant parts of the scripts and see what is available for you to use - do they already have an actor object, or an actor id that you could use to get the actor object?  What is it called?  Is it available to use in the scope of the plugin command?


What you can do with plugins is infinitely flexible, so you will never get an answer that fits ALL plugins.  All you can do is say "I'm using THIS plugin, how do I format the note tags if I want THAT to happen?"


You haven't even said if you are trying to write your own plugin or if you already have one and are just trying to come to grips with the note tags available for that plugin.  If you can be more specific about why you're asking, our answers can probably be more helpful.
 

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
Sorry for not being specific about what I am trying to accomplish.  I am basically just trying to come to grips with the note block and taking baby steps with the scripting there before even thinking about making my own plugins.  


So what I am getting from you guys is that when working in the note block I am limited by the tags I am putting code into, which is determined specifically in the plugin responsible for that specific tag.  So when trying to implement something, I would just comb over the plugin for relevant functions and see what it allows.  


And then, in the future, if I wanted to actually make a plugin(or more likely tweak existing), then I would have to find out which specific game scripts that plugin is working on?  


Thanks for helping clarify how these things tie together! :)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
If you are using a plugin written by someone else, you need to format your note tags the way they say they should be formatted.  You shouldn't have to "comb over the plugin" to find it - the author should have put everything into the help text.


If you want to make your own plugins, you can do what you want - I'm not sure what you mean by "have to find out which specific game scripts that plugin is working on" - a plugin IS a game script.  If you make a plugin, you determine what note commands are needed and what format they should be in.  If you share your plugin with others, you would add help information to show them the note tags they can use.  When you make your own plugin, you don't need to worry about what ANYone else is doing with their plugins - unless you plan to make addons or modifications of other people's plugins, and in that case you'd want to stick with their style of formatting of note tags.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,868
Messages
1,017,066
Members
137,576
Latest member
SadaSoda
Top