|
Post by The Remnant on Nov 18, 2018 7:17:04 GMT
Purpose
To clean up repetitive code (especially in guide posts) so that the post is easier to modify and update on the "Edit Post" screen.
Plan
My idea was as follows:
Create a REGEX to search for:
[WORD = RawHTML] and
[WORD]
Pseudo-Code would look something like this:
IF: [WORD = RawHTML] && [WORD] == TRUE { } [/ul]}[/div] Ideally, it'd end up that if you type this on the 'Edit Post' screen: [alexCross = <img src="http://i.imgur.com/cBEwjjA.png"> <br/> <b>Alexandrite Cross of Regeneration</b> <br/> <font color="999999">A shining cross of alexandrite, emanates a powerful force.</font> <br/> <font color="777777">° User regenerate 300 HP per turn.</font> <br/> <i>NPC Value: 10,000z</i>]
[alexCross]
[alexCross]
[alexCross]
It would show up as this on the actual post: Alexandrite Cross of RegenerationA shining cross of alexandrite, emanates a powerful force.° User regenerate 300 HP per turn. NPC Value: 10,000zAlexandrite Cross of RegenerationA shining cross of alexandrite, emanates a powerful force.° User regenerate 300 HP per turn. NPC Value: 10,000zAlexandrite Cross of RegenerationA shining cross of alexandrite, emanates a powerful force.° User regenerate 300 HP per turn. NPC Value: 10,000z Application
In the previous example, all of the formatting was defined at the top of the post. The script yanks that formatting away, then looks for every instance where its variable is called and replaces it with the formatted text. The original text [alexCross = blahblah] is intended to be removed from the post entirely. A more keen application would be to define all of your formatting variables in your first post of a thread, then in your other posts, just call it down with the assigned variable. Since the code looks for everything on the page, it's totally fine (and more intuitive in my opinion) to do it separately like this. Limitations and Problems
A ton. First is that, if you do separate your definitions from your variables, javascript seems to only run on the first page of a thread that you see. Meaning that if the thread you're posting in has 3 pages, and you start on Page 2, then change to Page 3, none of this code gets run and you'll just see a bunch of weird tags everywhere. Similarly, if you defined your variables only on Page 1, then Page 2 won't know the definition of any variables that show up on it. Third: I have no idea what would happen if two different members gave different definitions to the same variable, but I imagine it wouldn't be pretty. (IE: let's say after I made my alexCross post, Brian came in and also made his own custom alexCross variable and started using it. I suspect his would overwrite mine, but don't know for sure). Fourth: I'm not sure what would happen if a member tried making a custom variable of an existing BBCode element (IE: if I tried to make [ b = rawHTML] and then put [ b] tags everywhere, something would go awry.) Fifth: It's only a very niche feature. Only stand-alone variables would work; you wouldn't really be able to make anything with a closing code (like custom [ div][ /div]'s), at least I don't think. I experimented with a similar idea in the past and this was a recurring issue that I never quite figured out. Still, this feature could be somewhat useful for situations such as using repetitive skills or attacks in the same turn, and instead of formatting each one, only building a custom BBS Variable for that Skill/Attack and calling it by its tag multiple times. It could potentially be useful in Shops as well, and most definitely useful in Automated NPC Battles. That's all I have for now. Progress Completed Steps- N/A Current Step- Build a functional prototype [/font][/div]
|
|