![]() |
Anyone interested in making a text adventure as a group? - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html) +--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html) +--- Thread: Anyone interested in making a text adventure as a group? (/thread-8166.html) |
Anyone interested in making a text adventure as a group? - Oz - 10-17-2005 Quote:oh. i thought that because when you said this 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~ Anyone interested in making a text adventure as a group? - speedlemon - 10-18-2005 Quote:I've seen this before. This is all we really need to do: would you care to explain what's the point of this? :roll: Anyone interested in making a text adventure as a group? - Oz - 10-18-2005 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 ![]() [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] Anyone interested in making a text adventure as a group? - Mr Match - 10-18-2005 i think its putting stuff in the Inventory/main option screen? :???: :lol: :roll: Anyone interested in making a text adventure as a group? - j2krei08 - 10-18-2005 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$) 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. Anyone interested in making a text adventure as a group? - speedlemon - 10-19-2005 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? Anyone interested in making a text adventure as a group? - Liquid Snake - 10-19-2005 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? Anyone interested in making a text adventure as a group? - speedlemon - 10-19-2005 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? ![]() Anyone interested in making a text adventure as a group? - Liquid Snake - 10-19-2005 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... Anyone interested in making a text adventure as a group? - speedlemon - 10-19-2005 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: |