I'm your vehicle baby, but I don't know how to take you...

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

User avatar
Tdarcos
Posts: 9342
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

I'm your vehicle baby, but I don't know how to take you...

Post by Tdarcos »

Okay, let me explain my circumstances. I want to have the player have a car and be able to drive it around. (In fact, I'm thinking of setting up a different car for a different purpose and so I'll figure that one.)

Okay, so the car is in a certain 'room' and it's from the vehicle class.

Before I have any external files included, I have

Code: Select all

#set USE_VEHICLES
Okay, so I create a vehicle.

Code: Select all

vehicle YourCar "car"
{
    in W_past_warehouse
    article "your"
    adjectives "car","auto","automobile","vehicle"
    
    long_desc 
       "Having gone on a bender, you left your car half on 
       the road and half on the sidewalk.  It can still be
       driven, fortunately."
       
}
Fine. When I get to room W_past_warehouse, "Your car is here." I can get in and out of the car, or vehicle, or auto. I can't move any direction unless I get out of the car. From what I had read, I had the impression that where the car is placed, you can drive in any direction to any room that you could walk into that doesn't have the obstacle attribute.

Drive doesn't do anything, it isn't recognized either for drive or drive with a direction.

Since a vehicle is clearly an add-on it's not really discussed in the manual and I'm wondering how to enable it so I can use it to move certain places. Any hints or suggestions would be appreciated.

----
Hey well
I'm a friendly stranger in a black sedan
Won't you hop inside my car?
I got pictures, got candy
I'm a loveable man
And I can take you to the nearest star.
I'm your vehicle baby
I'll take you anywhere you wanna go.
- The ides of March, Vehicle
"I really feel that I'm losin' my best friend
I can't believe this could be the end."
- No Doubt, Don't Speak

Roody_Yogurt
Posts: 2181
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

You know, I haven't yet played around with vehicles, but I suggest looking at the class object itself (and the accompanying commentary) in objlib.h. In fact, here are the comments:

Code: Select all

!----------------------------------------------------------------------------
! VEHICLE:
!
! This vehicle object expects the object's vehicle_move property routine
! to return true if the vehicle is presently capable of movement; if it
! isn't, vehicle_move is responsible for printing an appropriate message
! before returning false.
!
! The vehicle_verbs property contains a list of the valid verbs for vehicle
! movement, while the vehicle_path property contains a list of all the
! vehicles which may travel in a particular room object.
!
! The DoMoveinVehicle routine may conceivably be used by all basic vehicles
! in the game.  However, new grammar incorporating the vehicle movement verbs
! for each object (corresponding exactly to the list under vehicle_verbs)
! must be specified, as in:
!
!       verb "<verb1>"&#91;, "<verb2>",...&#93;
!               *                       DoMoveinVehicle
!               * object                DoMoveinVehicle
!               ...
!
! For different vehicle objects, the verbs &#40;and syntax&#41; may change, but
! the call to DoMoveinVehicle remains the same.
!
! Because of the relative complexity of the vehicle object, it must be
! explicitly included by setting the USE_VEHICLES flag.
!----------------------------------------------------------------------------
From what I gather you're saying, it sounds like you have yet to make your verb grammar and verb routines.

The Vault of Hugo sample game has a minecar of the vehicle class that probably is close to what you're trying to accomplish:
http://ifarchive.org/if-archive/program ... sample.hug

User avatar
Ice Cream Jonsey
Posts: 28925
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Post by Ice Cream Jonsey »

This is an excellent question. I've never used the vehicle stuff in any of my wares. (Well, I *may* have used it for the last room in Fallacy of Dawn, for nothing other than >get in car / >drive / YOU WIN!).

Let's take a look, shall we?

