Creating a fictional forum

So in my game currently, I’m creating a computer, where the mc makes a new post every 12 hours in the university-forum and then the other npcs replys with new posts. How do I create the code to do so?

Here’s what I wrote so far:

*if ((created = true) and (hour >= 12)) #Make a new post

You decide to make a new post on your [i]${forum}[/i] forum! 

You can make a new post every 12 hours.
*input_text post

[b]${Username}:[/b] [i]${post}[/i]

*set electricity - 5

*page_break You posted on ${forum}!

*goto computer

And the following:

*if ((created = true) and (hour >= 12)) #Check your postbox

You decide to check if anyone replied to your messages.

[b]${Username}:[/b] [i]${post}[/i]

*set electricity - 5

*page_break Okay...

*goto computer
1 Like

That’s kind of up to you. How are you going to determine when 12 hours pass in-game? What events in the game will lead to someone replying to your post? Do you want a random outcome that determines whether someone replies? Do you want the player to take certain actions that result in someone replying? All this is dependent on what you want.

Yes, that is what I want. Basically I would like it if the npcs respond to certain key phrases (ie werewolf for Lexi, or vampire for Tetris, plant for Misako, etc) they would be much more likely to respond to your posts (within 12 hours or so) with their own randomised commentary

Well, there’s no way to check for words in a string currently. This is the only workaround.

As for the randomized commentary from the other characters, that can be achieved using *rand to set a number to a variable. You then use that variable with *if, *elseif, and *else commands to write out their replies.

1 Like

It’d be hard to code since many context can present depending on phrase configuration. Not to mention if the player goes, “do plants fight zombies?” which is already 2 keywords in an input.

I’d personally suggest for a *choice listing many possible comment/reply/topic and go from there, instead of doing parser-style cyoa.

1 Like

When you say that do you mean something like, or is there a better way to do it:

*if ((created = true) and (hour >= 12)) #Reply to ${topic}

You decide to reply to something on your [i]${forum}[/i] forum! 

[b]${database}:[/b] You can only make one reply every 12 hours.
*page_break Reply to the topic...

[b]${Username}:[/b] Our main topic for today is all about ${topic}, so here's my reply to it.
*input_text post

[b]${Username}:[/b] [i]${post}[/i]

*set electricity - 5

*page_break You replied on the ${forum} as ${Username}!
*goto computer
1 Like

I think the suggestion was more for a traditional list of choices.

What do you want to reply with?"
        #Zombies are so cool!
                *set post "Zombies are so cool!"
                *set topic "zombies"
        #I love plants.
                *set post "I love plants."
                *set topic "plants"

Etc. That way you can always guarantee that a post can have a topic that another character can reply to, and the player can still chose their topic.


If you’re just at the beginning of your game, you may want to consider different engines. Twine is an interactive fiction tool that can create things like that, but it involves Javascript. Here is an example:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.