Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,471 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,943 people online right now. Registration is fast and FREE... Join Now!




ZORK RPG

2 Pages V  1 2 >  
Reply to this topicStart new topic

ZORK RPG, Making a ZORK game

FbSa
11 Feb, 2008 - 03:00 PM
Post #1

New D.I.C Head
*

Joined: 3 Feb, 2008
Posts: 10


My Contributions
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...
CODE

  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.
CODE

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
CODE

  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)
User is offlineProfile CardPM
+Quote Post

Tom9729
RE: ZORK RPG
11 Feb, 2008 - 06:09 PM
Post #2

Debian guru
Group Icon

Joined: 30 Dec, 2007
Posts: 1,582



Thanked: 12 times
Dream Kudos: 325
My Contributions
What language is this?
User is online!Profile CardPM
+Quote Post

FbSa
RE: ZORK RPG
12 Feb, 2008 - 07:06 AM
Post #3

New D.I.C Head
*

Joined: 3 Feb, 2008
Posts: 10


My Contributions
C++
User is offlineProfile CardPM
+Quote Post

schnalf
RE: ZORK RPG
12 Feb, 2008 - 07:36 AM
Post #4

D.I.C Head
**

Joined: 9 Feb, 2008
Posts: 124



Thanked: 2 times
My Contributions
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 "
User is offlineProfile CardPM
+Quote Post

FbSa
RE: ZORK RPG
12 Feb, 2008 - 01:49 PM
Post #5

New D.I.C Head
*

Joined: 3 Feb, 2008
Posts: 10


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

CODE
a = Edit1->Text


?
User is offlineProfile CardPM
+Quote Post

schnalf
RE: ZORK RPG
13 Feb, 2008 - 06:56 AM
Post #6

D.I.C Head
**

Joined: 9 Feb, 2008
Posts: 124



Thanked: 2 times
My Contributions
doesn't
CODE

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?
User is offlineProfile CardPM
+Quote Post

FbSa
RE: ZORK RPG
13 Feb, 2008 - 05:21 PM
Post #7

New D.I.C Head
*

Joined: 3 Feb, 2008
Posts: 10


My Contributions
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.
User is offlineProfile CardPM
+Quote Post

Nykc
RE: ZORK RPG
13 Feb, 2008 - 05:23 PM
Post #8

That Just Happened!
Group Icon

Joined: 14 Sep, 2007
Posts: 4,470



Thanked: 18 times
Dream Kudos: 275
My Contributions
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..
User is online!Profile CardPM
+Quote Post

Syntax_Terror
RE: ZORK RPG
13 Feb, 2008 - 06:31 PM
Post #9

D.I.C Head
**

Joined: 3 Sep, 2007
Posts: 204


My Contributions
QUOTE(nykc @ 13 Feb, 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..


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!!!!!

smile.gif



User is offlineProfile CardPM
+Quote Post

Nykc
RE: ZORK RPG
13 Feb, 2008 - 07:13 PM
Post #10

That Just Happened!
Group Icon

Joined: 14 Sep, 2007
Posts: 4,470



Thanked: 18 times
Dream Kudos: 275
My Contributions
I think you are on to something there.

lol.


User is online!Profile CardPM
+Quote Post

FbSa
RE: ZORK RPG
14 Feb, 2008 - 06:34 AM
Post #11

New D.I.C Head
*

Joined: 3 Feb, 2008
Posts: 10


My Contributions
Anyone else ever tried t crossover from Borland to Visual studio and find the switch to suck?
User is offlineProfile CardPM
+Quote Post

Nykc
RE: ZORK RPG
14 Feb, 2008 - 09:59 AM
Post #12

That Just Happened!
Group Icon

Joined: 14 Sep, 2007
Posts: 4,470



Thanked: 18 times
Dream Kudos: 275
My Contributions
lol - i did the opposite and was happier in long run
User is online!Profile CardPM
+Quote Post

2 Pages V  1 2 >
Reply to this topicStart new topic
Time is now: 1/7/09 02:34PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month