Questions tagged [text-based]

233 questions
0
votes
1 answer

java program how add a function that goes back code if player has inputted it wrong

I have a problem with my program is not with the code is how I am going to do it that's the confusing part that I am stuck with. just to let you know I am a basic java coder I do not understand complicated stuff so bear in mind that my code isn't…
0
votes
1 answer

Re-printing line in a loop if 'X' value isn't met in Java

I am trying to make my code re-print a line if the value isn't met. I have tried using while but it wont revert back to the question if 'X' isn't greater than or equal to 1. I am currently trying: import java.util.Scanner; public class rpg { …
0
votes
1 answer

Have the boolean value of var follow into another file

I have two files in my text-based game. The variable that is being assigned will be keep_note. If you enter "Take" the boolean value True is assigned to the have_note-001 but in the next file when if have_note_001 == True I get an error saying…
0
votes
4 answers

C# Simple console application displaying/logical issue

List numberList = new List(); List uniqueList = new List(); string input; int number = 0; bool over = false; while (!over) { input = Console.ReadLine(); …
lapartman
  • 45
  • 1
  • 7
0
votes
2 answers

Text-based adventure game looping to previous line?

I am learning Python by creating a text-based adventure game. I was having a difficult time figuring out if I could call a previous variable. For example, this is a snippet of my code (advice on how to consolidate would be helpful haha) I have an if…
0
votes
3 answers

How to create a delay before each print?

Hi so I'm creating a text-based game with Python and I want to make it so that before each print statement there is a one second delay. My current solution is to do this: time.sleep(1) name = input('Do you happen to remember what your name was?…
Bob Bob
  • 13
  • 2
0
votes
1 answer

I'm creating a text based fighter program with Python 3.6 (32-bit) and changing a function to a dictionary

So, here is what I'd like to do. Here is my code: def weapon(): '''A list of the available weapon''' print("Here is your weapon choices for today: ") print("1. Flail:\n Damage: 1,6 \n Heal: 1, 3") print("2. Dagger:\n Damage:…
Dre
  • 63
  • 1
  • 1
  • 9
0
votes
0 answers

How to reference class instances in Java methods for a basic text-based game inventory?

I am trying to make a text-based game in Java. I came up with a very basic text inventory and a few methods: one to add a new item when found, one to remove it when used, and one to open the inventory itself. I used to reference the items as…
0
votes
1 answer

How can I replace a letter placeholder with a letter when it's been correctly guessed?

Every time I use this code it says I've guessed the wrong letter. I need it to be able to replace the guessed letter with the underscore if it's in the word. function guess(){ for (var j = 0; j < words.length; j++) { if (words[j] ===…
Morgan
  • 1
0
votes
1 answer

Saving Text Based Adventure Game

I'm looking for an efficient way to save my game coded in python. I've looked at pickle, but I'm not sure it will suit my needs as there is a lot of info that needs to be saved. The way I understand pickle is it will take whatever I give it and dump…
Macimoar
  • 69
  • 2
  • 8
0
votes
2 answers

How do you place an Object inside a Room in a text-based game?

I'm a coding newbie (and despite what my user name may imply I am far from a pro), and I'm trying to write my own text-based adventure game. I have two questions. First, I want to implement an Object class. These Objects have names and descriptions…
0
votes
3 answers

python text base game and/or functions error?

I am creating a prison escape and in a specific puzzle, the player is supposed to mutilate a hand, soap the hand, then wash it in order to get access by a scanner in a different room. The first time the player chooses to mutilate the hand, in the…
Jtob
  • 1
0
votes
0 answers

Is elinks the only text-based browser that has extensible support for scripts like lua?

Extensibility by lua scripting has made me choose elinks text-based browser among the many alternatives out there. However, it is not obvious to me and hard to pinned down if wither the other text-based browsers also support some kind of extension…
daparic
  • 3,794
  • 2
  • 36
  • 38
0
votes
1 answer

Can't figure out what is wrong with my inventory in my text-base game

So I want to be able to remove and add items in an inventory that I tried creating in my game but I keep receiving an error. This is my code: inventory={} def add_to_inventory(): inventory.append() elif choice == "use h on razor": print…
John
  • 37
  • 5
0
votes
2 answers

Inventory help Python

So I'm trying to arrange how the gameplay of my text base game will function if the player may/not have certain items in their inventory. print ("You are back in your cell. You saw your bed, broken sink, grotty toilet, cut up jumpsuit") if…
John
  • 37
  • 5