by Guest » Wed Dec 05, 2012 4:43 pm
Thanks again for the quick reply, robert.
robert wrote:I actually have even more questions after your last post, but I'll just tackle 'em one at a time.

I can imagine. Sorry...
robert wrote:The HTML syntax highlighter doesn't highlight annotations, the only language that does that currently is Java. You'd have to add annotation highlighting to your TokenMaker flex file (which would be easy, just copy it from JavaTokenMaker.flex). And yes, it's easy to highlight both.
Nice. I think I did that already but haven't compiled it into the library my application uses.
robert wrote:That helps a little. My question was basically, is the example below *also* valid?
- Code: Select all
[line for script]
<html>
[line for script]
@@
[line for script]
[line for script]
!!
</html>
Hmm, it wouldn't be I'm afraid. The reason for encapsulating stuff between @@/!! is because users have been using a user defined highlighting scheme for Notepad++. The actual application didn't have anything resembling a good editor, so someone came up with a process to extract a script's contents, grab the properties of its origin and used it as string properties/annotations coming after @@. This was to distinguish one script from another since his "plug-in" allowed for loading of multiple scripts at once. So the lines for @@ and !! aren't actually part of the script's syntax, they're just there to divide code blocks from different scripts/macros from each other on N++. Here's a sample of how it looks (sorry it's a bit long):
- Code: Select all
@@ @Frame: Combat
@PROPS@ fontColor=black ; autoExecute=true ; fontSize=1.00em ; sortBy= ; color=default ; playerEditable=false ; applyToSelected=false ; group=Windows ; tooltip= ; minWidth= ;
[h, code: {
[if(isFrameVisible("Proxy Window")): closeFrame("Proxy Window")]
[current = getName(getInitiativeToken())]
[jsonChar = getLibProperty(current, "Lib: Properties")]
[stance = json.get(jsonChar, "stance")]
[charSkills = json.get(jsonChar, "charSkills")]
[charSkillKeys = json.get(jsonChar, "charSkillKeys")]
[magic = !json.isEmpty(json.get(jsonChar, "spells"))]
[kata = !json.isEmpty(json.get(jsonChar, "kata"))]
[kiho = !json.isEmpty(json.get(jsonChar, "kiho"))]
[maho = !json.isEmpty(json.get(jsonChar, "maho"))]
[tattoo = !json.isEmpty(json.get(jsonChar, "tattoo"))]
[guard = !json.contains(json.get(jsonChar, "expirationQueue"), "Guard")]
[classCheck = json.get(jsonChar, "characterClass")]
[iaijutsuCheck = json.contains(charSkills, "Iaijutsu")]
[actualVoid = json.get(jsonChar, "actualVoid")]
[checkGrapple()]
[grappleType = json.get(macro.return, "type")]
[grappleCheck = if(actualVoid > 0 || grappleType, 1, 0)]
[handsCheck = json.get(jsonChar, "hands")]
[largeWeaponInHand = 0]
[proneCheck = 0]
[attman = 0]
[hands = !json.isEmpty(handsCheck)]
[if(hands): combine = json.merge(handsCheck), invCheck); combine = json.get(jsonChar, "inventory")]
[swordCheck = if(!json.isEmpty(getItemDetails(combine, json.append('[]', "Katana", "Wakizashi"), current)), 1, 0)]
[swordSpellCheck = 0]
[if(classCheck == "Shugenja"), code:{
[swordSpellCheck = json.contains(json.get(jsonChar, "memorizedSpells"), "Katana of Fire")]
[swordCheck = if(swordCheck || swordSpellCheck, 1, 0)]
}]
}]
[h, if(hands), code: {
[getItemDetails(handsCheck, json.append('[]', "Weapon"), current)]
[foreach(item, macro.return), code: {
[weaponCheck = json.contains(json.get(item, "keyWords"), "Large")]
[if(weaponCheck && largeWeaponinHand == 0): largeWeaponInHand = 1]
[skill = json.get(item, "skill")]
[if(skill != ""): attman = if(json.contains(charSkills, skill), 1, 0); '<!-- -->']
}]
};
{
[attman = if(json.contains(charSkills, "Jiujitsu"), 1, 0)]
}]
[h, code: {
[token(current), if(getState("Prone") && largeWeaponInHand): proneCheck = 1; proneCheck = 0]
[fullhands = json.length(handsCheck)]
[pickup = !json.isEmpty(json.get(jsonChar, "pickup"))]
[inventory = json.get(jsonChar, "inventory")]
[small = 0]
[medium = 0]
[large = 0]
[items = 0]
}]
[h, if(!json.isEmpty(inventory)), code: {
[getItemDetails(inventory, '[]', current)]
[readyItemsCheck = !json.isEmpty(macro.return)]
[if(readyItemsCheck): evalMacro('
[foreach(item, macro.return), code:{
[keyWords = json.get(item, "keyWords")]
[if(json.contains(keyWords, "Small") && small == 0): small = 1]
[if(json.contains(keyWords, "Medium") && medium == 0): medium = 1]
[if(json.contains(keyWords, "Large") && large == 0): large = 1]
}]
'); '<!-- -->']
[getItemDetails(handsCheck, json.append('[]', "Activated"), current)]
[items = !json.isEmpty(macro.return)]
};
{
'<!-- -->'
}]
[h, code: {
[ta = json.get(jsonChar, "totalActions")]
[rmLink=macroLinkText("Process: Combat Options@Lib: Scripts", "none")]
}]
[frame("Combat Options"): {
<html>
<head>
</head>
<body>
<form action="[r:rmLink]" method="json">
<table border="1">
<tr border="1" colspan="7" align="center"><th colspan="7" border="1" align="center" style="background-color:white"><b><u>General Actions</u></b></th></tr>
<tr border = "1" colspan="7" align="center">
[token(current), if(ta < 2 && getState("Prone")): '<input type="submit" name="btncombat" value= "Stand up">']
[if(ta == 0 && (stance == "Full Attack" || stance == "Attack") && !proneCheck): '<input type="submit" name="btncombat" value= "Attack">']
[if(ta == 0 && (stance == "Full Attack" || stance == "Attack") && attman && !proneCheck): '<input type="submit" name="btncombat" value= "Attack + Maneuvers">']
[if(ta == 0 && grappleCheck && (stance == "Full Attack" || stance == "Attack") && !proneCheck): '<input type="submit" name="btncombat" value= "Grapple">']
[if(guard && ta < 2 && stance != "Full Attack"): '<input align="center" type="submit" name="btncombat" value= "Guard">']
[if((actualVoid > 0 || iaijutsuCheck) && swordCheck && !getState("Dazed", current) && ta == 0 && (stance == "Full Attack" || stance == "Attack") && !proneCheck):'<input type="submit" name="btncombat" value= "Iaijutsu Challenge">']
</tr>
<tr border="1" colspan="7" align="center"><th border="1" colspan ="7" align="center"style="background-color:white"><b><u>Special Abilities</u></b></th></tr>
<tr border="1" colspan="7" align="center">
[if(ta == 0 && magic && (stance != "Full Attack")): '<input type="submit" name="btncombat" value="Spellcasting">']
[if(ta <= 1 && kata): '<input type="submit" name="btncombat" value= "Kata">']
[if(ta <= 1 && kiho): '<input type="submit" name="btncombat" value= "Kiho">']
[if(ta == 0 && maho): '<input type="submit" name="btncombat" value= "Maho">']
[if(tattoo): '<input type="submit" name="btncombat" value= "Tattoos">']
</tr>
<tr border="1" colspan="7" align="center"><th colspan ="7" align="center"style="background-color:white"><b><u>Equipment Actions</u></b></th></tr>
<tr border="1" colspan="7" align="center">
[if(hands && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Drop Held Item">']
[if(ta <= 1 && pickup && fullhands < 2 && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Pickup Item">']
[if(ta <= 1 && large && fullhands == 0 && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Ready: Large Item">']
[if(ta <= 1 && medium && fullhands < 2 && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Ready: Medium Item">']
[if(small && fullhands < 2 && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Ready: Free or Small Item">']
[if(ta <= 1 && hands && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Stash Held Item">']
[if(ta <= 1 && items && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Use Item">']
</tr>
<tr border="1" colspan="7" align="center"><th colspan ="7" align="center"style="background-color:white" border = "1"><b><u>Misc. Actions</u></b></th></tr>
<tr border="1" colspan="7" align="center">
[h: length = json.length(getLibProperty("jsonDelay", "Lib: Properties"))]
[h, if(getCurrentInitiative() != initiativeSize() - 1): end = 0; end = 1]
[if(ta < 2 && length < initiativeSize() - getCurrentInitiative() - 1 && !end): '<input type="submit" name="btncombat" value= "Delay Turn">']
['<input type="submit" name="btncombat" value= "End Turn">']
[if(ta == 0 && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Use Skill">']
</tr>
</table>
</form>
</body>
</html>
}]
!!
Actually, html can also be found outside script lines bound by [] because the whole thing get's rendered/outputted on an HTML pane.
robert wrote:And if so, what's considered a fold region? I'm assuming the html tag's contents, with a nested one for the @@/!! pair?
So, essentiallly, it would be the other way around. Everything is bound within @@/!! and if there're html tags (not within []) then these would be nested. Again, what's important really is the folding between @@/!!. html folding would really be nice, but it's not something we have, even in the N++ UDL.
robert wrote:That will happen as long as your TokenMaker's getLineCommentStartAndEnd() method returns { "<!--", "-->" }. HTMLTokenMaker does this out of the box.
Yes, thank you. I got that part going at the start since it was so straightforward.
robert wrote:HTML already does this, at least, for HTML attributes. Are you asking for this with a string type outside of HTML tag attributes? This is doable by copying the implementation that's already there.
I'll take another crack at it. I was looking at the Java implementation, you see, since /** */ and /* */, was what I am used to.
robert wrote:I hope to do it soon (should be easy), but I've been having trouble finding time to devote to the project lately, unfortunately. But I believe I should be able to get to it in the next few days.
I understand completely. This project I'm working on is one of those things that are satisfying to do, but sadly do not bring home the bacon

.
Thank you once again.
Thanks again for the quick reply, robert.
[quote="robert"]I actually have even more questions after your last post, but I'll just tackle 'em one at a time.
[/quote]
:lol: I can imagine. Sorry...
[quote="robert"]
The HTML syntax highlighter doesn't highlight annotations, the only language that does that currently is Java. You'd have to add annotation highlighting to your TokenMaker flex file (which would be easy, just copy it from JavaTokenMaker.flex). And yes, it's easy to highlight both.
[/quote]
Nice. I think I did that already but haven't compiled it into the library my application uses.
[quote="robert"]
That helps a little. My question was basically, is the example below *also* valid?
[code]
[line for script]
<html>
[line for script]
@@
[line for script]
[line for script]
!!
</html>
[/code]
[/quote]
Hmm, it wouldn't be I'm afraid. The reason for encapsulating stuff between @@/!! is because users have been using a user defined highlighting scheme for Notepad++. The actual application didn't have anything resembling a good editor, so someone came up with a process to extract a script's contents, grab the properties of its origin and used it as string properties/annotations coming after @@. This was to distinguish one script from another since his "plug-in" allowed for loading of multiple scripts at once. So the lines for @@ and !! aren't actually part of the script's syntax, they're just there to divide code blocks from different scripts/macros from each other on N++. Here's a sample of how it looks (sorry it's a bit long):
[code]@@ @Frame: Combat
@PROPS@ fontColor=black ; autoExecute=true ; fontSize=1.00em ; sortBy= ; color=default ; playerEditable=false ; applyToSelected=false ; group=Windows ; tooltip= ; minWidth= ;
[h, code: {
[if(isFrameVisible("Proxy Window")): closeFrame("Proxy Window")]
[current = getName(getInitiativeToken())]
[jsonChar = getLibProperty(current, "Lib: Properties")]
[stance = json.get(jsonChar, "stance")]
[charSkills = json.get(jsonChar, "charSkills")]
[charSkillKeys = json.get(jsonChar, "charSkillKeys")]
[magic = !json.isEmpty(json.get(jsonChar, "spells"))]
[kata = !json.isEmpty(json.get(jsonChar, "kata"))]
[kiho = !json.isEmpty(json.get(jsonChar, "kiho"))]
[maho = !json.isEmpty(json.get(jsonChar, "maho"))]
[tattoo = !json.isEmpty(json.get(jsonChar, "tattoo"))]
[guard = !json.contains(json.get(jsonChar, "expirationQueue"), "Guard")]
[classCheck = json.get(jsonChar, "characterClass")]
[iaijutsuCheck = json.contains(charSkills, "Iaijutsu")]
[actualVoid = json.get(jsonChar, "actualVoid")]
[checkGrapple()]
[grappleType = json.get(macro.return, "type")]
[grappleCheck = if(actualVoid > 0 || grappleType, 1, 0)]
[handsCheck = json.get(jsonChar, "hands")]
[largeWeaponInHand = 0]
[proneCheck = 0]
[attman = 0]
[hands = !json.isEmpty(handsCheck)]
[if(hands): combine = json.merge(handsCheck), invCheck); combine = json.get(jsonChar, "inventory")]
[swordCheck = if(!json.isEmpty(getItemDetails(combine, json.append('[]', "Katana", "Wakizashi"), current)), 1, 0)]
[swordSpellCheck = 0]
[if(classCheck == "Shugenja"), code:{
[swordSpellCheck = json.contains(json.get(jsonChar, "memorizedSpells"), "Katana of Fire")]
[swordCheck = if(swordCheck || swordSpellCheck, 1, 0)]
}]
}]
[h, if(hands), code: {
[getItemDetails(handsCheck, json.append('[]', "Weapon"), current)]
[foreach(item, macro.return), code: {
[weaponCheck = json.contains(json.get(item, "keyWords"), "Large")]
[if(weaponCheck && largeWeaponinHand == 0): largeWeaponInHand = 1]
[skill = json.get(item, "skill")]
[if(skill != ""): attman = if(json.contains(charSkills, skill), 1, 0); '<!-- -->']
}]
};
{
[attman = if(json.contains(charSkills, "Jiujitsu"), 1, 0)]
}]
[h, code: {
[token(current), if(getState("Prone") && largeWeaponInHand): proneCheck = 1; proneCheck = 0]
[fullhands = json.length(handsCheck)]
[pickup = !json.isEmpty(json.get(jsonChar, "pickup"))]
[inventory = json.get(jsonChar, "inventory")]
[small = 0]
[medium = 0]
[large = 0]
[items = 0]
}]
[h, if(!json.isEmpty(inventory)), code: {
[getItemDetails(inventory, '[]', current)]
[readyItemsCheck = !json.isEmpty(macro.return)]
[if(readyItemsCheck): evalMacro('
[foreach(item, macro.return), code:{
[keyWords = json.get(item, "keyWords")]
[if(json.contains(keyWords, "Small") && small == 0): small = 1]
[if(json.contains(keyWords, "Medium") && medium == 0): medium = 1]
[if(json.contains(keyWords, "Large") && large == 0): large = 1]
}]
'); '<!-- -->']
[getItemDetails(handsCheck, json.append('[]', "Activated"), current)]
[items = !json.isEmpty(macro.return)]
};
{
'<!-- -->'
}]
[h, code: {
[ta = json.get(jsonChar, "totalActions")]
[rmLink=macroLinkText("Process: Combat Options@Lib: Scripts", "none")]
}]
[frame("Combat Options"): {
<html>
<head>
</head>
<body>
<form action="[r:rmLink]" method="json">
<table border="1">
<tr border="1" colspan="7" align="center"><th colspan="7" border="1" align="center" style="background-color:white"><b><u>General Actions</u></b></th></tr>
<tr border = "1" colspan="7" align="center">
[token(current), if(ta < 2 && getState("Prone")): '<input type="submit" name="btncombat" value= "Stand up">']
[if(ta == 0 && (stance == "Full Attack" || stance == "Attack") && !proneCheck): '<input type="submit" name="btncombat" value= "Attack">']
[if(ta == 0 && (stance == "Full Attack" || stance == "Attack") && attman && !proneCheck): '<input type="submit" name="btncombat" value= "Attack + Maneuvers">']
[if(ta == 0 && grappleCheck && (stance == "Full Attack" || stance == "Attack") && !proneCheck): '<input type="submit" name="btncombat" value= "Grapple">']
[if(guard && ta < 2 && stance != "Full Attack"): '<input align="center" type="submit" name="btncombat" value= "Guard">']
[if((actualVoid > 0 || iaijutsuCheck) && swordCheck && !getState("Dazed", current) && ta == 0 && (stance == "Full Attack" || stance == "Attack") && !proneCheck):'<input type="submit" name="btncombat" value= "Iaijutsu Challenge">']
</tr>
<tr border="1" colspan="7" align="center"><th border="1" colspan ="7" align="center"style="background-color:white"><b><u>Special Abilities</u></b></th></tr>
<tr border="1" colspan="7" align="center">
[if(ta == 0 && magic && (stance != "Full Attack")): '<input type="submit" name="btncombat" value="Spellcasting">']
[if(ta <= 1 && kata): '<input type="submit" name="btncombat" value= "Kata">']
[if(ta <= 1 && kiho): '<input type="submit" name="btncombat" value= "Kiho">']
[if(ta == 0 && maho): '<input type="submit" name="btncombat" value= "Maho">']
[if(tattoo): '<input type="submit" name="btncombat" value= "Tattoos">']
</tr>
<tr border="1" colspan="7" align="center"><th colspan ="7" align="center"style="background-color:white"><b><u>Equipment Actions</u></b></th></tr>
<tr border="1" colspan="7" align="center">
[if(hands && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Drop Held Item">']
[if(ta <= 1 && pickup && fullhands < 2 && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Pickup Item">']
[if(ta <= 1 && large && fullhands == 0 && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Ready: Large Item">']
[if(ta <= 1 && medium && fullhands < 2 && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Ready: Medium Item">']
[if(small && fullhands < 2 && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Ready: Free or Small Item">']
[if(ta <= 1 && hands && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Stash Held Item">']
[if(ta <= 1 && items && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Use Item">']
</tr>
<tr border="1" colspan="7" align="center"><th colspan ="7" align="center"style="background-color:white" border = "1"><b><u>Misc. Actions</u></b></th></tr>
<tr border="1" colspan="7" align="center">
[h: length = json.length(getLibProperty("jsonDelay", "Lib: Properties"))]
[h, if(getCurrentInitiative() != initiativeSize() - 1): end = 0; end = 1]
[if(ta < 2 && length < initiativeSize() - getCurrentInitiative() - 1 && !end): '<input type="submit" name="btncombat" value= "Delay Turn">']
['<input type="submit" name="btncombat" value= "End Turn">']
[if(ta == 0 && stance != "Full Attack"): '<input type="submit" name="btncombat" value= "Use Skill">']
</tr>
</table>
</form>
</body>
</html>
}]
!!
[/code]
Actually, html can also be found outside script lines bound by [] because the whole thing get's rendered/outputted on an HTML pane.
[quote="robert"]And if so, what's considered a fold region? I'm assuming the html tag's contents, with a nested one for the @@/!! pair?[/quote]
So, essentiallly, it would be the other way around. Everything is bound within @@/!! and if there're html tags (not within []) then these would be nested. Again, what's important really is the folding between @@/!!. html folding would really be nice, but it's not something we have, even in the N++ UDL.
[quote="robert"]That will happen as long as your TokenMaker's getLineCommentStartAndEnd() method returns { "<!--", "-->" }. HTMLTokenMaker does this out of the box.[/quote]
Yes, thank you. I got that part going at the start since it was so straightforward.
[quote="robert"]HTML already does this, at least, for HTML attributes. Are you asking for this with a string type outside of HTML tag attributes? This is doable by copying the implementation that's already there.
[/quote]
I'll take another crack at it. I was looking at the Java implementation, you see, since /** */ and /* */, was what I am used to.
[quote="robert"]I hope to do it soon (should be easy), but I've been having trouble finding time to devote to the project lately, unfortunately. But I believe I should be able to get to it in the next few days.[/quote]
I understand completely. This project I'm working on is one of those things that are satisfying to do, but sadly do not bring home the bacon :lol:.
Thank you once again.