(And I'd like to say that I love your description for this car. Is it OK to say I am officially excited for TDARCOSWORLD? I am officially excited for TDARCOSWORLD.)

I am going to see if I can learn something about vehicles and come back here.
the dark and gritty...Ice Cream Jonsey!

User avatar
Flack
Posts: 8832
Joined: Tue Nov 18, 2008 3:02 pm
Location: Oklahoma
Contact:

Post by Flack »

This sounds like a bug in Hugo.
"I failed a savings throw and now I am back."

User avatar
Tdarcos
Posts: 9342
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos »

Ice Cream Jonsey wrote:(And I'd like to say that I love your description for this car. Is it OK to say I am officially excited for TDARCOSWORLD? I am officially excited for TDARCOSWORLD.)
Actually, the game is called "City of Zenith," named for the ficitional midwest city of Zenith, Winnemac. The city and state were invented by Sinclair Lewis for such books as Arrowsmith and Elmer Gantry after residents of the (real) town of Sauk Centre, Minnesota didn't like the depiction of their town in his book Main Street.

So it's City of Zenith. In fact, I am also doing a cartoon called "Tales of Zenith," but it takes time to draw and I've been putting it off. For about a year...
"I really feel that I'm losin' my best friend
I can't believe this could be the end."
- No Doubt, Don't Speak

User avatar
Tdarcos
Posts: 9342
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos »

Flack wrote:This sounds like a bug in Hugo.
Good. Tell that to Pinback so the cheap bastard will pay me the $30!
"I really feel that I'm losin' my best friend
I can't believe this could be the end."
- No Doubt, Don't Speak

User avatar
pinback
Posts: 17700
Joined: Sat Apr 27, 2002 3:00 pm
Contact:

Post by pinback »

Tdarcos wrote:
Flack wrote:This sounds like a bug in Hugo.
Good. Tell that to Pinback so the cheap bastard will pay me the $30!
You don't get jokes, Paul.
I don't have to say anything. I'm a doctor, too.

User avatar
Tdarcos
Posts: 9342
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos »

pinback wrote:
Tdarcos wrote:
Flack wrote:This sounds like a bug in Hugo.
Good. Tell that to Pinback so the cheap bastard will pay me the $30!
You don't get jokes, Paul.
Yeah, I do, but it still was worth a try. Anyway, I've dropped the nuke bomb, you willing to defuse it and prove your claim or admit you've been jerking us off all along and refusing to let us have an orgasm?

(I didn't think of that line, my dear late friend Andrea did.)
"I really feel that I'm losin' my best friend
I can't believe this could be the end."
- No Doubt, Don't Speak

Roody_Yogurt
Posts: 2181
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

Hey, Tdarcos, we recently did a vehicles page over at Hugo By Example:
http://hugo.gerynarsabode.org/index.php?title=Vehicle

Of course, that covers the IF concept of vehicle-as-glorified-container-or-platform that moves from room to room with you. If you want to set up something like the more traditional car-in-IF where one enters the car and just types >DRIVE TO [insert location], we can point you to examples of that, too.

User avatar
Tdarcos
Posts: 9342
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos »

Roody_Yogurt wrote:Hey, Tdarcos, we recently did a vehicles page over at Hugo By Example:
http://hugo.gerynarsabode.org/index.php?title=Vehicle
This has helped tremendously. I have added some information because if you want to block access in certain cases for vehicles to move from a room, there are two things: one, you can't do the test in the "_to" value, e.g. sw_to, W_to, Out_to, etc., you have to do it in the "before" event. You also cannot use "move_player(room)" on the _to value or you toss the person out of the vehicle.
"I really feel that I'm losin' my best friend
I can't believe this could be the end."
- No Doubt, Don't Speak

Roody_Yogurt
Posts: 2181
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

Interesting code on the vehicle page, Commander. I haven't played with this myself, but in the first "don't do this" example, couldn't you also do this:

Code: Select all

   w_to
   &#123;
     if &#40;parent&#40;player&#41;=Taxicab or parent&#40;player&#41;=policecar&#41;
       return Airport4
     elseif &#40;parent&#40;player&#41;=rollsroyce&#41;
         "Your vehicle is not authorized."
       else&#58;
         "Pedestrians are not permitted past this point."
     &#125;
Alternatively, if you didn't want any "can't go" messages taking up turns, I'd think you'd be able to do this:

Code: Select all

   w_to
   &#123;
     if &#40;parent&#40;player&#41;=Taxicab or parent&#40;player&#41;=policecar&#41;
       return Airport4
   return false
   &#125;
   cant_go
   &#123;
     if object = w_obj
        &#123;
        if &#40;parent&#40;player&#41;=rollsroyce&#41;
         "Your vehicle is not authorized."
       else&#58;
         "Pedestrians are not permitted past this point."
        return true
        &#125;
     return false
   &#125;
I haven't tested it, but it should work (the point being, there's almost always multiple ways to handle everything). Anyhow, thanks for contributing!

Post Reply