FAQ Search Memberlist Usergroups
Jolt Country Forum Index
Register Profile Log in to check your private messages Log in
Log in Log in

Name property

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Jolt Country Forum Index -> Hugo's House of Horrors
View previous topic :: View next topic  
Author Message
Bainespal



Joined: 09 Jul 2010
Posts: 151

PostPosted: Sat May 21, 2011 7:24 am    Post subject: Name property Reply with quote

I had a condition in the name property of my NPC that would return a different string depending on whether the NPC had the attribute "special". In the after property routine, I specified an ASK topic that would have the NPC reveal her name, thus changing the name property by giving the NPC the "special" attribute.

Somehow, this code was apparently causing the name property to be displayed after every turn when the NPC was in the location! At least, that's what it looked like. For instance, a wait command would result in something like "young womanTime passes."

I have no idea why the name property was being called every turn. However, when I changed the code to a much more logical solution -- simply changing the value of the name property in the after routine -- everything worked. I'm glad I thought of the better way, but why does putting a condition in the name property produce such bizarre results? Are all name properties called every in their location?

Just a topic for discussion/consideration. :-)
Back to top
View user's profile Send private message
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Sat May 21, 2011 5:16 pm    Post subject: Reply with quote

I'd have to see the code. It sounds like something is wrong, yeah.
Back to top
View user's profile Send private message AIM Address
Roody not logged in
Guest





PostPosted: Sun May 22, 2011 1:56 pm    Post subject: Reply with quote

Thought I'd code this up just for kicks:

Code:

character girl "girl"
{
   article {
      if self is special
         return false
      else
         return "the"
      }
   noun "girl", "sally"
   after
      {
      object DoAsk
         {
         select xobject
            case girlname : {
                  if self is special
                     {
                     "\"I told you my name is Sally.\""
                     return true
                     }
                  else
                     {
                     self.name = "Sally"
                     self is special
                     "\"My name is Sally.\""
                     return true
                     }
                  }
         }
      }
   in STARTLOCATION
   is not transparent
}

object girlname "name"
{
   adjective "her"
   noun "name"
   is known
}


There are probably better ways to do it.
Back to top
Roody still not logged in
Guest





PostPosted: Mon May 23, 2011 1:13 pm    Post subject: Reply with quote

In the example above, of course, you can take out the "is not transparent" line. That's some legacy code from when I was trying to put the girlname object in the girl character since I figured Hugo might understand "ask girl about her name" without any help. It seems that assumption might be wrong, but in any case, it bugged me that the hypothetical player could then do things like >X NAME so I changed it.

Also, I should have made girl a female_character, of course. So yeah.
Back to top
Bainespal



Joined: 09 Jul 2010
Posts: 151

PostPosted: Thu May 26, 2011 3:24 pm    Post subject: Reply with quote

That code is laid out very similarly to the way my code originally was, but it gives no problems when I compile it in a a test shell. What might be informative would be to add this test character into my game, into the same room, and see if the problem I encountered reoccurs. However, I'm reluctant to do that, because I don't want to mess anything up.

I seem to be able to kill Hugo even when it ordinarily should know what it's doing! :-\
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Jolt Country Forum Index -> Hugo's House of Horrors All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001 phpBB Group

Theme by Kage Musha - RPG Garden

Copyrights and trademarks are all of the belonging company. No copyright Infringement intended