Okay, so I know how to do everything for this plugin I'm working one, EXCEPT for the notetags.
For example I'd like:
<this>
1, 2, 3, 4, 5
2, 4, 6, 8, 10
</this>
Then an if statement:
If (variable = x && notetag = 'this')
Won't look exactly like this, but should be understandable of what I'm wanting to do.
Using Note Tags (Stumped)
● ARCHIVED · READ-ONLY
-
-
Multiline notetags will require you to parse the text manually with text analysis mathematics. (you can check most of yanfly's plugins for examples on that)
I suggest you start with simple notetags, because the engine has a build-in function to analyse such notetags - check the helpfile for the details on the META function and how it is used.
If you really need multiline data, then you should know how the meta works before writing your own notetag parser. -
If (variable = x && notetag = 'this') ????
the syntaxe are not ok !
PHP:if(variable===x&¬etag === 'this'){ //stuff } -
How do you want the data to look once it's interpreted? To do this you'll need regular expressions. Not too many of em, but you'll need them to properly interpret the text.
-
I know this, like I said, it wouldn't look exactly like that. LolIf (variable = x && notetag = 'this') ????
the syntaxe are not ok !
PHP:if(variable===x&¬etag === 'this'){ //stuff }
I don't mind using simple notetags but it would stilll need to act like a multiline one. For example:
<this: 1, 2, 3, 4, 5>
<this: 2, 4, 6, 8, 10>
This would have to push the data from BOTH into an object. If it makes it easier for you guys to understand what I'm trying to do. I'm trying to push enemy actions based on a variable, and notetags (I already know how to push action Objects so they are counted in the list, I just need to figure out how to use notetags, then implement them into the code itself.)
I know there is '.meta', but from what I could read from other plugins, its mostly pre-made arguments, such as skill_id, etc etc.
EDIT:
Okay so I've figured out how to use notetags, kind of.
I have it:
<easy: 9, 3, 0, 0, 0> which is weird, because if I call: easy[0] you would think it would be 9, but it is the first space. Then the counting from the there gets a little ridiculous. But that is not the only problem I am having. If I push the values with easy[x] that correspond to the numbers in the array. It LOOKS like it pushes it, but the enemy just stops attacking. I know this works normal because if I change it to normal numbers it works fine.
Code:(function() { var diffSetting = 0; //Enemy Actions Game_Enemy.prototype.makeActions = function() { Game_Battler.prototype.makeActions.call(this); if (diffSetting === 0) var enemy = this.enemy(); var easy = enemy.meta.easy; this.enemy().actions.push( {"conditionParam1":easy[13], "conditionParam2":easy[10], "conditionType":easy[7], "rating":easy[4], "skillId":easy[1]}); if (this.numActions() > 0) { var actionList = this.enemy().actions.filter(function(a) { return this.isActionValid(a); }, this); if (actionList.length > 0) { this.selectAllActions(actionList); } } this.setActionState('waiting'); }; })(); // DO NOT TOUCH
The other issue I'm having is it just keeps pushing it into the list, I need to figure out how to do it in battle start rather than by turn. (Which shouldn't be hard). I am assuming its not just going to push multiple lines of <easy: blah blah blah> either, so I'll have to do that as well. -
Here's an example of the regular expression you'd need to parse the note tag into an array of values along with pushing the values into an object:
Furthermore, honestly, I would use the .note property of the object if you want to have multiline.
Then we could easily split it line by line. So, tell me what kind of form you'd prefer and I can help you with making it possible.
There's some ES6 syntax in here with the arrow functions, but you can replace it with a regular function; this example removes excess spaces.
http://prntscr.com/ftp5vm -
Probably use .note,
Not only am I still new to JS and MV, it took me a day or two to figure out how to even push actions. See the problem with pushing those values, is that it stays. pushing those values, say on selecting a difficulty, rather than on battlestart is probably the best thing to do. Figuring out to remove said actions if the difficulty changes, would be good too.
I would like for it to be:
<easy: 1, 2, 3, 4, 5; 1, 2, 3, 4, 5> would be cool. Otherwise separate lines. -
Here's an example using a multiline JavaScript string: http://prntscr.com/ftpmek
Edit: http://prntscr.com/ftpp94
That one doesn't remove the 7 by accident; had to fix the spacing and remove the linebreaks. -
Awesome, thanks! Though I'm not going to pretend I understand what I'm looking at lol.
I'm at work currently, so ill have to look at sometime tomorrow evening before work. the whole regExp line is confusing me really. I haven't delt with none of the weird stuff in that line before lol. I read over some of yanflys plugins yesterday morning, but didn't do much good, as im not sure what the sequence strings those plugins were using was pretty confusing lol -
Good luck!
This might help: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
Glad I could help with this. If you want a more in-depth explanation, feel free to ask. -
Good luck!
This might help: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
Glad I could help with this. If you want a more in-depth explanation, feel free to ask.
Okay so I haven't exactly tried to start using the more complex notetags, mainly because I'm trying to figure out a way for it to update the actions list on the spot, rather than going into a battle first. (Not only that it kind of hinders it because I have to make it only push once on battle start and it wouldn't do the scope of everything.).
My guess is I have to do a loop, but I'm not sure how to do a loop for this kind of thing. While I know how to do a loop, and I get the general idea of using them, but once notetags, and pushing is involved I'm a little lost.
I have this here:
Code:I ended up going with commands, because it seems easier to handle. In theory using this command would read all enemies notetags, and updating the action list accordingly.// End 'noob friendly' Customization var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function(command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'easyDiff'){ Game_Enemy.prototype.onCommandEasy = function() { if (diffSetting === 0) { var enemy = this.enemy(); var easy = enemy.meta.easy; return enemy.actions.push( {"conditionParam1":Number(easy[13]), "conditionParam2":Number(easy[10]), "conditionType":Number(easy[7]), "rating":Number(easy[4]), "skillId":Number(easy[1])}); } }; } // HP }; // end pluginCommand -
Okay, so a couple things. The plugin command does work but what it will do is add that function on to Game_Enemy or replace it with what you wrote inside.
That function will only run if you have that function declared in your code already in like the setup function of Game_Enemy. Or where it can be executed.
Next, the actual code for setting up enemies for a fight is in the BattleManager. It takes the player party and troops, then smashes them together in a battle scene when setup is complete. -
Okay, so a couple things. The plugin command does work but what it will do is add that function on to Game_Enemy or replace it with what you wrote inside.
That function will only run if you have that function declared in your code already in like the setup function of Game_Enemy. Or where it can be executed.
Next, the actual code for setting up enemies for a fight is in the BattleManager. It takes the player party and troops, then smashes them together in a battle scene when setup is complete.
Hmmm, I shouldn't need to mess with it setting up fighting. It should be able to push without doing that right? As I would need all notetags at once to be read, and pushed into the actionlist. Also if I changed something in Battlemanager wouldn't it change for both enemy and actor? -
On actors and enemies there is a property/function called isEnemy so you can check that to decide if you should read the notetag or not.