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

Adding verbs

 
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
Hugella
Guest





PostPosted: Tue Dec 09, 2003 9:21 am    Post subject: Adding verbs Reply with quote

Can 'new' verbs i want to include in my game be #included in a file (#include myverbs.g) or do they have to be declared in the main game file (before the grammar?)
Back to top
Kent



Joined: 27 Jun 2003
Posts: 119

PostPosted: Tue Dec 09, 2003 12:20 pm    Post subject: Either Reply with quote

They can be #included in a separate file, either before or after the game grammar. Guilty Bastards, for instance, has this in guilty.hug:

Code:
! Grammar must be included before anything else:
!
#include "verblib.g"            ! normal verb library grammar
#include "gb.g"                 ! game grammar

#include "moreverb.g"

Now, what this means is that verbs in verblib.g take precedence over gb.g. If you wanted to override verblib.g's grammar, you'd need to define some grammar before it.

Basically think of #included files as being all part of the same big source file--that's the way the compiler looks at it, anyway.
Back to top
View user's profile Send private message
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Tue Dec 09, 2003 9:00 pm    Post subject: Reply with quote

Hey, can you have conditions for "living" and "object" for the same verb? I.E. -- and I don't mean that crappy Browser!!!!


Code:

verb "spit"
   *                  DoVague
   * living               DoSpitLiving
   * "on" living               DoSpitLiving
   * "at" living               DoSpitLiving
   * object               DoSpit
   * "on" object               DoSpit
   * "at" object               DoSpit




routine DoSpitLiving
{
   if object.conscious = 0
   {
      "I hock a sizeable loogie and let go."
   }
   else
   {
      "Being brought up by Old Man Duffy gets in the way of spitting in a face!"
   }
}




routine DoSpit
{
   "I try to keep the city clean, eh?"
}





... Anyway, if I try to run all that I see that it handles me trying to spit on a living object OK, but it won't invoke DoSpit if I try to spit on an object.


EDIT! Also, if I try to handle talking to an object and talking to a living entity in DoTalk (for instance, I have a skull in the game and I want the PC to be able to try to talk to it, but I don't want that skull to get any of the other privledges that the living tag offers) it'll mess up in the same way.

Is there a way to make it so that I can have different default commands for spitting on animate and inanimate things?
_________________
the dark and gritty...Ice Cream Jonsey!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Kent



Joined: 27 Jun 2003
Posts: 119

PostPosted: Tue Dec 09, 2003 10:23 pm    Post subject: Workaround Reply with quote

Yeah, as it is now, the use of an attribute as an object placeholder will interrupt parsing if it gets a grammar match whether or not the object has that attribute--i.e., you'll be passed either to the verbroutine or to a parser error. This is not ideal and should probably be changed at some point (probably by improving the parser's notion of 'best error' and having it work more intelligently through a number of possible grammar matches).

What I would recommend doing is something like:

Code:
* object          DoSpitGeneral

where DoSpitGeneral would do the dispatch for you, along the lines of:

Code:
routine DoSpitGeneral
{
     if object is living
          return DoSpitLviing
     else
          return DoSpit
}

Or something like that. There are a number of different ways to go about this (including just putting the test in the DoSpit[Living] routine, etc.) But this way probably abstracts it best.
Back to top
View user's profile Send private message
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Wed Dec 10, 2003 1:02 am    Post subject: Reply with quote

You da man, Kent. Thanks.

Now, to code the horrible wasting disease that my protagonist's spit will contain!!!
_________________
the dark and gritty...Ice Cream Jonsey!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Brazillio
Guest





PostPosted: Wed Dec 10, 2003 2:35 pm    Post subject: Reply with quote

I'm pregnant and I don't know who the father is! It could be any of you! Help me, Hugo!
Back to top
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