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

plug object in / plug in object

 
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
Tdarcos



Joined: 16 May 2008
Posts: 4441
Location: University Park, Maryland

PostPosted: Wed Sep 26, 2012 11:26 am    Post subject: plug object in / plug in object Reply with quote

NB: for the purposes of this article objects are entered in UPPER CASE even though the user doesn't have to type it that way.

Here's the problem. I want the user to be able to say "plug TV in" or "plug in TV" as well as the other responses.
Code:

verb "plug","unplug","plugin","connect"
   *                              DoVague

verb "plugin"
   * object                        DoPlug
   
verb "plug","connect"   
   * object "in"                     DoPlug
   * "in" object                      DoPlug
   * object "into"/"in" anything         DoPlug
   * object                        DoPlug

plug in TV works, plug TV in socket also works (socket is the appropriate object and is there strictly for syntactic sugar.)

plug TV in returns Cannot plug anything into in

moving object "into"/"in" before object "in" in this list of responses does not change the result.

Ordering of verb commands? change in method?
_________________
The lessons of history teach us - if they teach us anything - that no one learns the lessons of history.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
loafingcoyote



Joined: 04 Jan 2012
Posts: 89
Location: Texas

PostPosted: Wed Sep 26, 2012 12:52 pm    Post subject: Reply with quote

It looks like Hugo is trying to use "in" as the xobject. Replacing PreParse can be very helpful when grammar can't be defined normally.

Code:

replace PreParse
{
   if word[1] = "plug" and word[3] = "in"
   {
      local wordtwo

      wordtwo = word[2]

      word[2] = word[3]
      word[3] = wordtwo
   }
}


Here you're just switching the order of the second and third word when the above conditions apply. Then the parser takes over again and runs it as "plug in TV", as opposed to "plug TV in".

This solution works and I don't think it should cause any problems.

-lc
Back to top
View user's profile Send private message
Tdarcos



Joined: 16 May 2008
Posts: 4441
Location: University Park, Maryland

PostPosted: Wed Sep 26, 2012 1:05 pm    Post subject: Reply with quote

loafingcoyote wrote:

Code:

replace PreParse

This solution works and I don't think it should cause any problems.

Bzzzzzt! Causes an excrement-load of errors. (Or for the PG version, it causes a shitload of errors). I put the replace routine in my tripkey.h file and the following happens.

\\buffalo\programming\zenith\tripkey\tripkey.h:536: Error: Syntax error: preparse
\\buffalo\programming\zenith\tripkey\tripkey.h:536: Error: Not an object or routine: preparse
\\buffalo\programming\zenith\tripkey\tripkey.h:537: Error: Unknown compiler directive: {
\\buffalo\programming\zenith\tripkey\tripkey.h:538: Error: Unknown compiler directive: if
\\buffalo\programming\zenith\tripkey\tripkey.h:539: Error: Unknown compiler directive: {
\\buffalo\programming\zenith\tripkey\tripkey.h:540: Error: Unknown compiler directive: local
\\buffalo\programming\zenith\tripkey\tripkey.h:542: Error: Unknown compiler directive: wordtwo
\\buffalo\programming\zenith\tripkey\tripkey.h:544: Error: Unknown compiler directive: word
\\buffalo\programming\zenith\tripkey\tripkey.h:545: Error: Unknown compiler directive: word
\\buffalo\programming\zenith\tripkey\tripkey.h:546: Error: Unknown compiler directive: }
\\buffalo\programming\zenith\tripkey\tripkey.h:547: Error: Unknown compiler directive: }

If I use "routine" instead of "replace" I get an error message that it's already defined. I think that Hugo has a problem with the "replace" directive, I've not been able to get it to work. I'm going to try something else to solve this.
_________________
The lessons of history teach us - if they teach us anything - that no one learns the lessons of history.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Tdarcos



Joined: 16 May 2008
Posts: 4441
Location: University Park, Maryland

PostPosted: Wed Sep 26, 2012 1:09 pm    Post subject: Reply with quote

Aw shit! I'm the one who's rejecting it!

The message is coming from the DoPlug routine. You're right, it's treating in as the xobject. So all I have to do is find out which one it is and include it as valid.

But it's funny I can't use "replace".
_________________
The lessons of history teach us - if they teach us anything - that no one learns the lessons of history.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Wed Sep 26, 2012 1:29 pm    Post subject: Reply with quote

Since you used the anything token, the xobject can be any known object in the game (not just within the player's scope). I'd look for objects with "in" used as a noun or adjective.

Turning HugoFix on and turning on parser monitoring should also show you what object is being passed onto the routine.

Also, replacing PreParse shouldn't have caused all those errors. Possibly you typo'd 'replace'?
Back to top
View user's profile Send private message AIM Address
loafingcoyote



Joined: 04 Jan 2012
Posts: 89
Location: Texas

PostPosted: Wed Sep 26, 2012 2:20 pm    Post subject: Reply with quote

Tdarcos wrote:
But it's funny I can't use "replace".


Not being able to use "replace" with Hugo would be a real problem. Here's a thought. As an experiment, I tried including the replace preparse code before hugolib.h and got the exact error messages that you got above. I don't know if that's the solution, but it's an idea.
Back to top
View user's profile Send private message
Tdarcos



Joined: 16 May 2008
Posts: 4441
Location: University Park, Maryland

PostPosted: Wed Sep 26, 2012 5:13 pm    Post subject: Reply with quote

Roody_Yogurt wrote:
Also, replacing PreParse shouldn't have caused all those errors. Possibly you typo'd 'replace'?

Not unless you did. I took your code and pasted it verbatim. I think the problem is that where it's located it's before hugolib.h, so it can't replace what isn't there yet, and it can't be a routine because then hugolib is trying to define a routine of the same name as something else.

Probably needs to be placed in a file after hugolib to get replace to work.

In any case, this does give me an understanding why it wasn't working. And I was able to avoid having to replace, at least this time. I'd like to be able to say that I got my entire program to work without having to change the system routines at all. I may not be able to get that level of perfection, but I can try.

I think I'll create a file called "patch" that is at the end of the includes, and can be used if I have to replace anything, so that it's always last.
_________________
The lessons of history teach us - if they teach us anything - that no one learns the lessons of history.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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