ZORK RPG

Making a ZORK game

Page 1 of 1

13 Replies - 10554 Views - Last Post: 10 October 2009 - 07:59 PM Rate Topic: -----

#1 FbSa  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 03-February 08

ZORK RPG

Posted 11 February 2008 - 04:00 PM

I'm trying to make a ZORK (txt) RPG. But I don't really have a starting point. The first thing that comes up is...

You find yourself at a fork in the road.
Left or Right

But I don't know what to do in the edit box. I want to set it up like...
  If (a = "right")
	{Label1->Caption = "You find yourself at a stream";
	  Label2->Caption = "Cross stream";
	  Label3->Caption = "Follow Stream";}
  else
	{Label1->Caption = "You come to a town";
	  Label2->Caption = "Go into town";
	  Label3->Caption = "Go around town";}



But from there on I'm stuck. I don't know how to get the edit box to reconize it as text either.
a = Edit1->Text.To


Then I'm lost. Or do I just leave it as text? Or do I type Text.ToText; ?

And once I've ran through the first code, what do I type for the next set? Would I just type
  if (a = "Cross stream")
	{Label1->...
	 Label2->...
	 Label3->...}
	if (a = Go into town)
	  {Label1->Caption = .....
		Label2......
		Label3......}
	  if (a = "Follow stream)
	   ......................
		if (a = "Go around town)
		  ...................



Not a school assignment, so it doesn't have to be that neat looking. The code can get a little sloppy looking. (As long as it doesn't affect the performance)

Is This A Good Question/Topic? 0
  • +

Replies To: ZORK RPG

#2 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: ZORK RPG

Posted 11 February 2008 - 07:09 PM

What language is this?
Was This Post Helpful? 0
  • +
  • -

#3 FbSa  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 03-February 08

Re: ZORK RPG

Posted 12 February 2008 - 08:06 AM

C++
Was This Post Helpful? 0
  • +
  • -

#4 schnalf  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 129
  • Joined: 09-February 08

Re: ZORK RPG

Posted 12 February 2008 - 08:36 AM

i dont have the borland c++ builder installed, but i think Edit1->Text refers the value as a string, without the ".To" at the end.

another thing: you wants to compare a with some strings in your if loops, there you need == and not = for the comparison. and in your third code you miss some "
Was This Post Helpful? 0
  • +
  • -

#5 FbSa  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 03-February 08

Re: ZORK RPG

Posted 12 February 2008 - 02:49 PM

Alright, so to get it to reconize it as text I just type

a = Edit1->Text


?
Was This Post Helpful? 0
  • +
  • -

#6 schnalf  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 129
  • Joined: 09-February 08

Re: ZORK RPG

Posted 13 February 2008 - 07:56 AM

doesn't
string a = Edit1->Text;

if (a == "right")
	{Label1->Caption = "You find yourself at a stream";
	  Label2->Caption = "Cross stream";
	  Label3->Caption = "Follow Stream";}
  else
	{Label1->Caption = "You come to a town";
	  Label2->Caption = "Go into town";
	  Label3->Caption = "Go around town";}


work?

i can't test it, but i think so.

or where is the problem?
Was This Post Helpful? 1
  • +
  • -

#7 FbSa  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 03-February 08

Re: ZORK RPG

Posted 13 February 2008 - 06:21 PM

Well, I was informed that I should use Case statements. So it doesn't have to test 150 lines or so each time. But, if I use case statements, you could type in the last line and win the game couldn't you?

I just got Visual Studio, and don't know how to run it yet, so I won't be able to test it for awhile.
Was This Post Helpful? 1
  • +
  • -

#8 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 726
  • View blog
  • Posts: 8,638
  • Joined: 14-September 07

Re: ZORK RPG

Posted 13 February 2008 - 06:23 PM

I'd like to find some solid tutorials on txt based rpg's myself. I kicked around the idea of making one of them. I was thinking like a Sports based one..
Was This Post Helpful? 1
  • +
  • -

#9 Syntax_Terror  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 204
  • Joined: 03-September 07

Re: ZORK RPG

Posted 13 February 2008 - 07:31 PM

View Postnykc, on 13 Feb, 2008 - 06:23 PM, said:

I'd like to find some solid tutorials on txt based rpg's myself. I kicked around the idea of making one of them. I was thinking like a Sports based one..


A sports based RPG... Have a few medieval flashbacks...

You pop the ball with your greatsword for 16 damage.

You drop back and punt, It's taken on the 50 yardline, by a hobgoblin, he cast a modoki spell for a gain of ten yards. First and ten on the 40...

Now there's a game!!!!!

:)
Was This Post Helpful? 0
  • +
  • -

#10 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 726
  • View blog
  • Posts: 8,638
  • Joined: 14-September 07

Re: ZORK RPG

Posted 13 February 2008 - 08:13 PM

I think you are on to something there.

lol.
Was This Post Helpful? 0
  • +
  • -

#11 FbSa  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 03-February 08

Re: ZORK RPG

Posted 14 February 2008 - 07:34 AM

Anyone else ever tried t crossover from Borland to Visual studio and find the switch to suck?
Was This Post Helpful? 0
  • +
  • -

#12 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 726
  • View blog
  • Posts: 8,638
  • Joined: 14-September 07

Re: ZORK RPG

Posted 14 February 2008 - 10:59 AM

lol - i did the opposite and was happier in long run
Was This Post Helpful? 0
  • +
  • -

#13 FbSa  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 03-February 08

Re: ZORK RPG

Posted 16 February 2008 - 06:28 PM

Can anyone tell me how to store a as text? Nothing I've done has worked yet.
Was This Post Helpful? 0
  • +
  • -

#14 day3software  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-October 09

Re: ZORK RPG

Posted 10 October 2009 - 07:59 PM

View PostFbSa, on 16 Feb, 2008 - 05:28 PM, said:

Can anyone tell me how to store a as text? Nothing I've done has worked yet.

Do you mean store a variable me and my team are making a zork-like game this is how to store char vars
	  char variablename = 'texthere';


or if this isn't what you mean just specify what you mean, also you should write your outputs and inputs like this:
	  cout << "Text you want displayed here.\n"; //P.S. "\n" Just moves cursor to next line.
	  cin >> variableyouwanttextstoredin;
	  cin.clear();


Also this is how you would build that inro
{
	char a;
	cout << "You find yourself at a fork in the road.\n";
	cout << "Left or Right?\n";
	cin >> a;
	cin.clear();
	cin.ignore(INT_MAX,'\n');
	cout << "\n";
	if (a == 'right')
	{
		cout << "You find yourself at a stream.\n";
		cout << "Cross stream or Follow Stream.\n";
		//put continuation right here
	}
	if (a == 'right')
	{
		cout << "You come to a town.\n";
		cout << "Go into town or Go around town.\n";
	}
	if (a /= 'left','right')
	{
		cout << "Incorect Value.\n";
		break;
	}
}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1