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

stuck

 
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
looper



Joined: 24 Feb 2003
Posts: 94
Location: CA

PostPosted: Sun Mar 02, 2003 2:34 pm    Post subject: stuck Reply with quote

My programming experience is trying to learn ATARI BASIC out of books when I was 10, a college course called Liberal Arts Mathematics that covered logic, and trying to read first the TADS manual, then the Inform manual, and now the Hugo manual, off a computer screen. I don't have a job where I can print out the bible for free.

So, I can see how Hugo has a little bit more of an intuitive and simple grammar structure than, say, TADS or Inform, but also how they're very similar. I am stuck at properties and routines (I think I hit the wall at around page 83 of the Hugo manual). I understand creating an object and giving it attributes and properties. But I don't understand this object.nouns business. Say, I have an object called FatAss; with the nouns property defined. What does FatAss.nouns do?

I am also not clear on how to call a routine. I thought I could do something like this:

routine main
{ print "Hello sailor!"
}

routine Bob
{ print "Hello Bob!"
}

Bob

and get two lines of text. I don't understand why "Hello sailor!" gets printed right off the bat; what is calling the main routine? Why doesn't Bob print also? And how do I call "Bob", if not by saying "Bob" (the file compiles if I leave out that last line -"Bob"- but doesn't if I put it in. Nonetheless, it was my attempt to call the Bob routine)?

???
Back to top
View user's profile Send private message
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Sun Mar 02, 2003 3:28 pm    Post subject: Reply with quote

I'll try to answer this although I'm really not good. I can barely write a game myself.

I believe a main routine is always called. That's why in shell.hug, you can see the main routine saying all of this:

counter = counter + 1
PrintStatusLine
run location.each_turn
runevents
RunScripts
if parent(speaking)~=location
speaking = 0

But if you have nothing calling your Bob routine, it won't execute. If you ran Bob from within Main (if you can do that), I'm sure it'd show up.

Also, on the horizon is a printed Hugo manual for purchase from iflibrary.org. It'll be priced reasonably closed to the cost of printing, so it should be a good deal.

In the meantime, it's good to read the current Hugo manual and sent Kent your thoughts on its readability and coverage of issues that try you.
Back to top
View user's profile Send private message AIM Address
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Sun Mar 02, 2003 4:26 pm    Post subject: Reply with quote

Hey, let me welcome you to the BBS, looper. Hope this base can be of some help for you.

Roody said exactly what I was going to say -- the main routine is always called, so that's what executes that line. I think you want to have something like this, though, to get both lines to print:

Code:

routine main
{
     print "Hello sailor!"
     Bob()
}

routine Bob()
{
     print "Hello Bob!"
}


There are other places where you can call Bob. For instance, you might want to call that routine the first time you enter a room. The way the program flow would work would be something like this:

o the "main" routine is called
o the player is placed in Room1 (for instance) by a line that goes something like MovePlayer(Room1)
o You could then set something up where, if the player had never been in that room before, Bob() would be called.


... Does that make any sense at all? Let me know if there are any questions we didn't answer to your satisfaction, looper.


Robb
_________________
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
looper



Joined: 24 Feb 2003
Posts: 94
Location: CA

PostPosted: Sun Mar 02, 2003 9:04 pm    Post subject: Reply with quote

Ice Cream Jonsey wrote:
Hey, let me welcome you to the BBS, looper. Hope this base can be of some help for you.


Thanks :smile:

Ice Cream Jonsey wrote:


Code:

routine main
{
     print "Hello sailor!"
     Bob()
}

routine Bob()
{
     print "Hello Bob!"
}



... Does that make any sense at all? Let me know if there are any questions we didn't answer to your satisfaction, looper.


Robb


Makes sense. I think one thing that confuses me a little is how the routine Bob is defined at the end of the program but called in the middle. Doesn't make intuitive sense to me. But I guess I'll just have to take a look at the chapter that covers that...I'll be back when something else confuses me! Thanks again!
Back to top
View user's profile Send private message
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Mon Mar 03, 2003 8:34 pm    Post subject: Reply with quote

looper wrote:
Makes sense. I think one thing that confuses me a little is how the routine Bob is defined at the end of the program but called in the middle. Doesn't make intuitive sense to me. But I guess I'll just have to take a look at the chapter that covers that...I'll be back when something else confuses me! Thanks again!


Right, I am with you -- I didn't get that at first either. What the compiler does, though, is make a note of your call to "Bob" and wait until it gets through processing your code before stating that it doesn't know what it is. So when it sees Bob() defined below, it essentially says, "OK, cool" and is alright with the fact that you called it before you wrote it (in terms of how the text file containing your source code is written).

I think there are a few languages out there where you need to define your routines before you can call them, but offhand I can't remember which ones. (I could be totally wrong as well, but I could swear that such a question came up in some intro to programming class that I slouched about in over the years.)
_________________
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
looper



Joined: 24 Feb 2003
Posts: 94
Location: CA

PostPosted: Tue Mar 04, 2003 12:46 am    Post subject: Reply with quote

ok cool, gotcha. Thanks again.
Back to top
View user's profile Send private message
Kent
Guest





PostPosted: Thu Mar 06, 2003 12:47 am    Post subject: That's pretty much it Reply with quote

One of the key things is to not think of a Hugo source file as a contiguous script--it doesn't really matter, in the general case, what order things are included in. (There are times when it matters, but we're not concerned about that here.)

And yeah, languages like C/C++ require you to "prototype" a function before calling it, meaning you have to give some sort of additional description of what the function is called, etc. before you can use it. In Hugo, the compiler just looks at the function when and where it's defined, and relates that directly to each place where that function is called. (Hopefully what this means is less work for the programmer.)
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