Character script advice

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
Ice Cream Jonsey
Posts: 28923
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Character script advice

Post by Ice Cream Jonsey »

I haven't released the source code to Fallacy of Dawn, and there's a very good reason for it -- game objects and locations are strewn about in three different files without any seeming sort of reasoning as to what should be where... and secondly, because I did the following:

For moving characters around, I used Hugo's character scripting process. There are some built-in actions, like having a character move in a compass direction, but I also made some of my own. One such routine was called "CharExclaim." With that routine, if I have a character saying something and Yar is not in the same room, Yar won't hear it. (As opposed to "CharScream," in which case he would.) In order to use that routines you need to provide, as variables, a character and some way to note exactly which of the "n" number of things you want the character to say.

So, you can go like this:

Code: Select all

{
setscript[Script(Porn, 2)] = &CharExclaim, object,
                                        &CharMove, s_obj
}
Fair enough. However, where I have "object," well, I was actually using objects. For some reason I didn't think I could use an array. Which (and granted, it's 3:15am, so I may re-check my work tomorrow) I seem to see that you, ah, actually can.


So rather than have to use actual physical objects that I had previously created for the game and wonder 'geez, did I use the newspaper already? The gun? Hm...', I can use a nice-and-logical-and-readable assortment of numbers. Much better. And it only took me two years and seven months before I realized it.

[/code]
the dark and gritty...Ice Cream Jonsey!

Kent

More character scripting

Post by Kent »

Character scripting is one of the things I'm interested in expanding in particular.

Right now the basic library scripting is fairly limited; if you're going to do anything relatively complex you'll probably end up using custom character routines in your scripts.

I'm interested in hearing ideas for what character scripts should do, how they might be implemented, how they should interact with the game world (which is heavily biased toward a single player character), etc.

Also, porn. (Because ICJ used it in his post and I wanted to, too.)

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

Post by Ice Cream Jonsey »

The "having characters speak on their own, but only if the player is around" thing was really easy to implement. I think one thing that threw me for a little bit of a loop was having a NPC open a container. I ended up getting it to work, and also making it so that such an event was "silent" (I didn't want the player to know that the NPC had in fact opened anything up.)

The built-in scripts are pretty useful. Just let me know if you'd like me to put the ones I've already written somewhere public; I'd be happy to do so. I don't think I have many, just maybe the two for talking and then maybe a couple more along the lines of a "NPC opens a container" one and maybe an "NPC places an object in a container" one.
the dark and gritty...Ice Cream Jonsey!

Lex
Posts: 976
Joined: Sat Apr 27, 2002 4:03 pm
Location: Scotland, Bonnie
Contact:

Post by Lex »

Well, I built me a frickin' SuperContainer before I realised one was already implemented :evil:
WHOOA!

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

Post by Ice Cream Jonsey »

I tried changing around the inventory message so that it wouldn't say "I am carrying..." before I realized that it was already an option.

Oh, and I convered the entire library to first person before realizing that all I had to do was switch one value from like "1" to "2."
the dark and gritty...Ice Cream Jonsey!

Lex
Posts: 976
Joined: Sat Apr 27, 2002 4:03 pm
Location: Scotland, Bonnie
Contact:

Post by Lex »

DAAAAAAAAMN YOU KEEEEEEEEEEENT! DAAAAAAAAMN YOOOOOOOUU TOOOO HEEEEEEEELLL!!!
WHOOA!

Kent

Whoops

Post by Kent »

Am I right in thinking the B- documentation is partly to blame? I feel guilty for duplicated effory--I should set up some sort of Ask-Kent-First Hotline.

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

Re: Whoops

Post by Ice Cream Jonsey »

Kent wrote:Am I right in thinking the B- documentation is partly to blame? I feel guilty for duplicated effory--I should set up some sort of Ask-Kent-First Hotline.
The inventory thing was just something that I didn't think to deeply research. For whatever reason I presumed DoInventory was hard-coded to always react as if it were in the form of a sentence, rather than just a basic list. I gained a significant understanding of Hugo through my attempts at modding it, though, so that was fine.

I'm not sure if the first person / second person switch was mentioned in the manual. (searching manual...) ... nothing came up under "tense," "first person" or "second person" when I searched. (I'm looking at the manual that was last revised Feb 2002.) In that particular case it's probably worthwhile to have a statement along the lines of "Hey, there's support for writing games in either first person or second person" added to the manual.

However, the more you program in Hugo you more you get a feel for the fact that you have already accomplished many of the tedious things that one suspects nobody else would ever need. I've gotten into the habit, when attempting to break new ground, of thinking, "OK, I'll check first to see if Kent already provided a way to do this" rather than "woe is me, I must construct everything from scratch."

The only other thing off the top of my head that existed in Hugo and that I couldn't figure out how to implement via the documentation was in getting a different graphic to appear based on the state of a variable. Something like this:

Code: Select all

	graphic
	{
		if Game_Crystal is not ticking  
		{
			current_resource_file = "dawn_gfx"
			current_resource = "arcade01"
		}
		else
		{
			current_resource_file = "dawn_gfx"
			current_resource = "arcade02"
		}
		return -1
	}

I recall that you told me to place the "return -1" bit in there. I didn't know that was necessary, and I don't think the code otherwise works without it. There may be some other things like that... I'll see if I can remember any of them.
the dark and gritty...Ice Cream Jonsey!

Post Reply