Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Question...

I'm young and inexperienced (15) in the ways of BASIC...

I'm just trying to create a small text-based game. I know less than half of the BASIC

language I'd say. But, my question is. As the persona would go into another room, would I have

to copy the case file for his commands over and over? Or is there a way to create something

where in any room, he could type in any command and it would come up without having to copy..

Ex:

50

...

...

CASE IS = "stats"

PRINT "Stats are": a; b; c; d

GOTO 50

CASE IS = "go north"

GOTO 100

100

PRINT "..."

SELECT CASE

CASE IS = "stats"



Do I have to keep on redoing the thing? Over and over in each of the rooms for

stats? Or is there a way I can just type it out once, so if the person enters it in, it'll come up without

having to go through and copy the CASE again?



^-'_|`-0-[[==Greck==]]-0-'|_/`-^


Comments

  • : I'm young and inexperienced (15) in the ways of BASIC...

    : I'm just trying to create a small text-based game. I know less than half of the BASIC

    : language I'd say. But, my question is. As the persona would go into another room, would I have

    : to copy the case file for his commands over and over? Or is there a way to create something

    : where in any room, he could type in any command and it would come up without having to copy..

    : Ex:

    : 50

    : ...

    : ...

    : CASE IS = "stats"

    : PRINT "Stats are": a; b; c; d

    : GOTO 50

    : CASE IS = "go north"

    : GOTO 100

    : 100

    : PRINT "..."

    : SELECT CASE

    : CASE IS = "stats"

    :

    : Do I have to keep on redoing the thing? Over and over in each of the rooms for

    : stats? Or is there a way I can just type it out once, so if the person enters it in, it'll come up without

    : having to go through and copy the CASE again?

    :

    : ^-'_|`-0-[[==Greck==]]-0-'|_/`-^

    :



    Generally, in every game I've seen at least, there is a main game loop. And throughout the game loop data is updated or whatever. Making a game where you have 50000 case's WOULD not be good. What you need is a data structure... and make each room fit to this data structure. And in this data structure you would have things like, guys in the room, objects in the room, which room is to the north, which room is to the south, which room is to the west, and so on.

    After you decide how you want your data structure arranged you simply go through the loop, and if they type go north, you simply go to the room that the current room says is to the north... then you can avoid all those yucky if's and case's.

    Hopefully, you have some idea of what I just spewed out... if not just email me, I'll show you an example.


Sign In or Register to comment.