Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anyone interested in making a text adventure as a group?
#61
Quote:oh. i thought that because when you said this

Quote:That's going out of my league. I don't know how to make those complex ones work.

well i think Alex knows what the hell he's doing. I mean, he wrote a 3d program in qb!!! :o

the 3d QB can do is...very crappy, so don't give me any credit there...
and i'm no super-genius....
just another programmer with different ideas

Oz~
Reply
#62
Quote:I've seen this before. This is all we really need to do:

Let's say the player inputs a command. Let's make that command "TAKE SWORD".

Alphabetize the command pool DATA.
Code:
DATA "eat", "sleep", "TAKE"

Then, take the first letter of the command and store it.
Code:
FLCOM$ = UCASE$(MID$(INP$,1,1)

Next, find all the DATA that starts with that letter.
Code:
DIM COMMANDS(*however many we have*) AS STRING * *length of biggest string*

RESTORE CommandStart
FOR I = 1 TO *however many commands we have availible*
   READ cominp$
   cominp1$ = UCASE$(MID$(cominp$, 1, 1)
   IF cominp1$ = FLCOM$ THEN COMMANDS(I) = cominp$
NEXT I

So, now we have all the commands that start with T.
Now, we have to narrow it down to our command.


First, find all the letters of the first word. Just in case, add a space to the end.
Code:
FOR I = 1 TO LEN(IN$)
WHILE ALLETT$ <> CHR$(32)
   ALLETT$ = UCASE$(MID$(IN$,I,1)
   a = a + 1
WEND
NEXT I
a = a - 1

That gave us the number of text symbols before the space.

Then,

I'll finish this later...[/code]


would you care to explain what's the point of this? :roll:
Reply
#63
it's a way of seeing what command is being done.....but that only relies on the fact that the user inputs like this:
"action object"

we need a system that could work very dynamically, but quickly, so if the user was being a bit of a tool, he could write:
"ya....ummm.... take t3h 1337 disk",
the program would parse to see

illegit terms = "ya....ummm.... ", "t3h", "1337" (unless we had to specify)
action = "take"
object = "disk"

we could do alphabit checks on each one to optimize search time....
just check the beginning of each word, and compare it to the list of commands and objects....if it doesn't exist, then it's of no consequence....

oz~

:: I should put an example Tongue ::

[syntax="qbasic"]OPTION EXPLICIT
OPTION ESCAPE

#DEFINE alph_start 1
#DEFINE alph_entries 2

DIM commands(400) AS what_ever_type_we_choose ' this is just an example....

' We'll sort the commands into alphabetical order....
' Then setup another array to have starts and beginnings of letters

DIM alphabit_cmd(ASC("a") TO ASC("z"), 1 to 2) AS INTEGER

alphabit_cmd(ASC("a"), alph_start) = 0
alphabit_cmd(ASC("a"), alph_entries) = 5 ' 5 entries, offset of 0 in the array
albabit_cmd(ASC("b"), alph_start) = 5 ' we know it ends at five, because 0+5=5
alphabit_cmd(ASC("b"), alph_entries) = 5 ' now we ave 10 of 400 covered......
'obviously when loading the commands, we can easily do
'this through a recrusive algorithm


DIM user_command AS STRING

user_command = "This is just a check"

' Lots of jibberish inbetween

DIM i as integer, old_i as integer, word as string

i = 0

WHILE (i = INSTR(user_command, " ", old_i + 1)
if(i < 1) then exit while

word = trim$(mid$(user_command, old_i, i))
print mid$(word, 1, 1) ' First letter....
' do a comparison test here.....

old_i = i
WEND[/syntax]
Reply
#64
i think its putting stuff in the Inventory/main option screen? :???: :lol: :roll:
Itch-Five Design - Your source for free, well designed, web design.
- - - - - - - - - - - - -
Quote:I use QB religiously. Too bad I'm an athiest.
Reply
#65
No, it's reading the command that was entered.

K, I left off adding the space to the end.

Code:
FOR I = 1 TO LEN(IN$)
WHILE ALLETT$ <> CHR$(32)
   ALLETT$ = UCASE$(MID$(IN$,I,1)
   a = a + 1
WEND
NEXT I
a = a - 1

Here's what I was going for:
You type in what you want to do. Then, the computer searches through the command bank and takes out the command you typed. If the phrase after the command is recognised, then print out the appropriate command. Theoretically, it should work. It's kinda hard to explain when using a computer without QB/FB (I don't have internet at home)...

But, we should create a list of general commands that can be used through the game.
Reply
#66
no offense, but if it's just checking to see what the user entered, there's probably much easier ways to do it.... or am i confused?
Reply
#67
I think in the long run it would shorten it if I'm following this right. instead of

Code:
IF (X="TAKE KEY") OR (X="TAKE THE KEY") OR (X="GRAB KEY") THEN

You could search the data for those words. The problem I see though is...what if the user says "take and throw the key", then it would still accept it as "take key" right?
Not yet Snake! It's not over yet!
Reply
#68
Tom, I think that would take too long. I think Alex had a pretty good start going. So let me get one thing straight. This is going to be a QB game? or an FB game? Tongue
Reply
#69
I don't have FB and I've never used it, so QB. I've never experimented with that whole data thing...Just try to see what works best seeing how you guys probably know the better ways...
Not yet Snake! It's not over yet!
Reply
#70
Huh? It's going to be made in QB?
*Backs away slowly considering he doesnt even own a copy of that program let alone if it worked*

Don't worry, I'll still be able to do some things... :wink:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)