Vehicle Movement

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

zoot
Posts: 6
Joined: Thu Jul 29, 2004 3:15 am
Location: On the Level
Contact:

Vehicle Movement

Post by zoot »

I have a car :smile:

I know that any destinations to which the car can travel must have the vehicle name in its vehicle_path property. The thing is that I don't want to make all the possible destinations available until certain puzzles are solved. Sort of, first puzzle solved, add destination one, second puzzle solved, add desination two etc.

To avoid the risk of players accidently guessing destinations, I would like to restrict vehicle_path until I want it to be available in each room. Can I either set vehicle_path to a null entry, or reserve memory to do this another way? If not, I had thought of generating an array that is added to each time a new destination becomes available which is then displayed to the user as a destination list.

Any ideas on the best way to achieve this?

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Re: Vehicle Movement

Post by Debaser »

zoot wrote:If not, I had thought of generating an array that is added to each time a new destination becomes available which is then displayed to the user as a destination list.

Any ideas on the best way to achieve this?
This is what I did in the game I'm working on. I sort of started with Robb's phototalk code (availiable on the IF Archive), and adapted it to provide a list of locations that became "active" as certain plot points passed. Whenever the player boarded the L, a menu list of availiable locations shows up. You can view my ham-fisted work getting it together here.

Since you seem to have a better idea of how arrays and code in general works than I did at the time (and still do), you shouldn't have too much trouble assembling something workable from those two sources. Otherwise, let me know, and I'll just chuck my working code into this thread.

zoot
Posts: 6
Joined: Thu Jul 29, 2004 3:15 am
Location: On the Level
Contact:

Post by zoot »

Thanks, DB. That looks like what I need (the link to the dicsussion really helped too).

I wonder if there is a way, however, to reserve the space in the room description, as that woould be even more elegant. The array does leave the possibility, however unlikely, that the player could 'guess' and available destination.

Cheers,

Zoot

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Post by Debaser »

zoot wrote:The array does leave the possibility, however unlikely, that the player could 'guess' and available destination.
Wait... what? I think one of us is missing something. What the code I'm talking about does... okay: You set up an array and each possible destination is a value in one dimension of the array and then each destination has an associated value of 1 or 0. If it's 1 you can go there, if it's 0 you can't. Then when the player starts up the car, you count up all the "1" destinations, and display them as a menu:

Code: Select all

> start car
[i]Vroom vroom!![/i]  Where would you like to go?

1. The Sub Shack
2. The Whorehouse
3. Norway

>  3
If a location isn't "known" yet, it doesn't disply on the menu and can't be selected, dig?

zoot
Posts: 6
Joined: Thu Jul 29, 2004 3:15 am
Location: On the Level
Contact:

Post by zoot »

Debaser wrote:
Wait... what? I think one of us is missing something.

If a location isn't "known" yet, it doesn't disply on the menu and can't be selected, dig?
Yes, I probably was missing something. My point was that, because the vehicle must be specified in the vehicle_path property of the rooms that could be reached by the vehicle, the user could just type "Drive to " x, and if x was a valid destination, the car would go there. I would be very interested in seeing the full code for your vehicle object, if that is possible. Thanks again,

Zoot

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Post by Debaser »

Alright, this'll be up in t-6 hours, give or take. As soon as I get home from work.

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Post by Debaser »

Sorry: Forgot about this.

Code: Select all

array transit[6] = 1, 1, 0, 0, 1, 0
global lastrans = 999

routine GoTransit
{
 local a, b, c, d
 "Choose a destination (0 to remain where you are):\n"
 for &#40;a=0; a<5 ; a=a+1&#41;
 &#123;
  if &#40;transit&#91;a&#93; = 1&#41;
  &#123;
   b = b + 1
   print ">&#40;"; number b; "&#41;&#58; ";
   select a
    case 0 &#123; "Gothic St. &#40;Your Apartment&#41;" &#125;
    case 1 &#123; "Far West Side &#40;Mickey's House&#41;" &#125;
    case 2 &#123; "Lakewalk Blvd. &#40;Ravi's Condominium&#41;" &#125;
    case 3 &#123; "Olympus St. &#123;Greek Town&#41;" &#125;
    case 4 &#123; "Adams Ave. &#40;Jamestown University&#41;" &#125;
  &#125;
 &#125;
 "\n";
 GetDial&#40;b&#41;
 for &#40;a=0; a<5 ; a=a+1&#41;
 &#123;
  if &#40;transit&#91;a&#93; = 1&#41;
  &#123;
   c = c + 1
   if &#40;c = selected&#41;
   &#123;
    d = a
    a = 20
    select d
     case 0 &#123; moveplayer &#40;platform0&#41; &#125;
     case 1 &#123; moveplayer &#40;platform1&#41; &#125;
     case 2 &#123; "Lakewalk" &#125;
     case 3 &#123; "Olympus" &#125;
     case 4 &#123; moveplayer &#40;platform4&#41; &#125;
   &#125;
  &#125;
 &#125;
&#125;
GetDial is a bit of code I copied verbatim from the aforementioned phototalk.

Post Reply