Also, take a look at the template Tag feature.
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#howto-custom-template-tags(scroll
down about half way).

It allows you to define a template (such as a dialog object) and call it
from another template, thereby inserting it where you want it. I think this
is the way to go for a django text adventure.

I'm also working on Django browser games and I'm glad to see others working
in this realm. Let me know when you need a beta tester and I'll be happy to
help.

-Tim


On Fri, Feb 26, 2010 at 11:42 AM, HumanSimulator <
thehumansimula...@gmail.com> wrote:

> Thank you for the help. I'm going to test it when I get a chance. Now
> that you've said it, it should have been clear to me from the start.
>
> On Feb 26, 11:38 am, Tom Evans <tevans...@googlemail.com> wrote:
> > On Fri, Feb 26, 2010 at 4:25 PM, HumanSimulator
> >
> >
> >
> >
> >
> > <thehumansimula...@gmail.com> wrote:
> > > I apologize if this has been discussed before but I did search and
> > > wasn't able to find what I'm looking for.
> >
> > > Anyways, I'm currently writing a very simplistic text adventure style
> > > game in Django and what I'm looking for is to store a template var in
> > > the database and then render it.
> >
> > > Like say I have
> >
> > > zone_text = "A shadowy figure comes up to you and says 'Hey
> > > {{ character.name }} I've been waiting for you"
> >
> > > If character.name is passed in through the context as "Hernan" I would
> > > obviously want it to show up as Hey Hernan I've been waiting for you.
> > > Instead it leaves it unevaluated though.
> >
> > > Is there already a way either in Django, or that someone has already
> > > coded that will re-parse the text and put out the correct sentence? I
> > > don't want to re-invent the wheel if it's already been done.
> >
> > > Thank you for your help.
> > > -Bob
> >
> > You will need to render it:
> >
> > from django.template import RequestContext, Template
> > zone_text = '...'
> > rendered_zone_text =
> > Template(zone_text).render(RequestContext(request, { 'foo': 'bar' })
> >
> > Cheers
> >
> > Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to