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

Making Hugo Programs
Goto page 1, 2  Next
 
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
hiddenHeart
Guest





PostPosted: Wed Dec 05, 2012 12:52 am    Post subject: Making Hugo Programs Reply with quote

kindly anyone tell me how to make a simple program using Hugo programming language?..

i already download hugo compiler

and i wanted to make simple program with input,output, and simple looping statements.

yet i don't know how to use it. or where do i type my codes or what so ever...

in short:
i just wanted to run simple program using hugo language.

can anyone help me?
Back to top
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Wed Dec 05, 2012 7:34 am    Post subject: Reply with quote

I don't know exactly what you are asking here. I don't know if you are trying to start a text adventure with Hugo or if you want to write a simple non-text-program. Both can be (and have been) done. I'll go through both.

First off, though, the code goes into a text file that we give a .hug extension to separate it from the rest of the files on the computer. That is the file that will be fed to the compiler.

If you are wondering where Hugo's IDE is, the way that Inform 7 and TADS 3 have their own IDES, Hugo does not have an IDE, unfortunately. We still use regular text editors here. We have a list of text editors with syntax files (files that allow you to color code your code) here:
http://hugo.gerynarsabode.org/index.php?title=Supported_Editors

(As far as free Windows editors go, I'd recommend TextPad, just because it handles comments and strings just a little bit better than the other free ones.)

Ok, let's go into the programming:

  1. Making your own program-
    Your own program can be as simple as a file containing:
    Code:

    routine main
    {
       print "HELLO WORLD"
       pause
       quit
    }


    Larger examples of such code are http://ifarchive.org/if-archive/programming/hugo/utilities/coretest.hug and http://ifarchive.org/if-archive/games/source/hugo/tetris_source.zip .



  2. Making interactive fiction-
    To make a real text adventure, you'll need what we call the "shell" file, which you can pick up here: http://roody.gerynarsabode.org/bareshell.hug

    You'll also need the standard library, on Hugo's official site or the IF archive.

    If you compile that bareshell just as it is and run the resulting file, you'd find yourself in an undescribed room with pretty much nothing to do (well, you can >EXAMINE ME since the player character object has a default description).

    Since it's nice to have an untouched shell around, I like to make a copy of it then rename the copy to the game I'm going to write and start with that one.

    Anyhow, at that point, you're ready to start making your game world.

    Here is another overview for beginners getting into Hugo:
    http://hugo.gerynarsabode.org/index.php?title=Getting_Started
Back to top
View user's profile Send private message AIM Address
Tdarcos



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

PostPosted: Wed Dec 05, 2012 10:47 am    Post subject: Re: Making Hugo Programs Reply with quote

hiddenHeart wrote:
kindly anyone tell me how to make a simple program using Hugo programming language?


Hugo isn't really a "general purpose programming language" like Basic, PHP or C. Hugo is a specialized language designed for implementing Interactive fiction. Yes, in theory you could use it for designing regular apps, but it would be like, say, trying to use a spreadsheet program to create a general purpose application, like a payroll program or accounts payable. The system isn't really a good fit for that purpose. (But keeping the values generated by transactions in a payroll or A/P app is an excellent use of a spreadsheet.)

What Hugo is really good for is the implementation of an application where the user types in a command and the program issues a response based on the command. (There are features for mouse-based input and some other things.) This tends to be a near-perfect match for text adventures and certain other game type applications. If you were doing some inquiry program then Hugo might be a good fit, but here and now either an HTML page or an interactive website does a much better job for that sort of thing.

But don't let me scare you away if you think Hugo would be a useful system for developing a program for something you want to do. But for general purpose programming - other than the specialized game-type systems that other interactive fiction authoring systems are used for - something like Basic or Pascal or C might be a better choice.

FreeBasic includes an IDE for developing Basic programs, and the Lazarus editor provides an excellent IDE for compiling programs in Free Pascal, either language is good for general-purpose software development.

But if you really are looking for a way to implement a game, then I suspect Hugo really might be the right choice. The run-time libraries and such do a lot of the "heavy lifting" and implement a lot of the stuff you'd have to do if you were writing a game - especially interactive fiction - using a general purpose language like Basic, C, Java, Pascal, Perl or PHP.
_________________
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
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Wed Dec 05, 2012 8:29 pm    Post subject: Re: Making Hugo Programs Reply with quote

Tdarcos wrote:
hiddenHeart wrote:
kindly anyone tell me how to make a simple program using Hugo programming language?


Hugo isn't really a "general purpose programming language" like Basic, PHP or C.


Hugo is turing complete and the source code is open and available. So I must once again correct one of your posts.
_________________
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
hiddenheart
Guest





PostPosted: Sat Jan 05, 2013 7:03 pm    Post subject: Reply with quote

thanks everyone for the help... i'll try them soon...

i guess text editor is all i need here :smile:

anyway, i'm not going to create payroll systems or what.. i just wanted to use hugo for creating simple program that uses input/output statement, and looping statements..i guess every programming language uses such statements before they can create games and what....

i hope to make it :smile:
Back to top
hiddenheart
Guest





PostPosted: Sat Jan 05, 2013 7:14 pm    Post subject: Reply with quote

Roody_Yogurt

i still can't make it.. how can i be able to make file containing the codes you've given me with a .HUG extension?...

or how can i run my file if its not in a .HUG / .hex / .hdx extension?....

im very confused :sad: :sad: :sad: :sad:
Back to top
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Sun Jan 06, 2013 2:11 pm    Post subject: Reply with quote

Oops, sorry, hiddenheart, I saw your first reply there but hadn't realized you followed it up with another one right away.

It seems there's a bit of a language barrier here so I'm not sure what is being asked. To create a new file, in the text editor, go to /File/New. When you 'Save As', you should be able to save it as the file type you'd like.

.Hug files must be compiled to turn into .hex files, which you run with the interpreter program (hewin.exe, he.exe). If you're looking to create a standalone program, you could download the Hugor interpreter and rename the hugor.exe file to match your .hex file, so if your game file is called hiddenheart.hex, rename hugor to hiddenheart.exe and then opening THAT will automatically open the game.

Now, I assume that if you have found this board, you have already taken a look at the other parser-based (what you call input) programs that are available. We are glad to have you, but in case you aren't aware of the other choices, let me share some links:

Inform 7 is the most popular IF system. It is coded using a weird English syntax. The homepage is at http://inform7.com/ .

Quest and ADRIFT are two other languages that are fighting for people's attention.

Quest will let you design your game in a web browser: http://www.textadventures.co.uk/quest/

ADRIFT: http://www.adrift.co/cgi/adrift.cgi

Don't be sad, hiddenheart!
Back to top
View user's profile Send private message AIM Address
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Sun Jan 06, 2013 2:17 pm    Post subject: Reply with quote

Also, if the important thing is the choices and not the typing, maybe you want to take a look at a choose-your-own-adventure (CYOA) system like Twine:

Twine home page - http://gimcrackd.com/etc/src/
A "How to Use Twine" page - http://www.auntiepixelante.com/twine/
Back to top
View user's profile Send private message AIM Address
hiddenheart
Guest





PostPosted: Wed Jan 23, 2013 4:06 am    Post subject: Declaring Variables Reply with quote

Thanks... i Can now create output statement using hugo.. :smile:

but im wondering on how do we declare variables in hugo?...

for example in java we use:
String a="hidden";
int b=10;

then how would the code be for hugo?...

i also wonder how to get a user input in hugo...?
in other codes, we use "input.getText()"
how about in hugo?..

i already read the HUGO BOOK in pdf file and tried the codes there on how to declare variable..
just type:
x=0;

but an error occurs.. even in declaring strings..

is there any other way?..
or am i missing something?..

:sad: [/b]
Back to top
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Wed Jan 23, 2013 8:09 am    Post subject: Reply with quote

Variables have to be declared as global or local. Here is an example of declaring both:
Code:

global variable_A = "red" ! start pointing to "red"

routine SetThemVariables
{
   local variable_B = 5 ! equals 5
   local variable_C, variable_D ! some local variables without starting values
   variable_A = "blue" ! now points to "blue"
   variable_B = 10 ! now equals 10

   print variable_A ! should print "blue"
   print number variable_B ! should print "10"
}


Now, there are a couple different ways to get input. If you want people to type in full commands, you can use input/GetInput. GetInput is the same as input except it'll print a prompt, so:
Code:

GetInput("type your answer>")

Will print "type your answer>" before expecting input from the player.

All understood words will be put into the word array; the first understood word will be put in word[1], the second understood word will be put in word[2], and so on. The first not-understood word will be put in the parse$ global variable, but all other not-understood words will be lost.

The good news is that any text your code checks for is automatically in the dictionary table and will be understood.

The other way to get input is to just use a while loop to do one-key inputs, where the player types just a letter (not full words). The simplest way to do that is:
Code:


routine GetKey
{
    local key
    pause ! pauses the game, waits for keypress
             ! (the keypress gets sent to word[0]
    key = word[0]
    select key
        case 'a','A' : "The player typed A."
        case 'b','B' : "The player typed B."
        case else : "And so on."
}


Hope that helps! Cheer up, HH!
Back to top
View user's profile Send private message AIM Address
hiddenheart
Guest





PostPosted: Fri Jan 25, 2013 3:02 am    Post subject: thanks! Reply with quote

THANKS A LOT Roody_Yogurt for the help..

i can now report Basics of Hugo Programming Language to class...


Super Thanks!
:smile: :smile: :smile: :smile:
Back to top
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Fri Jan 25, 2013 10:15 am    Post subject: Reply with quote

You're welcome, hiddenheart! Sounds like one lucky class!
Back to top
View user's profile Send private message AIM Address
Erebor



Joined: 22 Dec 2012
Posts: 24

PostPosted: Mon Nov 10, 2014 5:13 pm    Post subject: Hugo programming difficulties--(first attempt). Reply with quote

I'm not entirely sure where the appropriate place is to post this question/problem, but I'm choosing to do so here, rather than create a new topic.

Anyone is welcome to comment, but I'm specifically addressing this to Robb. I'm a Mac User, and I recently downloaded the Hugo Compiler for OS X, along with all the necessaries to get started programming for Hugo. The Hugo Book seems very straightforward and understandable. I'm well into the first two sections, and I wanted to get started playing around with the compiler. Bear in mind, that I have a basic familiarity with C++, and general computer science concepts, which I learned in college.

The problem that I'm having seems to be that Terminal crashes immediately when I run the compiler. I've tried both double-clicking it, and running it from within Terminal, the usual way. In both cases, I end up with a "process completed" message, and a screen with which I can do nothing. This is Terminal's way of saying that the program has ended... the program which I just opened. All the menus seem to be in the right place, just inactive.

I'm not sure why this is happening. I'm certain that the download from the Hugo site was perfectly suitable for Unix users in general, but there seems to be an assumption on the part of those who make these packages available that all Mac users are command line experts, which is not the case. The command line didn't even exist for us, prior to OSX. While that has been awhile, I've been a Mac user for several years (an embarrassingly long period of time), and I'm feeling like I'm having to learn about my computer all over again... being so unfamiliar with Terminal. One of my CS professors said that the GUI makes us all dependent and stupid. I suppose that's right. I like having a command line interface on my system... I'm excited about the potential for what it can accomplish. I'm just not that familiar with it. Nearly all my experience has been interacting with the system at the macro level, with the GUI. However, I don't believe I'm actually doing anything wrong here. My first impulse was to allocate more RAM for Terminal, to keep it from crashing-- which in this version of OS X, I'm no longer allowed to do.

Can someone give me some idea what's going on here? Once I get over this first hiccup, I think I can get on with my artistic endeavours... but I need something to experiment with, first.

Can we at least establish if the OSX download from the HUGO site definitely works on a system running OSX? I suspect that someone may have just given me some Unix files and hoped for the best.
Back to top
View user's profile Send private message
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Mon Nov 10, 2014 11:47 pm    Post subject: Reply with quote

Unfortunately, yeah, the packages on the Hugo site don't work with the modern OSX and Unix OSs. ICJ and some others put together alternate packages but they have not yet been incorporated into the Hugo site. I don't have the link handy, but I'm sure ICJ will give the link as soon as he sees this thread.

Anyhow, will be happy to help out with any Hugo coding questions as soon as you get that far!
Back to top
View user's profile Send private message AIM Address
Jizaboz



Joined: 31 Jan 2012
Posts: 567
Location: USA

PostPosted: Tue Nov 11, 2014 8:27 am    Post subject: Reply with quote

Yeah, I wish there were a proper and pretty Hugo compiler for OSX. I end up uploading my work to a linux box to compile it, then pull it down.. which is a pain. I end up just firing up my crappy Toshiba to work on Hugo stuff.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Thu Nov 13, 2014 11:30 pm    Post subject: Re: Hugo programming difficulties--(first attempt). Reply with quote

Erebor wrote:
The problem that I'm having seems to be that Terminal crashes immediately when I run the compiler. I've tried both double-clicking it, and running it from within Terminal, the usual way. In both cases, I end up with a "process completed" message, and a screen with which I can do nothing. This is Terminal's way of saying that the program has ended... the program which I just opened. All the menus seem to be in the right place, just inactive.

I'm not sure why this is happening.


Yeah, the Mac versions that are on the General Coffee site do not work. This ... this is tough. We were able to get a fix for Unix, but the Mac compiler is in no-man's land. :(

We did get it working for Unix. The repository is here:

http://hg.0branch.com/hugo-unix

Let me know if you can or cannot get that to work.

I realize that this is the most bullshit way to get introduced to a programming language. I get it. I had no access to a Mac, so I couldn't fix the Mac compiler (keeping in mind that, hey, I am primarily just a game-maker here, haha).

I hope that you can find a way to take this journey with us. I'm still making games in Hugo. I suspect I will be for a very long time. I do have a Mac laptop thanks to work, but that came with a price: I'm so busy at work that I haven't had time to research the specific Mac Hugo problem.

(And to confirm, the Unix compiler available through generalcoffee.com does not work - you need to grab the hc in that repo linked above.)
_________________
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
Erebor



Joined: 22 Dec 2012
Posts: 24

PostPosted: Wed Nov 19, 2014 12:35 pm    Post subject: Relieved Reply with quote

Well thanks, man. And to all for replying. Especially Robb for posting that link. I'm just glad to know that I'm not insane, or such a hopeless backward newb that I'll never get anywhere.

I'll experiment with the new program, and let you know how it goes.

I actually have a couple of projects in mind that I think will look great in HUGO, that I want to do as practice.
Back to top
View user's profile Send private message
bruce



Joined: 04 Jun 2002
Posts: 2547

PostPosted: Sat Nov 22, 2014 10:36 pm    Post subject: Reply with quote

I just did an hg clone of the bitbucket source, and ran a make on OS X 10.10.

It seemed to run fine. A few warnings, but nothing too concerning. I don't have any Hugo source to test it on, but when I invoke the compiler and debugger they give me what look like appropriate startup banners:

Code:

adam@i7-wired:~/Documents/src/hugo/hugo-unix$ ./hc
HUGO COMPILER v3.1.04 by Kent Tessman (c) 1995-2006
The General Coffee Company Film Productions
Unix port by Bill Lash

SYNTAX:   ./hc [options] sourcefile [objectfile[.HEX]]
OPTIONS:  -<switches>  $<limit>  #<compiler>  @<directory>

SWITCHES:
  -a  Abort on first error                -d  build .HDX Debuggable executable
  -f  Full object summaries               -h  generate .HLB precompiled Header
  -i  print debugging Information         -l  List compilation output to disk
  -o  display Object tree                 
  -s  display compilation Statistics      -t  Text to .LST for spellchecking
  -u  show memory Usage for objectfile    -v  Verbose compilation
  -w  Write objectfile despite errors     -x  override switches in source code

LIMIT SETTINGS:  $<setting>=<new> (or $list to view)
DIRECTORIES:     @<directory>=<actual> (or @list to view)
Back to top
View user's profile Send private message
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Sat Nov 22, 2014 11:11 pm    Post subject: Reply with quote

You grabbed the repo from here? http://hg.0branch.com/hugo-unix

I am under the impression that it wouldn't work on a Mac even though they are essentially running BSD now because it's just different enough to require specific Mac builds.

Oh wait, you ran a make. Maybe if I read your post all the way through they would make greater sense. Maybe I should do that for everyone.

Can I send you credentials to download my WIP? If it compiles that and works then shit, I guess the fixes I put in for the Unix version would be good enough for the Mac version.
_________________
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
bruce



Joined: 04 Jun 2002
Posts: 2547

PostPosted: Sun Nov 23, 2014 1:22 pm    Post subject: Reply with quote

Ice Cream Jonsey wrote:
You grabbed the repo from here? http://hg.0branch.com/hugo-unix

Yep.
Quote:
Can I send you credentials to download my WIP? If it compiles that and works then shit, I guess the fixes I put in for the Unix version would be good enough for the Mac version.

Sure.
Back to top
View user's profile Send private message
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
Goto page 1, 2  Next
Page 1 of 2

 
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