Simple Chat extension - making a more complex conversation

Thanks, I didn’t think of that. But for some reason the variable just won’t stay set once you leave the conversation. the only thing I can think of is that I have put in ‘Mark is askfirst’ and that that might do it, but I don’t really see any other way to set that.

Hmm - I once wrote a rule that changed a variable, and the change seemed to disappear after the rule exited. It turned out that I had used a phrasing that created a local variable (with the same name as the one I was trying to change).

Man, this whole thing makes no sense. I don’t know if I should re-write the whole sequence or just give up and rip it out. And that means I’ll be ripping out the option to steal it, the whole plot line that requires you to borrow it in the first place…argh.

It sounds like the problem is caused by a side effect of something else, such as accidentally creating a activity-local variable.

A heavyweight method:

  1. While Inform is open, look in the Build subdirectory of your project directory.
  2. Open the auto.inf file.
  3. Search through that for askfirst and borrow. See what the code related to those compiles to.

Oh, crap. I’ve just realised what I did wrong. :stuck_out_tongue: I have another script I was playing with that was supposed to make the borrowing script more realistic (if you ask to borrow it and then come back next day he will have forgotten you asked). Only I left it in its test state so instead of changing the variable based on something else it is set up so that as soon as the conversation ends the variable instantly reset to borrow first. :stuck_out_tongue: Thanks a lot for your help, I didn’t realise until I was reading that file. Disabled it and it stops resetting.

By the way, that reminds me, is there a way to run a script every time the player moves location?

A direct method is something like: (you’d have to check exact syntax)

last recorded room is a room that varies. Each turn: if the location of the player is not last recorded room: now last recorded room is the location of the player; do whatever.

If the only way the player can move location is by going a direction (ie. no move the player phrases) you can use a carry out going rule.

Hope this helps.

My game is defiantly getting a lot better with all the help you guys are giving me! Thanks a lot!

By the way, does it impact performance much to have a lot of ‘every turn’ rules? Should I limit the number I have? I only ask because it would be really helpful for me to be able to have characters and enemies moving each turn so that you can’t tell where they are going to be next. Currently I only have one enemy you can face in combat but I’m really not sure how to go about randomising their location and getting rid of the bodies. The easiest way I can see would be to simply resurrect an enemy after a certain amount of time and move them to a random square from which they move based on a pattern of behaviour. I know there are some ‘NPC routine’ addons out there that might help but currently all I have is: “Every turn: if the location of the player is not the location of the Smelly Thug, move Smelly Thug to X and heal them.” Which would instantly put them back where they came from in a very predictable way. What I want to do, at least to start with, is make some sort of backalley maze where you can run into a random selection of thugs who respawn after an unpredictable amount of time. Does anyone have any tips on how I might do this? :stuck_out_tongue:

By the way, I’m also trying to implement something of a disease or buff mechanic and wanted it to be possible for someone to pick up several different types at once. Is there a good way of managing this dynamically or do I need to create a variable for each disease or buff?

The simplest way would probably be to make each one a binary property for people:

A person can be blessed. A person can be plague-stricken. A person can be poisoned. And so on. Then you can just set it as “now Bob is blessed” when appropriate, or “not poisoned”, and so on, all independent of each other.

Ok cool. I’ll just do it like that.

Does anyone have any ideas on how I might make enemies respawn and move about within set areas? If it helps, I want to make it so the enemies you encounter are determined by a percentage based on different factions in game. Basically what I want to do is have a starting faction called ‘muggers’ who are just random thugs you meet and are fairly weak. At the beginning of the game the chance of the enemies you meet being muggers should be 100%, but as the game progresses and you offend or help various others such as the police or mobsters that 100% is slowly divided between the gangs that most have a grudge against you. In other words:

Unfortunately, I can’t work out how to simulate percentages or use them to modify a random outcome. This is a bit complicated, but I really want to make it feel like the player is affecting the game. :mrgreen: Can anyone help? So far what I have is:

A Percentage is a kind of value.

The first thing I think I need to do is limit it so a percentage can only ever be from 0-100 while making sure that the grand total is always 100.

Hi guys, the games are coming along well and I have had a really cool idea to make it more imersive. What I want to do is add things like books and magazines like you see in RPGs and let the player read them by flicking back and forth. Unfortunately, I can’t really find a ‘book’ extension or work out how to do it on my own. Does anyone have any ideas? I wanted to make several small books and magazines with contents menus and navigation.

You could take a look at the “Pages” or “Costa Rican Ornithology” examples in the documentation.

Or you could use the Menus extension (with each book having it’s own menu), and display the appropriate menu when reading a book.

Ok, cool, thanks I’ll try that.

By the way, is there an easy way to keep track of what the player (or NPCs) are wearing and insert it as a description in text so that when the player types ‘look at X’ they get a procedural description of what they are wearing? I have been thinking for a while about having dynamic wardrobes for characters.

Assuming you’re just using the standard clothing model (i.e. clothes are anything that’s “wearable”)

Jane is a woman. The description of Jane is "Jane's a fairly average gal. She's wearing [a list of things worn by Jane]." Jane is wearing a t-shirt and a pair of jeans.

For something more complex, my Layered Garments extension (based on the What Not To Wear example in the documentation) could be used.

Jane is a woman. She is wearing a t-shirt and a pair of jeans. The t-shirt is a shirt. The jeans are a pair of pants. The description of Jane is "Jane's a fairly average gal. She's wearing [a list of unconcealed garments worn by Jane]."

Layered Garments is available here: pastebin.com/H1LYrcWN

Wow, that’s pretty cool. Though I’m guessing it’s not quite finished yet if it’s in Pastebin? I am getting a few bugs just copying and pasting, unfortunately:

“every every” is a typo, looks like.

It’s more or less finished - it should certainly compile and be usable, as I am testing it regularly while building additional extensions that integrate with it.

The section the compiler is complaining about is from the documentation section - Zarf is right that “every every” is a typo in that example. I will fix the doc section.

I don’t intend to be mean, but that error is basically hilarious for entirely unintentional reasons.

Oh, cool, thanks. This would be something really awesome to have integrated into Inform. Almost every game, pretty much, has wearable stuff but it looks like this mod is the first one that makes it easy to keep track of.

Layered Garments is serious overkill for most kinds of games. The built-in “wearable” property and “wearing” relation is all most games really need.