Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anyone interested in making a text adventure as a group?
#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


Messages In This Thread
Anyone interested in making a text adventure as a group? - by Oz - 10-18-2005, 03:50 AM
been thinkin - by zoasterboy - 10-22-2005, 10:54 AM
sorry! - by phycowelder - 10-23-2005, 12:13 PM
before... - by zoasterboy - 10-24-2005, 07:43 AM
story line - by zoasterboy - 10-25-2005, 04:47 AM
yah - by zoasterboy - 10-25-2005, 07:26 AM
main menu - by zoasterboy - 10-26-2005, 05:13 AM
joining - by phycowelder - 10-26-2005, 05:25 AM
^^ - by zoasterboy - 10-26-2005, 05:27 AM
Anyone interested in making a text adventure as a group? - by Anonymous - 10-26-2005, 05:34 AM
Re: ^^ - by Liquid Snake - 10-26-2005, 06:18 AM
cool! - by phycowelder - 10-26-2005, 06:56 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)