I was working through includes/bess.as trying to make the code easier to understand - so far I have done the following changes:
Throughout the code I have moved minor text variations into parser calls.
I split the dom path of bessGetBlowjob into a separate function to reduce the number of nested conditionals and to group related content together. Code used in both parts (the end of the scene and optionally a common middle part) is located in shared functions.
The second complex sex scene bessGetDoggySelected benefited so much from the added parser calls (reduced line count by 20% and removed most of the clutter between string literals) that I consider it quite readable by now. Sure some things like this bess.cocks[0].cType code is not nice to look at but changes would probably be rather specialised and limited in scope that I don't feel the gain is worth the effort.
While implementing these changes I noticed a wrong pronoun
output(". You moan in delight as [bess.name]’s thick jism bubbles and pours");
if (bTargetVag) output(" into [bess.hisHer] eagerly awaiting womb");
else output(" deep inside of you");
output(".");
a possible duplicate line end
"our starship’s shield efficiency rate."
)
);
output(". Hopefully I’ll be able to save us some credits.”</i>");
and a number of places where adjacent space chars may be written (but I'm not sure if these are merged during display - flash text is a strange mix of plain text and html markup)
I have attached the updated bess.as include and would be interested to know:
Is this generally viewed as an improvement?
Feel scene coders/writers confident to use such a syntax (see notes below)?
Is there interest in merging this into TiTS?
Can this be made better?
Notes:
[|func|a|b] is a new parser tag for a variable number of alternative texts - func is called with texts as args
{pc.pussy vagIdx} is here used as a special notation for [pc.pussy vagIdx] to change tag resolution order, so that the outer tag func can modify the the selected alternative (ie convert it to a normal tag) and resolve the modified tag
how does it work?
tag
[|bess.targetVag|fuck {pc.pussy vagIdx}|fuck {pc.asshole}]
translates into
_ownerClass.bess.targetVag("fuck {pc.pussy vagIdx}","fuck {pc.asshole}");
_ownerClass.bess.targetVag
selects either vagina or ass text depending on a var (eg bess.targetVagIdx = 3 or -1 for ass)
replaces vagIdx with var content
replaces {} with []
returns the parsed string - either of "fuck [pc.pussy 3]" or "fuck [pc.asshole]"
alternatively the following syntax could be implemented:
[|bess.targetVag|fuck [pc.pussy [|bess.targetVagIdx]]|fuck [pc.asshole]]
this resolves innermost tags first - but the end result should be the same
Advantage: normal [tags], more flexible
Disadvantage: would try to resolve [pc.pussy -1] even when there is no pc pussy and anal is selected - this could show up as trace msgs during debugging but the generated text would be discarded
ps: it might be worthwhile to allow 7z archives as attachments, had way less troubles with them in the past
Throughout the code I have moved minor text variations into parser calls.
I split the dom path of bessGetBlowjob into a separate function to reduce the number of nested conditionals and to group related content together. Code used in both parts (the end of the scene and optionally a common middle part) is located in shared functions.
The second complex sex scene bessGetDoggySelected benefited so much from the added parser calls (reduced line count by 20% and removed most of the clutter between string literals) that I consider it quite readable by now. Sure some things like this bess.cocks[0].cType code is not nice to look at but changes would probably be rather specialised and limited in scope that I don't feel the gain is worth the effort.
While implementing these changes I noticed a wrong pronoun
output(". You moan in delight as [bess.name]’s thick jism bubbles and pours");
if (bTargetVag) output(" into [bess.hisHer] eagerly awaiting womb");
else output(" deep inside of you");
output(".");
a possible duplicate line end
"our starship’s shield efficiency rate."
)
);
output(". Hopefully I’ll be able to save us some credits.”</i>");
and a number of places where adjacent space chars may be written (but I'm not sure if these are merged during display - flash text is a strange mix of plain text and html markup)
I have attached the updated bess.as include and would be interested to know:
Is this generally viewed as an improvement?
Feel scene coders/writers confident to use such a syntax (see notes below)?
Is there interest in merging this into TiTS?
Can this be made better?
Notes:
[|func|a|b] is a new parser tag for a variable number of alternative texts - func is called with texts as args
{pc.pussy vagIdx} is here used as a special notation for [pc.pussy vagIdx] to change tag resolution order, so that the outer tag func can modify the the selected alternative (ie convert it to a normal tag) and resolve the modified tag
how does it work?
tag
[|bess.targetVag|fuck {pc.pussy vagIdx}|fuck {pc.asshole}]
translates into
_ownerClass.bess.targetVag("fuck {pc.pussy vagIdx}","fuck {pc.asshole}");
_ownerClass.bess.targetVag
selects either vagina or ass text depending on a var (eg bess.targetVagIdx = 3 or -1 for ass)
replaces vagIdx with var content
replaces {} with []
returns the parsed string - either of "fuck [pc.pussy 3]" or "fuck [pc.asshole]"
alternatively the following syntax could be implemented:
[|bess.targetVag|fuck [pc.pussy [|bess.targetVagIdx]]|fuck [pc.asshole]]
this resolves innermost tags first - but the end result should be the same
Advantage: normal [tags], more flexible
Disadvantage: would try to resolve [pc.pussy -1] even when there is no pc pussy and anal is selected - this could show up as trace msgs during debugging but the generated text would be discarded
ps: it might be worthwhile to allow 7z archives as attachments, had way less troubles with them in the past