Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
GRRR! help with a text quest engine Posted by Legacy on 31 Mar 2003 at 12:03 PM
This message was edited by Legacy at 2003-3-31 12:16:14

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.


Report
Re: GRRR! help with a text quest engine Posted by zibadian on 31 Mar 2003 at 12:30 PM
: This message was edited by Legacy at 2003-3-31 12:16:14

: 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.
Report
Re: GRRR! help with a text quest engine Posted by Legacy on 1 Apr 2003 at 4:46 AM
: : This message was edited by Legacy at 2003-3-31 12:16:14

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




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.