GRRR! help with a text quest engine - Programmers Heaven

Howdy, Stranger!

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

Categories

GRRR! help with a text quest engine

LegacyLegacy Posts: 4Member
[b][red]This message was edited by Legacy at 2003-3-31 12:16:14[/red][/b][hr]
Hi, i'm trying to develope a text based quest game, and i just wrote the prototype in which i tried to execute th engine i had in mind.
i haven't develope a vocabulary based system yet, for now i'm just trying a few existing commands, "look at" "open door" "pick up key" etc.
my idea was to make a repeat loop for this (the loop ends once the player walks out of the room) that reads a string and then uses case like this

case string of
'look': 'blah blah';
'open door': 'blah blah';

i was astonished to find out that case doesn't support strings!
maybe that's obvious but i'm relatively new to this
baisicly what i wanted to know is since i don't feel like writing a thousand IF's is there another convenient methude like the CASE one?
also do you know of any old games, text quests in particular that were programmed with pascal that i can get my hands on their source code?

thanks.


Comments

  • zibadianzibadian Posts: 6,349Member
    : [b][red]This message was edited by Legacy at 2003-3-31 12:16:14[/red][/b][hr]
    : Hi, i'm trying to develope a text based quest game, and i just wrote the prototype in which i tried to execute th engine i had in mind.
    : i haven't develope a vocabulary based system yet, for now i'm just trying a few existing commands, "look at" "open door" "pick up key" etc.
    : my idea was to make a repeat loop for this (the loop ends once the player walks out of the room) that reads a string and then uses case like this
    :
    : case string of
    : 'look': 'blah blah';
    : 'open door': 'blah blah';
    :
    : i was astonished to find out that case doesn't support strings!
    : maybe that's obvious but i'm relatively new to this
    : baisicly what i wanted to know is since i don't feel like writing a thousand IF's is there another convenient methude like the CASE one?
    : also do you know of any old games, text quests in particular that were programmed with pascal that i can get my hands on their source code?
    :
    : thanks.
    :
    :
    :
    I've written a full-fledged text-adventure engine once (sorry I lost the source). But what I did this:
    Create an array of all the vocabulary in your game in the following way.
    Each word is not simply a string but is also accompanied by a number(this is easiest if using records). After the user type a command, substitute each word (or word group) for this number. It sounds harder that it is. This will make a command like 'get key' become '5 12'. Then you have a list of integers, which can be used in a case-of. The second advantages of this system is that synonims are very easy to add. For example: 'pick up key' will also become '5 12', because GET and PICK UP are often the same.

    I hope you can follow this explanation. There are several small difficulties to solve, like replacing the words for the numbers. Let me hear if you are able to code this.
  • LegacyLegacy Posts: 4Member
    : : [b][red]This message was edited by Legacy at 2003-3-31 12:16:14[/red][/b][hr]
    : : Hi, i'm trying to develope a text based quest game, and i just wrote the prototype in which i tried to execute th engine i had in mind.
    : : i haven't develope a vocabulary based system yet, for now i'm just trying a few existing commands, "look at" "open door" "pick up key" etc.
    : : my idea was to make a repeat loop for this (the loop ends once the player walks out of the room) that reads a string and then uses case like this
    : :
    : : case string of
    : : 'look': 'blah blah';
    : : 'open door': 'blah blah';
    : :
    : : i was astonished to find out that case doesn't support strings!
    : : maybe that's obvious but i'm relatively new to this
    : : baisicly what i wanted to know is since i don't feel like writing a thousand IF's is there another convenient methude like the CASE one?
    : : also do you know of any old games, text quests in particular that were programmed with pascal that i can get my hands on their source code?
    : :
    : : thanks.
    : :
    : :
    : :
    : I've written a full-fledged text-adventure engine once (sorry I lost the source). But what I did this:
    : Create an array of all the vocabulary in your game in the following way.
    : Each word is not simply a string but is also accompanied by a number(this is easiest if using records). After the user type a command, substitute each word (or word group) for this number. It sounds harder that it is. This will make a command like 'get key' become '5 12'. Then you have a list of integers, which can be used in a case-of. The second advantages of this system is that synonims are very easy to add. For example: 'pick up key' will also become '5 12', because GET and PICK UP are often the same.
    :
    : I hope you can follow this explanation. There are several small difficulties to solve, like replacing the words for the numbers. Let me hear if you are able to code this.
    :
    good idea tanks, i think i can write it in code, especially when i'll get to check out records.

Sign In or Register to comment.