-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"super advanced" Actions behave differently from static ones. #31
Comments
I've run into something this issue actually prevents me from doing. I'm trying to have a generated narrative remember what the hero is trying to accomplish, but the hero's goal is a list of alternatives like "money, riches, treasure" or "medicine, a cure". Since the nested narratives have different goals, I need to rename "quest" to "quest2" to keep it from being forgotten. But if I use something like "#[quest2:#quest#]tellStory#", of course that just picks one element from the list. So really what I'm wanting at the moment is a way to wrap "quest", keeping it from being evaluated; or something like #quest.rulesList# which would evaluate to the list "money, riches, treasure" for example. The thing is, I can't seem to find a viable workaround. Here are several attempts to get around the problem:
"thePattern" does what I'm trying to do, but isn't protecting the variables, so it would lose them if I recursively called "thePattern". The rest of them prematurely collapse "one" and "two" down to one possibility. The results look like this:
I really can't figure out why the "evenSmarterWrapper" approach (pattern4) didn't work! Shouldn't the "replace()" change the names before the text is even evaluated? Come to think of it, though, that method wouldn't offer any protection if I was doing recursion. A second feature that would help me out here would be double evaluation. I could have symbols like "treasure" and "cure" hold their possible paraphrasings, and keep a symbol "quest" which simply evaluates to the text "treasure" or the text "cure"; and then I could write ##quest## and get what I want. |
I'm afraid that the answer may be a bug in the Tracery code. Saving lists
of things was a bit of an afterthought, so there may well be incorrect
behavior in that. I haven't looked at that iteration of Tracery in a year
or so, so I can't really help you there. I am working on a new version of
Tracery right now, but I'm not sure if I'll get it done by this week.
Is it possible for you to perform a workaround, where you set these
variables dynamically with javascript before the story starts? Often the
best way to do very complex stuff with tracery a hybrid approach, do some
manipulations of the grammar *before* generation, etc.
…On Sat, Nov 26, 2016 at 6:23 PM, dranorter ***@***.***> wrote:
I've run into something this issue actually prevents me from doing. I'm
trying to have a generated narrative remember what the hero is trying to
accomplish, but the hero's goal is a list of alternatives like "money,
riches, treasure" or "medicine, a cure". Since the nested narratives have
different goals, I need to rename "quest" to "quest2" to keep it from being
forgotten. But if I use something like "#[quest2:#quest#]tellStory#", of
course that just picks one element from the list. So really what I'm
wanting at the moment is a way to wrap "quest", keeping it from being
evaluated; or something like #quest.rulesList# which would evaluate to the
list "money, riches, treasure" for example.
The thing is, I can't seem to find a viable workaround. Here are several
attempts to get around the problem:
{
"origin": ["#[#setVars#]thepattern#","#[#setVars#]thePatternWrapper#","#[settings:#setVars#]smarterWrapper#",
"#[settings:#setVars#]evenSmarterWrapper#"],
"thepattern": ["#one#, #one#, #one#, #one# ..(thepattern).. #two#, #two#, #two#, #two#"],
"thepattern2": ["#one2#, #one2#, #one2#, #one2# ...(thepattern2)... #two2#, #two2#, #two2#, #two2#"],
"thepattern3": ["#one3#, #one3#, #one3#, #one3# ....(thepattern3).... #two3#, #two3#, #two3#, #two3#"],
"thepattern4": ["#one4#, #one4#, #one4#, #one4# .....(thepattern4)..... #two4#, #two4#, #two4#, #two4#"],
"thePatternWrapper": ["#[one2:#one#][two2:#two#]thepattern2#"],
"smarterWrapper": ["#[#settings#]smarterWrapperHelper#"],
"smarterWrapperHelper":["#[one3:#one#][two3:#two#]thepattern3#"],
"evenSmarterWrapper": ["#[#settings.replace(one, one4).replace(two, two4)#]thepattern4#"],
"setVars": ["#setOne##setTwo#","[one:plane, car, road, boat, vacation][two:kiss, wedding, date, longing gaze, heart, cuddle]"],
"setOne": ["[one:yes, no, maybe, try again, reply hazy]","[one:cat, dog, horse, bird, puppet, seahorse, fish, espionage]","[one:1, 2, 3, 4, 5]","[one:many, some, multitudes, a number]"],
"setTwo": ["[two:ufo, pyramid, greek fire, bigfoot, Barney]","[two:life, taxes, free will, morality, missing socks, calculus]","[two:into, under, out of, between, within, acquitted of]"]
}
"thePattern" does what I'm trying to do, but isn't protecting the
variables, so it would lose them if I recursively called "thePattern". The
rest of them prematurely collapse "one" and "two" down to one possibility.
The results look like this:
no, no, no, no ...(thepattern2)... between, between, between, between
some, some, many, many ..(thepattern).. out of, acquitted of, out of,
between
((one4)), ((one4)), ((one4)), ((one4)) .....(thepattern4)..... ((two4)),
((two4)), ((two4)), ((two4))
vacation, vacation, vacation, vacation ...(thepattern2)... cuddle, cuddle,
cuddle, cuddle
((one4)), ((one4)), ((one4)), ((one4)) .....(thepattern4)..... ((two4)),
((two4)), ((two4)), ((two4))
car, boat, plane, plane ..(thepattern).. date, cuddle, kiss, longing gaze
((one4)), ((one4)), ((one4)), ((one4)) .....(thepattern4)..... ((two4)),
((two4)), ((two4)), ((two4))
road, road, road, road ...(thepattern2)... kiss, kiss, kiss, kiss
multitudes, multitudes, multitudes, multitudes ....(thepattern3)....
calculus, calculus, calculus, calculus
((one4)), ((one4)), ((one4)), ((one4)) .....(thepattern4)..... ((two4)),
((two4)), ((two4)), ((two4))
a number, a number, a number, a number ...(thepattern2)... calculus,
calculus, calculus, calculus
road, road, road, road ...(thepattern2)... kiss, kiss, kiss, kiss
((one4)), ((one4)), ((one4)), ((one4)) .....(thepattern4)..... ((two4)),
((two4)), ((two4)), ((two4))
plane, plane, plane, plane ....(thepattern3).... date, date, date, date
((one4)), ((one4)), ((one4)), ((one4)) .....(thepattern4)..... ((two4)),
((two4)), ((two4)), ((two4))
plane, road, plane, boat ..(thepattern).. longing gaze, kiss, date, wedding
seahorse, dog, bird, puppet ..(thepattern).. under, out of, out of, within
((one4)), ((one4)), ((one4)), ((one4)) .....(thepattern4)..... ((two4)),
((two4)), ((two4)), ((two4))
((one4)), ((one4)), ((one4)), ((one4)) .....(thepattern4)..... ((two4)),
((two4)), ((two4)), ((two4))
2, 2, 2, 2 ....(thepattern3).... into, into, into, into
5, 5, 5, 5 ...(thepattern2)... life, life, life, life
I really can't figure out why the "evenSmarterWrapper" approach (pattern4)
didn't work! Shouldn't the "replace()" change the names before the text is
even evaluated? Come to think of it, though, that method wouldn't offer any
protection if I was doing recursion.
A second feature that would help me out here would be double evaluation. I
could have symbols like "treasure" and "cure" hold their possible
paraphrasings, and keep a symbol "quest" which simply evaluates to the text
"treasure" or the text "cure"; and then I could write ##quest## and get
what I want.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#31 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACYbFfCCG5xOzYov4lUOvDVmUcnlpRO2ks5rCOm8gaJpZM4K8zI5>
.
|
Ah, it's good to hear that you're not sure about that! :) I'll be sure to play with the new features when they come. I suppose with what I'm doing right now, I really could just put in words like TREASURE that get replaced with something more descriptive later. Or even things like VILLAGEOFCEEDODRIN where "ceedodrin" is a word Tracery makes up for me. Either way, it's not a big deal. I decided to do NaNoGenMo just two days ago. Well-- I decided to do it back in December of 2015, but then I'd forgotten it existed until two days ago. My project is just an elaboration on the "nested story" idea from the Tracery tutorial. |
When I pass a 'correlated' bundle of information (such as "bracetypes" below) to a symbol, and then make recursive calls to that symbol, then the information gets overwritten unless I protect it with a second symbol ("brace2" below) which renames the relevant symbol. The more basic actions (like symbol:#letter# below) don't care.
This gives output with matched braces and matched brace labels, such as the following:
Technically I don't need the symbol/action "open2" since I only use the open braces before recursive calls. But if I rename all occurrances of "close2" to "close", I get this sort of output:
<A «O O> «L <O ᙅH H> O{{close}} L{{close}} <P «K K> P{{close}} A{{close}}
It's as if nested calls "borrow" the value of their parent, and then the variable is no longer defined after the call! Yet, note that the capital letters match up perfectly; they have no such issue.
Of course, how I initially wrote the code was with no protective symbol "brace2", like this:
which gives output like this:
Again, the letters match up fine, yet the different braces and brackets don't.
Another interesting example is this piece of code:
The first and second rule for symbol "origin" clobbers the value of "x" so that after it's called, the variable no longer even exists. So, using the Tracery tutorial, I can get run histories like the following:
Or like the following:
Or:
So "x" actually disappeared from the grammar! Now, I wouldn't mind being able to use actions to change the value of "x" over time. But having it just disappear isn't very useful, and I don't understand why the first two rules are different from the other two (using bare lambda or using lambda with "test").
The text was updated successfully, but these errors were encountered: