Newbie asks: Select from Files of Words to create strings

Non-platform specific questions.

Newbie asks: Select from Files of Words to create strings

Postby ggesterGamePro99 » Mon Apr 16, 2012 10:00 pm

One of my projects is a interactive story/game

where you can change all the outcomes of every scene and even the end of the story and the beginning
through what you say to other characters, affecting their feelings. and based on that they take revenge, come back to fight.. cry, whatever.

You push a key to create a dialog buble and the player actor says something..It is a random phrase created from a list of good words, bad words etc.
The lists would be in separate text files.


So my question is..Is it possible to create in Text Editor, files with a list of words and then have your game select random words from chosen file? in order to create a string to display in the dialog bubble.
ggesterGamePro99
 
Posts: 44
Joined: Mon Apr 16, 2012 1:53 am
Score: 0 Give a positive score

Re: Newbie asks: Select from Files of Words to create string

Postby skydereign » Mon Apr 16, 2012 11:39 pm

File operations are allowed in C, and act similarly in gE. You have to use FILE* variables, and different file access functions. For instance you use fopen to open the actual file, and fscanf or fgets to read from a file. I suggest searching the forums for more detailed explanation of how it is done.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest