Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.
Original Source
- Original title: bsb notetag parser
- Original author: briarsweetbriar
- Original date: April 18, 2021
- Source thread: https://forums.rpgmakerweb.com/threads/bsb-notetag-parser.135617/
- Source forum path: Game Development Engines > RPG Maker Javascript Plugins > JS Plugin Releases (RMMZ)
Summary
bsb notetag parser 1.0.0 briarsweetbriar Introduction it slices, it dices, it parses notetags.
Archived First Post
bsb notetag parser 1.0.0
briarsweetbriar
briarsweetbriar
Introduction
it slices, it dices, it parses notetags.
Features
- searches text for single-line, multi-line, and js notetags
- parses notetags into js primitives (eg strings, numbers, booleans)
- also parses nested data into arrays and objects
- adds a new function to game battlers that aggregates all instances of a tag on that battler, searching their character, class, states, and equips
How to Use
install plugin as usual by adding it to `/js/plugins/`. you can then access its commands w/ `BSB.NP.<command>`.
Plugin Commands / Script Calls
BSB.NP.getMultiLineTags(note, tagName)
returns an array of all instances of that multi-line tag in the note.
BSB.NP.getMultiLineTag(note, tagName)
same as `getMultiLineTags` but only returns the first instance of the tag.
BSB.NP.getTags(note, tagName)
returns an array of all instances of that single-line tag in the note.
BSB.NP.getTag(note, tagName)
same as `getTags` but only returns the first instance of the tag.
BSB.NP.getJSTags(note, tagName)
returns an array of all instances of that js tag in the note.
BSB.NP.getJSTag(note, tagName)
same as `getJSTags` but only returns the first instance of the tag.
battler.getMultiLineTags(tagName)
returns all instances of a tag on a particular battler. for actors, the tag is searched for on the character, class, equips, and states. for enemies, the tag is searched for on the enemy and states.
JavaScript:
// getMultiLineTags/getMultiLineTag
let note = `
<Foo>
boolean: true
number: 8.88
string: other value
array: [1, 2, 3]
object: { boo: 1 }
nestedStuff: [{ boo: 1, baz: 2 }, { boo: 3, baz: 99 }]
</Foo>
<Foo>
anotherVal: 123
</Foo>
<Bar>
something: else
</Bar>
`
BSB.NP.getMultiLineTags(note, "Foo");
=> [{
boolean: true,
number: 8.88,
string: 'other value',
array: [1, 2, 3],
object: { boo: 1 },
nestedStuff: [{ boo: 1, baz: 2 }, { boo: 3, baz: 99 }]
}, {
anotherVal: 123
}]
BSB.NP.getMultiLineTag(note, "Foo");
=> {
boolean: true,
number: 8.88,
string: 'other value',
array: [1, 2, 3],
object: { boo: 1 },
nestedStuff: [{ boo: 1, baz: 2 }, { boo: 3, baz: 99 }]
}
// getTags/getTag
BSB.NP.getTags('<Foo: 1, true, bar>', "Foo");
=> [[1, true, 'bar']]
BSB.NP.getTags('<Foo: 1, true, bar> <Foo: baz> <Bar>', "Foo");
=> [[1, true, 'bar'], ['baz']]
BSB.NP.getTags('<Foo>', "Foo");
=> [[]]
BSB.NP.getTags('<Foo>', "Bar");
=> []
BSB.NP.getTag('<Foo: 1, true, bar> <Foo: baz> <Bar>', "Foo");
=> [1, true, 'bar']
BSB.NP.getTag('<Foo>', "Foo");
=> []
BSB.NP.getTag('<Foo>', "Bar");
=> undefined
// getJSTags/getJsTag
let jsNote = `
<Foo>
let a = 'foo bar';
let b = 'baz';
console.log([a, b].join(' '));
</Foo>
`
let jsTags = BSB.NP.getJSTags(jsNote, "Foo");
jsTags.forEach((tag) => eval(tag));
=> foo bar baz
let jsTag = BSB.NP.getJSTag(jsNote, "Foo");
eval(jsTag);
=> foo bar baz
Download
https://raw.githubusercontent.com/briarsweetbriar/draw-that-circle-tight/master/js/plugins/BSB_0_NotetagParser.js
Terms and Credits
MIT license. feel free to use in commercial games, adult-themed games, whatever. feel free to use it in your own plugins too, including commercial plugins. if you use it in your plugin, please credit me and link to this thread. if you use it in your game, no need to credit.
Features Mentioned
- searches text for single-line, multi-line, and js notetags
- parses notetags into js primitives (eg strings, numbers, booleans)
- also parses nested data into arrays and objects
- adds a new function to game battlers that aggregates all instances of a tag on that battler, searching their character, class, states, and equips
Downloads / Referenced Files
Log in to download
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadLicense / Terms Note
Terms and Credits MIT license. feel free to use in commercial games, adult-themed games, whatever. feel free to use it in your own plugins too, including commercial plugins. if you use it in your plugin, please credit me and link to this thread. if you use it in your game, no need to credit.
Creator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
0
replies
1
view
Topic Summary
Loading summary...