-
Choose Your Own Adventure.
Hi Guys. :)
I need a little help as I'm not sure the best way to go about this. I'm creating a 'Choose Your Own' adventure type game, the one's like Fighting Fantasy, you know the ones:
-------------------------------------------------------------------
"You stand at a fork in the road and to the left in an interesting type rock. Will you..."
Examine the rock? Turn to page 23.
Take the left fork? Turn to page 148.
or take the right hand fork? Turn to page 99.
-------------------------------------------------------------------
At the moment I'm using a text file like this:
-------------------------------------------------------------------
You sit in a solid, carved chair and look around. The reception hall is certainly not what you would have expected from the outside. It is elegantly decorated with rich tapestries and fine oak panels. A number of portraits line the walls. A sturdy sixteenth-century table is set against one wall.
@@
Will you wait for your host to arrive?
277
Study the paintings?
304
or hunt for a telephone?
238
-------------------------------------------------------------------
The first part of the text (the text before the '@@') will be placed in a Formatted Text box and I want the next three lines:
Will you wait for your host to arrive?
Study the paintings?
or hunt for a telephone?
To be placed in a list box and the player will choose one of these options. The numbers after each line indicates what section (text file to load in) to go to, so if the player clicks on "Study the painting?" then text file 304 will be loaded.
But I'm not sure if this is the best way, also, I'm not sure how to do all the splitting and how to know which file should be loaded; how do I get the program to know that clicking on line 2 in the list box loads text file 304?
Any help or advice would be real helpful. :)
And if anyone's interested, here's the sort of thing I mean M.A.C.K (press right button to bring up quit menu or press Alt+F4 to quit.)
-
Re: Choose Your Own Adventure.
I have a lot of the Fighting Fantasy books at home (or at least the first fifty or so - I've no idea what number they're up to now, so that may or may not be 'a lot') - nice to see someone else who read them!
The String Parser object might help you here, but I think I would go for the approach of just reading in your descriptions and values from an INI or Named Variable Object rather than creating a format like this. The information you gave above could be represented as:
[Location86]
Description=You sit in a solid, carved chair and look around. The reception hall is certainly not what you would have expected from the outside. It is elegantly decorated with rich tapestries and fine oak panels. A number of portraits line the walls. A sturdy sixteenth-century table is set against one wall.
Option1=Will you wait for your host to arrive?
Target1=277
Option2=Study the paintings?
Target2=304
Option3=Hunt for a telephone?
Target3=238
("House of Hell", isn't it? I never got anywhere near completing that one.)
The way I've got it stored there, you could set the INI's current group to "Location" + [Current location number], then loop to put any items starting with "Option" into your list box. When an option is selected, you would look up "Target" + Str$(Currently selected line of the list box), get the location number from that, and set the INI's current group to "Location" + [Current location number] all over again.
You've got me all nostalgic now...
-
Re: Choose Your Own Adventure.
Though its not helping you with the problem....
I read lots of those books as a kid (house of hell is scary ;)
Now i have got my son reading the re-issues... its great!
-
Re: Choose Your Own Adventure.
Thanks guys! Fighting Fantasy was way cool! I'm getting all the re-issues as most of my old ones fell apart! House of Hell was my favourite and I've been trying to make a computerised version for 10 years!
Here's the closest I've come: M.u.C.e.S , I'm trying to make a CYOA creation system and this was one of the efforts. Just unzip and run MuCeSRunner.exe.
-
Re: Choose Your Own Adventure.
DavidN: Although I've had MMF2 for a while, I've never really used it so INI files are all new to me! I'll definitely read up on that and hope you'd be able to help in the future? Also, you can have the honor of being beta tester. :grin:
-
Re: Choose Your Own Adventure.
I thought about doing a game like this once, but couldn't decide the best way.
I decided I didn't want to make it like the books, and so one idea I came up with was to have a "living world".
Say a platformer, your character automatically walks through the scenarios, but your giving the option to do different decisions as he gets to certain points.. the same way turning the pages in the books would do.
For example your character walks across a room, has a choice of going through a door, go up in a lift, or down in a lift. Choose the choice and the character responds.
Its a lot more work animation wise / graphically, but I think it would make a nice game that way.
Sorry just my 2 cents, thought id share my idea :)
-
Re: Choose Your Own Adventure.
Sounds like a great idea Spike, unfortunately, my drawing / animation skills are zero (I can't draw a box without it having 5 sides!) This is why the text version is my only option.
-
Re: Choose Your Own Adventure.
*Check out the M.u.C.e.S site I made a while ago - M.u.C.e.S*
-
Re: Choose Your Own Adventure.
Yes, It's an interesting idea. Been playing with it myself (in my head) :)
-
Re: Choose Your Own Adventure.
Nickydude, I made an ini tutorial. You'll find it on the Tutorials page.
I didn't read those books, but I read some with the same consept. Can't remember the name, but you had a timemachine.. :)
Is these the predecessor to the early computer text adventure games? :D
-
Re: Choose Your Own Adventure.
Thanks Popcorn, forgot all about that! But I'm now not sure an ini file would be the best choice. I'd like the location text to be able to use text effects like different font, bold, italic, different font colours plus some locations will be more that 1024 characters long.
This is something how I'd like it to look (obviously a lot better looking, but you get the idea :))
http://www.madladdesigns.co.uk/examples/mackscreen.jpg
Can that be done with an ini file?
-
Re: Choose Your Own Adventure.
Black text against a navy background! EEK!!! You'd really want to change that.
-
Re: Choose Your Own Adventure.
:) It will all be user definable.
-
Re: Choose Your Own Adventure.
yes,u can use INI for that... I'll upload an example.
-
Re: Choose Your Own Adventure.
-
Re: Choose Your Own Adventure.
Is this example still in the offering? :)
-
Re: Choose Your Own Adventure.
sorry it took so long... i got a bit obsessed.
just uploaded it then.
hopefully it isn't to confusing...
(check the file archive)
-
Re: Choose Your Own Adventure.
I loved those books when I was a kid.
Uncyclopedia's Choose Your Own Adventure
(obviously the real ones were better than Uncyclopedia's one)
-
Re: Choose Your Own Adventure.
Quote:
Uncyclopedia's Choose Your Own Adventure
Yay! I'm 25 again! :)
-
Re: Choose Your Own Adventure.
This is coming along slowly but surely :) M.A.C.K - exe
-
Re: Choose Your Own Adventure.
SEELE, thanks for the example (I'll keep looking it over) but try as I might, I just can't get my head around it. It's a bit complicated for me for now (I'm only a beginner! :))
I do have an idea how to go about it, it may be amateurish and long winded, but I'll know what the hell I'm doing!
I'm going to split the section texts and options into two files but need help parsing the options. The options file looks like this (in a simple text file):-
Will you rap on the door?
35
Will you pull the cord?
244
or creep around the house to investigate the light?
154
I'm guessing I have to parse this file but I'm not fully sure how. I'd like to be able to take the text only and place it in a list box while holding the numbers in variables ('choice1', 'choice2', choice3...) so if the player clicks on "Will you pull the cord?" it will return whatever is in 'choice2' ('244'), which I will then use to load in the next section ('sec224') and options ('opt224').
Any help would be appreciated. :confused:
-
Re: Choose Your Own Adventure.
Quote:
Originally Posted by DavidN
I have a lot of the Fighting Fantasy books at home (or at least the first fifty or so - I've no idea what number they're up to now, so that may or may not be 'a lot') - nice to see someone else who read them!
The String Parser object might help you here, but I think I would go for the approach of just reading in your descriptions and values from an INI or Named Variable Object rather than creating a format like this. The information you gave above could be represented as:
[Location86]
Description=You sit in a solid, carved chair and look around. The reception hall is certainly not what you would have expected from the outside. It is elegantly decorated with rich tapestries and fine oak panels. A number of portraits line the walls. A sturdy sixteenth-century table is set against one wall.
Option1=Will you wait for your host to arrive?
Target1=277
Option2=Study the paintings?
Target2=304
Option3=Hunt for a telephone?
Target3=238
("House of Hell", isn't it? I never got anywhere near completing that one.)
The way I've got it stored there, you could set the INI's current group to "Location" + [Current location number], then loop to put any items starting with "Option" into your list box. When an option is selected, you would look up "Target" + Str$(Currently selected line of the list box), get the location number from that, and set the INI's current group to "Location" + [Current location number] all over again.
You've got me all nostalgic now...
I'm having a little trouble reading the various parts of the ini file as I'm not really sure how to go about it. I've tried:
http://www.madladdesigns.co.uk/temp/inihelp.png
which is supposed to but the first part in a Rich Text Box but as you can see, it obvious I don't really know what I'm doing. I been following PopCorn's ini tutorial but that's just for loading a number into a counter. Perhaps a more in depth ini tutorial for us newbies? ;)
-
Re: Choose Your Own Adventure.
Hi Nickydude,
I must recommend this tutorial for you: http://create-games.com/article.asp?id=188. It teaches from the ground up about INI files, so you'll be a master in no time. Hope that helped!
-
Re: Choose Your Own Adventure.
Thanks, that helped a lot, but I can't seem to get the first part [Location] into the RTF box, shouldn't this do it?.
http://www.madladdesigns.co.uk/temp/inihelp2.png
-
Re: Choose Your Own Adventure.
It looks like it should... what are the contents of location086.ini? (And is it in the same folder as your MFA?)
-
Re: Choose Your Own Adventure.
You don't need to set the current group or item with that code. Also, try using Apppath$ + "localtion086.ini".
-
Re: Choose Your Own Adventure.
@DavidN: location86.ini is in the same folder as the MFA and the contents are exactly what you put in your post!
@Jam: I've removed the current group and item and used Apppath$ + "localtion086.ini" but still nothing.
Here's the mfa + ini file. No doubt is something stupendiously stupid i'm overlooking but any help would be appreciated! MFA + INI FILE
-
Re: Choose Your Own Adventure.
A couple of things to fix the example:
- Your INI points to "location86.ini" but the name of the file is "location086.ini" (it's safer to use Apppath$ + "location086.ini")
- Add "Set current item to "Description" after you set the Location (make sure that this comes before trying to read the paragraph using the RTF object)
- Use the RTF object's "Set Text" action rather than "Set RTF Text". I haven't used the RTF object enough to say for sure, but I think it'll just ignore anything that isn't in RTF format when you use the action you currently have.
There are two approaches to using the INI object. Either you can set a 'current' group and item then read from wherever those two things are pointing to (useful if you're doing things like looping), or you can use the combined action to read from a definite place, giving a specific group and item to read. How you do it is largely up to you.
-
Re: Choose Your Own Adventure.
YAY! Thanks Guys, I've now got the location in the rtf box. :D :grin:
-
Re: Choose Your Own Adventure.
Is it possible to load a value from an ini file into a 'Formatted Text' box? i can load it into the RTF box ok, but I want a transparent background so I'm trying to use a Formatted Text box but no matter what I try, I can't get the text to display!
-
Re: Choose Your Own Adventure.
*sigh*, now it seems you can't have paragraphs in an ini file. It displays the first paragraph only. It seems like one step forward, two steps back.
Quote:
[Location]
Description=You climb the creaking steps up to the front door and pause to catch your breath. Even though you ran all the way up the drive from the car, you are soaked through; your feet are particularly wet. Judging by the number of puddles you stepped into in the dark, the drive needs a small fortune spending on repairs. But under the porch, you are out of the storm, and you brush the rain from your clothes before turning towards the door.
The rain is still pelting down, but an eerie silence hangs in the air. No lights are on downstairs. You step back off the porch to check the upstairs window which attracted you're attention earlier. Nothing. No lights. The whole place seems to be deserted. But then you remember the time - five minutes to midnight. Everyone in the house has probably gone to bed. An owl hoots in the distance and a shiver runs down your spine. The situation is a little scary. Here you are, in the middle of nowhere, at some strange, run-down old house about to wake up whoever lives inside, at midnight. They certainly won't be too pleased. but you have no choice if you are going to make your appointment tomorrow - you must reach a telephone to call for help. You step up to the front door.
From the left-hand side of the house, a dull glow catches your attention. A light has been turned on! You breathe a sigh of relief; at least someone is awake. You consider your options: there is an elaborate knocker in the middle of the door and a bell-pull hanging down to the right.
[Options]
Option1=Will you rap on the door?
Target1=35
Option2=Will you pull the cord?
Target2=244
Option3=or creep around the house to investigate the light?
Target3=154
-
Re: Choose Your Own Adventure.
Personally I wouldn't use INI for this problem, I would use XML.
Something like:
Code:
<Rooms>
<Room id="front">
<Description>You were called to deliver a pizza to an abandoned house.
As you arrive near the door you hear a scream come from inside the house. </Description>
<Directions n="foyer" s="retreat">To the north lies the entrance to the house,
to the south is the path back home</Directions>
</Room>
<Room id="foyer">
<Description>You enter the foyer of the house and you see a pack of matches on the floor.</Description>
<Directions s="front">Right now you can return to the front of the house</Directions>
<Item id="Matches">A pack of matches</Item>
</Room>
<Room id="retreat">
<Description>As you leave the house a lightning bolt strikes you dead. GAME OVER</Description>
</Room>
Obviously this is just a very simple example. The key is to have "rooms" which can be traveled between by your parsing system.
I wish I could spend more time describing this in detail but I don't have time right now.
Good luck!
-
Re: Choose Your Own Adventure.
That sounds great vortex, but I wouldn't have the faintest clue how to parse it! I'm struggling with ini files as it is (and I've heard they're simple :) )